1 Introduction

Location-Allocation-Routing problem (LARP) (Drexl & Schneider, 2015; Karakostas et al., 2019) consists of three sub-problems, namely Facility Location Problem (FLP) (Das & Roy, 2019; Friedrich et al., 2018; Karatas & Yakıcı, 2018), Allocation Problem (AP) (Abyazi-Sani & Ghanbari, 2016; Mokhtar et al., 2019), and Vehicle Routing Problem (VRP) (Rodríguez-Martín et al., 2019; Tilk et al., 2019). The combination of VRP and FLP is known as the Location-Routing Problem (LRP) (Capelle et al., 2019; Dukkanci et al., 2019). LRP emerged in the late 1970s and early 1980s. It consists of two well-known problems in which locating vehicle depot centers is one of the most challenging issues in designing and configuring a Supply Chain Network (SCN), which needs to be done simultaneously with determining the optimal distribution routes of the vehicles. However, these two problems are usually investigated and solved in two separate phases. The distinction between these two issues results in increased costs and scheduling time. Therefore, the main aim of LRP is to simultaneously make the location and routing decisions in designing supply chain distribution networks with a wide range of applications (Farham et al., 2018a).

Supply Chain Management (SCM) comprises decisions at two levels (Sampat et al., 2017):

  1. (1)

    Strategic decisions on the sources of production, distribution, and sales.

  2. (2)

    Tactical decisions about providing network planning through the flow of materials over the network.

LRP combines strategic and tactical decisions in an SCN (Garcia & You, 2015). In the field of operations research, location problems have attracted much attention in recent decades considering other applicable problems simultaneously. These problems are diverse in terms of objective functions, which include minimizing fixed costs of establishments, total travel time, total traveled distance, or other related costs (Tamannaei & Rasti-Barzoki, 2019). On the other hand, VRP was first presented by Dantzig, Ramser (Dantzig & Ramser, 1959) as one of the most important optimization problems aiming at designing an optimal set of routes for a fleet of vehicles with a major intention of serving a certain number of customers observing different side constraints such as vehicle capacity, time windows, pickup, and delivery (Al Chami et al., 2019). Obviously, LRP is correlated with the problems of classical location and vehicle routing (Veenstra et al., 2018).

Two-Echelon LRP (2E-LRP) was introduced as an applicable extension of LRP (Zhou et al., 2019). In this problem, the location of facilities, including plants and warehouses, is addressed considering potential locations in addition to the allocation of demand points to warehouses and vehicle routing. The 2E-LRP assumes that these facilities can be used for a short time, which can be established by considering their establishment costs for the possible locations. Each echelon consists of three levels; the first level includes plants, the second includes intermediate facilities like warehouses, and the third level consists of the retailers or customers (Wang et al., 2018). The first and second levels construct the 1st echelon, and the second and third levels construct the 2nd echelon. In this case, warehouses/customers’ demands can be met with one or more shipments through a series of vehicles. In this distribution system, there are two types of vehicles; the first-type vehicles (with larger capacity) are related to the first echelon, while the second-type vehicles (with lower capacity) are related to the second echelon (Zhao et al., 2017).

Environmental issues in SCM include manufacturing process, material selection and procurement, product design, final product delivery, product management after consumption, and the useful life of the product that leads to generating a green supply chain. By increasing concerns about the need for environmental sustainability, companies have started to take effective actions through the pressure of governments, customers, investors, and other stakeholders (Li & Ramanathan, 2018; Pahlevan et al., 2021). Environmental studies have dramatically increased across the world, leading to an increase in the number of pertinent laws and regulations (Sarkodie & Strezov, 2018). Additionally, public pressure on this subject has forced companies to pay special attention to environmental issues over the past two decades (Chang et al., 2018). Moreover, production operation at the plant level with the least pollution has been known as a critical issue for the development and production of green products. Environmental activities of the supply chain can be measured by environmental efforts and performance of its players such as suppliers, manufacturers, and distributors (Jena et al., 2016).

According to statistics, the fuel consumption cost, as a great part of energy costs in logistics, accounts for 50% of the total operational cost for each distribution system, and it has the potential of surging with the increase of international oil price (Yao et al., 2015). Therefore, minimizing fuel consumption is viewed as an essential approach to cost-saving, environment protection, and reduction of distribution cost. The efficient location and routing, which can result finally in low fuel consumption, have received considerable attention in distribution systems. Due to the importance of decreasing the environmental pollution and disruption occurrences, we propose a novel mathematical model capable of optimizing the Two-Echelon Hierarchical Location-Allocation-Routing Problem (2EH-LARP) in an SCN design with the aim of reducing the total cost of production, environmental pollution, and fuel consumption of vehicles. Two algorithms of Grey Wolf Optimization (GWO) and Particle Swarm Optimization (PSO) are then designed to tackle the problem on large scale. Furthermore, the applicability and performance of the offered methodology are evaluated by a real case study in a dairy factory located in Iran.

The remainder of the paper is structured as follows. Section 2 reviews the most relevant research works. Section 3 describes the problem and our developed mathematical model. Section 4 describes the proposed methodology of the research, including the PSO and GWO algorithms. Section 5 discusses the numerical results of the proposed model, validation of the algorithms and sensitivity analyses related to the case study problem. Section 6 provides the conclusion and recommendations for future studies. Figure 1 illustrates the overall framework of the research.

Fig. 1
figure 1

Framework of the study

2 Related work

The first study on the location theory was conducted by Weber (Weber, 1909) indicating that an industry should be located where costs of raw materials transportation and final products can be minimized. Gendron, Semet (2009) presented two Mixed-Integer Linear Programming (MILP) models for locating and distributing multi-echelon supply chains. They introduced a liberalization solution method for these problems. In their research, different models of liberalization, including linear liberation and binary liberation, have been tested and compared with existing models.

Nguyen et al. (2012) focused on innovative ways of locating and distributing two-echelon chains. They proposed three greedy algorithms for these problems to generate initial solutions. They used the Generic seaRch Algorithm for the Satisfiability Problem (GRASP) algorithm Marques-Silva, Sakallah (1999) to improve the generated solutions. They compared the proposed method with the Genetic Algorithm (GA) and showed the desirable performance of this innovative method.

Shahabi et al. (2013) offered a mathematical model for locating facilities and distributing products considering inventory control in a four-echelon SCN. They defined hubs in the proposed network to deliver products. They mentioned that using hubs in the supply chain distribution system can reduce the distribution costs. They applied a variety of solvers in the Guide to Available Mathematical Software (GAMS) to solve the mathematical model. Yu et al. (2015) offered a multi-product integrated location-production–distribution planning model to design an SCN. The goal was to simultaneously determine the location of plants, the production amount of each product, and the amount sent to distribution centers and customers in a way to finally minimize the total cost. They treated their proposed problem using LINGO software.

Eitzen et al. (2017) presented a multi-objective model for the multi-commodity heterogeneous vehicle 2E-LRP. An urban goods movement context was evaluated using their proposed mathematical model. Zhao et al. (2018) designed a logistic network to joint delivery alliances by implementing a 2E-LRP in the parcel delivery industry. The goal was to find the best locations of depots and the allocation of city logistics terminals to minimize the total cost. Finally, a new approximation algorithm was designed and a comparative analysis was performed accordingly.

Wang et al. (2018) applied a customer clustering-based technique to solve the 2E-LRP with time windows. In their proposed model, a two objective mathematical model was formulated to concurrently minimize the total cost and maximize the customer satisfaction level. They implemented a modified Non-Dominated Sorting Genetic Algorithm-II (NSGA-II) to tackle the problem. Farham et al. (2018b) developed a branch and price algorithm based on a set-partitioning approach to solve the LRP with time windows in a supply chain. They could solve the pricing problem using a dynamic programming method. They achieved superior performance for the suggested technique on a set of small and medium-sized benchmarks.

Toro et al. (2017) designed a bi-objective MILP model for optimizing the Greenhouse Gas (GHG) emission in an LRP with considering fuel consumption minimization. They took into account a set of novel constraints with a concentration on maintaining problem connectivity requirements. They solved the proposed mathematical problem using the classical ε-constraint method. Eydi, Alavi (2019) investigated VRP in reverse logistics with the aim of fuel consumption optimization. They assumed that the fuel cost of vehicles was dependent on the traveled route and load, and customers could have split delivery. They implemented a Simulated Annealing (SA) algorithm to deal with the problem. Alinaghian et al. (2021) proposed an augmented Tabu Search (TS) to optimize an inventroy-routing problem with time windows with the aim of fuel consumption minimization along with vehicle and driver costs. They evaluated the performance of their algorithm against Differential Evolution (DE) algorithm.

Recently, Validi et al. (2021) offered a bi-objective three-echelon LRP model to concurrently minimize the total cost and total CO2 emission from the burnt fuel of vehicles. They applied three metaheuristic algorithms of Multi-Objective Genetic Algorithm II (MOGA-II), Multi-Objective Particle Swarm Optimization (MOPSO) and NSGA-II to tackle the problem.

On the other hand, some researchers have worked on the application of transportation-location problems within SCNs considering the application of heuristic algorithms (Das et al., 2020a, 2020b) and sustainability and environmental issues (Das et al., 2020c, 2021). Table 1 represents the latest studies conducted between 2003 and 2021 related to the subject of this research.

Table 1 A brief literature review

A review of the literature clearly shows that to well contribute to the body of knowledge, this research needs to consider the disruption of warehouses and the minimization of environmental pollution and fuel consumption in a two-echelon, multi-product 2EH-LARP. Considering the lack of lifelong operation of the facility and the possibility of their disruption, the realization of an energy-efficient 2EH-LARP in the supply chain becomes more and more realistic.

3 Problem statement

This study considers a two-echelon supply chain with three different levels: plants, warehouses, and retailers (customers). The main aim is to find a strategic planning and operational decisions simultaneously over a unique planning horizon that is assumed to be similar in each period. In other words, the main parameters of the problem (e.g., demand parameter) are defined for a time period, which is repeated in the next time periods. The strategic planning includes finding the best possible locations for plants and warehouses in the first and second levels of the first echelon. The operational decisions determine the best routes for vehicles in both echelons to have the minimum possible total cost. The total cost includes total fixed costs of the establishment of plants and central warehouses as well as the total transportation costs between plants and central warehouses (in the first echelon) and between central warehouses and retailers (in the second echelons).

The main assumptions of the model are listed as follow:

  • There are three levels of facilities: plants in level 1, warehouses in level 2, and retailers in level 3.

  • Each plant and warehouse has a different establishment cost.

  • Different types of products are considered in the supply chain.

  • The demands of warehouses are considered as the main variable that is determined by the retailers’ demands.

  • Vehicles of type 1 are defined to cover the demands in the first echelon. Warehouses would receive their demands for different products from plants.

  • Vehicles of type 2 are defined to cover the demands in the second echelon. Retailers would receive their demands for different products from warehouses.

  • Vehicles belonging to each type have their own capacity and usage cost.

  • The capacity of plants/warehouses is fixed for each type of product.

  • All demands should be satisfied in each echelon. All demand facilities can receive their demands for different products from different supplying facilities.

  • Split deliveries by vehicles are not allowed.

  • Disruptions are defined for warehouses with a specific percentage.

  • The number of established plants and warehouses is limited.

  • Fixed fuel consumption rates are taken into account for each type of vehicle, which is dependent on the amount of traveled distance. This assumption denotes the energy-efficiency concept.

  • CO2 emissions are considered in terms of imposed costs for transportations of vehicles.

3.1 Mathematical model

In this section, a novel mathematical model including the objectives, limitations, and assumptions of the problem is developed. The main superiority of the proposed model is because of its hierarchal structure which connects different levels efficiently. Furthermore, we refer the reader to Appendix A for a list of the notations used in the proposed model.

$$ \begin{aligned} Minimize~~Z & = \mathop \sum \limits_{{i \in I~~~}} \mathop \sum \limits_{{p \in P}}^{~} Y_{{ip~}} f_{{ip}} + \mathop \sum \limits_{{j \in J~~~}} \mathop \sum \limits_{{p \in P}}^{~} Y^{\prime}_{{jp~}} f^{\prime}_{{jp}} \\&\quad + \mathop \sum \limits_{{i \in I}} ~\mathop \sum \limits_{{j \in J}} ~\mathop \sum \limits_{{p \in P}} c_{{ijp}} ~D_{{jp~}} X_{{ijp}} + \mathop \sum \limits_{{j \in J}} ~\mathop \sum \limits_{{k \in K}} ~\mathop \sum \limits_{{p \in P}} c'_{{jkp}} ~D'_{{kp~}} X'_{{jkp}} \\&\quad + \mathop \sum \limits_{{i \in I}} ~\mathop \sum \limits_{{j \in J}} ~\mathop \sum \limits_{{m_{1} \in M_{1} }} cg_{{ijm_{1} }} z_{{ijm_{1} }} + \mathop \sum \limits_{{j \in J}} ~\mathop \sum \limits_{{k \in K}} ~\mathop \sum \limits_{{m_{2} \in M_{2} }} cg'_{{jkm_{2} }} z^{\prime}_{{jkm_{2} }} ~ \\&\quad + \gamma \left( {\mathop \sum \limits_{{i \in I}} ~\mathop \sum \limits_{{j \in J}} ~\mathop \sum \limits_{{m_{1} \in M_{1} }} \mathop \sum \limits_{{m_{2} \in M_{2} }} \mathop \sum \limits_{{k \in K}} d_{{ij}} z_{{ijm_{1} }} + d^{\prime}_{{jk~}} z^{\prime}_{{jkm_{2} }} )} \right) \\&\quad + \mathop \sum \limits_{{i \in I}} \mathop \sum \limits_{{m_{1} \in M_{1} }} CV_{{m1}} U_{{im_{1} }} + \mathop \sum \limits_{{t \in T}} \mathop \sum \limits_{{m_{2} \in M_{2} }} CV'_{{m2}} ~U'_{{jm_{2} }} \\&\quad + \gamma '\left( {\mathop \sum \limits_{{i \in I}} \mathop \sum \limits_{{j \in J}} \mathop \sum \limits_{{m_{1} \in M_{1} }} \left( {fa_{{m_{1} }} + fb_{{m_{1} }} La_{{jpm_{1} }} } \right)d_{{ij}} z_{{ijm_{1} }} + \mathop \sum \limits_{{i \in I}} \mathop \sum \limits_{{j \in J}} \mathop \sum \limits_{{m_{1} \in M_{1} }} fa_{{m_{1} }} d_{{ji}} ~z_{{jim_{1} }} } \right) \\&\quad + \gamma '\left( {\mathop \sum \limits_{{j \in J}} \mathop \sum \limits_{{k \in K}} \mathop \sum \limits_{{m_{2} \in M_{2} }} \left( {fa'_{{m_{2} }} + fb'_{{m_{2} }} Lb_{{kpm_{2} }} } \right)d'_{{jk}} ~z^{'} _{{jkm_{2} }} + \mathop \sum \limits_{{j \in J}} \mathop \sum \limits_{{k \in K}} \mathop \sum \limits_{{m_{2} \in M_{2} }} fa'_{{m_{2} }} d'_{{kj}} ~z^{'} _{{kjm_{2} }} } \right) \\ \end{aligned} $$
(1)

Equation (1) represents the objective function indicating thtal cost minimization. It has seven terms: establishment costs of plants and warehouses, processing costs of shipments in the 1st and 2nd echelons, environmental pollution costs, traveling costs of vehicles, usage costs of vehicles, and fuel consumption costs of vehicles.

$$ \sum\limits_{i \in I}^{{}} {X_{ijp} } = 1\;\;\,\;\;\forall j \in J,\forall p \in P, $$
(2)
$$ \mathop \sum \limits_{j \in J}^{ } X_{jkp}^{\prime } = 1 \;\;\;\;\;\; \forall k \in K, \forall p \in P, $$
(3)

Equations (2) and (3) express that the total demand for each warehouse and retailer should be met for the established facilities, respectively.

$$\sum_{p\in P}{Y}_{ip } \le \left|P\right| \forall i\in I,$$
(4)
$$ \mathop \sum \limits_{p \in P}^{ } Y_{jp}^{\prime } \le \left| P \right| \forall j \in J, $$
(5)

Equations (4) and (5) state that each plant can produce a maximum of all types of products, and each central warehouse can provide a maximum of all types of products, respectively.

$$\sum_{j\in J}{X}_{ijp} \le np{ Y}_{ip } \forall i\in I ,\forall p\in P,$$
(6)
$$ \mathop \sum \limits_{k \in K}^{ } X_{jkp}^{\prime } \le nw Y^{\prime}_{jp } \forall j \in J ,\forall p \in P, $$
(7)

Equations (6) and (7) indicate that in accordance with the requirements of the central warehouse, the central warehouse should be at least equal to the potential number of plant establishments, while the retailers' requests should be equal to the potential number of central warehouses.

$$ D_{jp } = \mathop \sum \limits_{k \in K} D_{kp}^{\prime } X_{jkp}^{\prime } \;\;\;\;\;\;\;\forall j \in J ,\forall p \in P, $$
(8)

Equation (8) specifies the amount of demand for each central warehouse.

$$\sum_{j\in J}{{ D}_{jp }X}_{ijp} \le {S}_{ip}{ Y}_{ip } \forall i\in I ,\forall p\in P,$$
(9)
$$ \mathop \sum \limits_{k \in K}^{ } D_{kp}^{\prime } X_{jkp}^{\prime } \le \left( {1 - \alpha_{jp} } \right)S_{jp}^{\prime } Y_{jp}^{\prime } \forall j \in J ,\forall p \in P, $$
(10)

Equations (9) and (10) represent the capacity constraints of the plant and the central warehouse, respectively. In Eq. (9), the disruption of the warehouse is investigated. If a disruption occurs, a percentage of the capacity will be unusable.

$$\sum_{{m}_{1}\in {M}_{1}}\sum_{i\in I}{z}_{ij{m}_{1}}=1 \forall j\in J,$$
(11)
$$ \mathop \sum \limits_{{m_{2} \in M_{2} }} \mathop \sum \limits_{j \in J} z_{{jkm_{2} }}^{\prime } = 1\;\;\;\;\;\;\;\forall k \in K, $$
(12)

Equations (11) and (12) ensure that all demands of each warehouse and retailer should be satisfied by relevant vehicles, respectively.

$$\sum_{j\in J}{z}_{ij{m}_{1}}=\sum_{j\in J}{z}_{ji{m}_{1}} \forall {m}_{1}\in {M}_{1}, i\in I,$$
(13)
$$ \mathop \sum \limits_{k \in K} z_{{jkm_{2} }}^{\prime } = \mathop \sum \limits_{k \in K} z_{{kjm_{2} }}^{\prime } \;\;\;\;\;\;\;\forall m_{2} \in M_{2} ,j \in J, $$
(14)

Equations (13) and (14) indicate that inner flows should be equal to outer flows for all nodes within the 1st echelon and 2nd echelon (flow balance), respectively. In other words, if a vehicle arrives at a node, it should exit that node.

$$\sum_{j\in J}{z}_{ij{m}_{1}}\le M {U}_{i{m}_{1}} \forall {m}_{1}\in {M}_{1}, i\in I,$$
(15)
$$ \mathop \sum \limits_{j \in J} z_{{jkm_{2} }}^{\prime } \le M U_{{jm_{2} }}^{\prime } \;\;\;\;\;\;\;\;\;\;\;\forall m_{2} \in M_{2} ,j \in J, $$
(16)

Equations (15) and (16) express that each vehicle in each echelon would be used when its usage cost has been paid, respectively for the 1st echelon and 2nd echelon. In other words, if a vehicle is not determined to be used, it cannot construct any route.

$$\sum_{j\in J}\sum_{i\in I}{{ D}_{jp }z}_{ij{m}_{1}}\le {Cap}_{p{m}_{1}} \forall {m}_{1}\in {M}_{1},p\in P,$$
(17)
$$ \mathop \sum \limits_{j \in J} \mathop \sum \limits_{k \in K} D_{kp}^{\prime } z_{{jkm_{2} }}^{\prime } \le Cap_{{pm_{2} }}^{\prime } \;\;\;\forall m_{2} \in M_{2} ,p \in P, $$
(18)

Equations (17) and (18) are related to the capacity constraints of the first and second echelons’ vehicles, respectively.

$$ O_{j} - O_{{j^{\prime}}} + M z_{{ijm_{1} }} \le M - 1\;\;\;\;\;\;\;\;\;\;\;\;\;\;\forall m_{1} \in M_{1} , \forall j,j\prime \in J, $$
(19)
$$ O_{k}^{\prime } - O_{k\prime }^{\prime } + M z_{{jkm_{2} }}^{\prime } \le M - 1\;\;\;\;\;\;\;\;\;\forall m_{2} \in M_{2} , \forall k,k\prime \in K, $$
(20)

Equations (19) and (20) are related to the elimination of sub-tours for the 1st and 2nd echelons’ vehicles, respectively.

$${\sum }_{h\in I\cup J}{z}_{ih{m}_{1}}+{\sum }_{h\in TN}{z}_{jh{m}_{1}}\le 1+\lceil{X}_{ijp}\rceil \forall i\in I,j\in J,p\in P,{m}_{1}\in {M}_{1},$$
(21)
$$ \mathop \sum \limits_{h \in J \cup K} z_{{jhm_{2} }}^{\prime } + \mathop \sum \limits_{h \in J \cup K} z_{{khm_{1} }} \le 1 + X_{jkp}^{\prime } \;\;\;\;\;\;\;\;\forall j \in J,k \in K,p \in P,m_{2} \in M_{2} , $$
(22)

Equations (21) and (22) connect allocating and routing components in the 1st and 2nd echelons, respectively. These constraints link the related variables of allocation and routing to each other.

$$ (La_{{jpm_{1} }} - D_{jp } - La_{{j\prime pm_{1} }} )z_{{jj^{\prime}m_{1} }} = 0\;\;\;\;\;\;\;\forall j,j\prime \in J; j \ne j\prime ,\forall p \in P,m_{1} \in M_{1} , $$
(23)
$$ (Lb_{{kpm_{2} }} - D_{kp}^{\prime } - Lb_{{k\prime pm_{2} }} )\;z_{{kk\prime m_{2} }}^{{}} = 0\;\;\;\;\;\;\;\forall k,\;k\prime \in K; k \ne k\prime ,\forall p \in P,m_{2} \in M_{2} , $$
(24)

Equations (23) and (24) calculate the load amount of each product for vehicles in the 1st and 2nd echelons, respectively.

$$ \begin{gathered} 0 \le X_{ijp} \le 1 , 0 \le X^{\prime}_{jkp} \le 1 ; Y_{ip } \in \left\{ {0,1} \right\}, Y^{\prime}_{jp } \in \left\{ {0,1} \right\} \hfill \\ \forall i \in I ,\forall p \in P ,\forall j \in J, \;\forall k \in K \hfill \\ \end{gathered} $$
(25)
$$ \begin{gathered} z_{{ijm_{1} }} , z^{\prime}_{{jkm_{2} }} , U_{{im_{1} }} , U^{\prime}_{{jm_{2} }} \in \left\{ {0,1} \right\}; O_{j} , O^{\prime}_{k} \in Z^{ + } ; D_{jp} , La_{{jm_{1} }} , Lb_{{km_{2} }} \ge 0 \hfill \\ \forall i \in I ,\forall p \in P ,\forall j \in J, \;\forall k \in K, \forall m_{1} \in M_{1} , \forall m_{2} \in M_{2} \hfill \\ \end{gathered} $$
(26)

and Eqs. (25) and (26) specify the types of location and rog, respectively.

The linearization of the proposed model is provided in Appendix B.

4 Methodology

Due to the complexity of optimization problems, a lot of researchers have been working on a variety of optimization problems and applications of computers to figure out the best optimization tools. In different kinds of research studies, it has been demonstrated that the LRP is an NP-hard problem (Şahin et al., 2007). Due to this, it is critical to implement approximate solution techniques to treat the problem in large sizes within a reasonable computational time. In this regard, GWO algorithm is employed to solve the problem as one of the novel metaheuristic algorithms and its performance is assessed compared to the PSO algorithm and CPLEX. Both algorithms are known as two fast and efficient solution methods in the literature (Suman et al., 2021). First, it is critical to choose the best way of encoding the solution of the mathematical model. In the following section, the solution representations of the algorithms are first described, and then their operational mechanisms are introduced.

4.1 Solution representation and initial solutions

A solution of the problem includes two main parts. In the first part, the locations of warehouses and plants are determined, and in the second part, the state of the transportation routes between supply chain members is determined. For the first part of the string structure, the solution is in the form of vectors with values between 0 and 1. The values of more than 0.5 represent the establishment of a plant or warehouse and a minimum value of 0.5 represents the failure to establish a plant or warehouse. The last column of the solution representation shows the vehicle index. This index represents that which vehicle should visit each plant of warehouses. For example, consider 2 potential plants, 3 potential warehouses, 6 product types, and 2 vehicles in the first echelon and 3 vehicles in the second one; a sample of the first part of the solution is shown in Table 2.

Table 2 Solution representation example

As it is clear in Table 2, each row belongs to a plant or warehouse. Each column also represents a product type. In the first plant, the values for products 1, 2, and 6 are greater than 0.5, which shows the establishment of plant 1 for the production of these products. Plant 2 is also established to produce products 3, 4, 5, and 6. In the case of warehouses, the first warehouse will be established for storing products 1, 3, and 5. The third warehouse will be established to store products 1, 2, 4, and 6. Additionally, all values for the second warehouse are less than 0.5, which means that the warehouse will not be established.

In the last column, the vehicle index is shown. As we have two vehicles in the first echelon (flows from plants to warehouses), the indices less than 0.5 represent the first vehicle and the others represent the second one. The exampled solution representation illustrates that two plants use vehicle 2 for covering the warehouses. In the second echelon (flows from warehouses to retailers), we have three vehicles. Thus, indices less than 0.33 represent the first vehicle, while indices between 0.33 and 0.67 represent the second vehicle, and greater than 0.67 represent the third vehicle. As a result, in the above example, the first and second warehouses use vehicle 2, while the third warehouse uses vehicle 1.

After determining the vehicles’ assignment, their routes can be constructed using a heuristic method. This approach is applied to construct a low-cost routing. To this end, the 2-opt method is used as a best-known route generation heuristic (Goli et al., 2018). After determining the used vehicles and the constructed route for each one, the amount of fuel consumption and emission costs can be calculated.

The second part of the solution shows the rate of sending each product from plants to warehouses and from warehouses to retailers. In many cases, only one plant produces a particular product type; therefore, warehouses must receive their entire demand from it. In the example given in Table 2, except product 6, the rest products are produced only by one plant. Moreover, in some cases, only warehouse 1 stores a special product. In that example, products 2, 4, and 6 are only stored in warehouse 3. In such a situation, the entire demand of warehouses and retailers will be provided only by a single plant. Also, the retailers who demand product 4 must receive it from warehouse 3 and warehouse 3 must also receive its demand from plant 2. However, in many cases, there are several options for sending products from plants to warehouses and from warehouses to retailers. In such a situation, the total amount of shipments is planned with respect to the environmental aspects in different echelons in order to supply the entire demand.

For generating feasible solutions, constraints are observed in each step. For example, consider that warehouse 3 is responsible for supplying product 6. This warehouse can supply the product from plant 1 or plant 2. In such a situation, the total cost of shipments and environmental pollution is calculated from plants 1 or 2 to warehouse 6, and the one with the lowest cost is selected (suppose that the minimum amount is caused by plant 2). If the capacity of plant 2 is less than the total demand of product 6, then the total capacity of plant 2 will be used and the remained demand will be provided by plant 1 that has been already established.

After determining the locations of warehouses and plants, shipment planning is implemented. Between different members of the supply chain, the capacity constraints of warehouses, plants, or vehicles may be violated. Therefore, a penalty approach is defined to be applied to the objective function. In the event of a capacity constraint violation in the objective function, a penalty is considered to be equal to M. It should be noted that destruction affects the amount of supply capacity in the plants and warehouses. Furthermore, pollution is considered in the objective function that affects total costs. Therefore, disruption and pollution are major issues for proposed meta-heuristics to find feasible and near-optimal solutions, respectively, to them.

4.2 Grey wolf optimization algorithm

GWO algorithm is a nature-inspired meta-heuristic algorithm that emulates the behavior of grey wolves and the hierarchy of leadership and their hunting method. The GWO algorithm was first introduced by Mirjalili et al. (2014) with special attention to the collective hunting of grey wolves. Grey wolf belongs to the Canadian wolf family, which is at the top of the food chain and prefers to live in groups. On average, the group consists of a family of 5–11 animals. Interestingly, they have a strict social rule in such a way that the wolf alpha is the ruler wolf in the group and his orders must be obeyed by the group. Alphas are responsible for deciding when the group can hunt, sleep, move, etc. The second level is the wolf beta. Beta is the wolf under the command of alpha; it helps alpha in decision-making and other group activities. Wolf beta is likely the best candidate for alpha and plays the role of a vice president for alpha and the moderator. The lowest degree is dedicated to omega grey wolf. Omega wolves perform sacrificial works for the other members of the group. They should eat food after the others. If a wolf is not categorized as alpha, beta or omega, it is called delta. Delta wolves follow alpha and beta and rule on omegas (Mirjalili et al., 2014). For mathematical modeling, the wolf social rule designates the most desirable solution of \(\alpha\) when developing the GWO.

As a result, the 2nd and 3rd best solutions are called \(\beta\) and \(\delta\) wolves, respectively. The remained solutions are supposed to be \(\omega\). Thus, the GWO algorithm is led by \(\alpha\),\(\beta\), and \(\delta\), and the \(\omega\) wolves follow these three classes. The prey is encircled by grey wolves during their hunting.

For mathematical modeling, Eqs. (27) and (28) are proposed for this encircling.

$$\overrightarrow{D}=\left|\overrightarrow{C}.\overrightarrow{{X}_{P}}\left(t\right)-\overrightarrow{X}\left(t\right)\right|$$
(27)
$$\overrightarrow{X}\left(t+1\right)={X}_{P}\left(t\right)-\overrightarrow{A}.\overrightarrow{D}$$
(28)

where t denotes the number of iterations, A and C are the vector coefficient, \(\overrightarrow {X}_{P}\) is the vector of the hunting position, and X stands for the position vector of a grey wolf.

Equations (29) and (30) calculate the vectors of A and C:

$$\overrightarrow{A}=2\overrightarrow{a}.\overrightarrow{{r}_{1}}-\overrightarrow{a}$$
(29)
$$\overrightarrow{C}=2.\overrightarrow{{r}_{2}}$$
(30)

where the \(\overrightarrow {a}\) elements are linearly reduced from 2 to 0 under the flow of iterations, and \(r_{1}\) and \(r_{2}\) denote random vectors that take values within [0, 1].

Grey wolves can detect the position of the prey and encircle it. Hunting is principally conducted by alpha. Moreover, beta and delta may be occasionally involved in hunting. Therefore, in an absolute search space, we do not have any strategy about the optimal position (hunting). For the mathematical simulation of grey wolf hunting behavior, we assume that alpha (best candidate solution), beta, and delta have enough knowledge about potential hunting positions. Hence, the first three best-generated solutions are saved and we force other search factors (omegas) to update their position in accordance with the location of the best search factors (Medjahed et al., 2016). These operations are implemented according to Eqs. (31) to (33).

$$ \overrightarrow {{D_{\alpha } }} = \left| {\overrightarrow {{C_{1} }} .\overrightarrow {{X_{\alpha } }} - \vec{X}} \right|,\;\overrightarrow {{D_{\beta } }} = \left| {\overrightarrow {{C_{2} }} .\overrightarrow {{X_{\beta } }} - \vec{X}} \right|,\,\overrightarrow {{D_{\delta } }} = \left| {\overrightarrow {{C_{3} }} .\overrightarrow {{X_{\delta } }} - \vec{X}} \right|, $$
(31)
$$ \vec{X}_{1} = \overrightarrow {{X_{\alpha } }} - \overrightarrow {{A_{1} }} .\left( {\vec{D}_{\alpha } } \right),\;\vec{X}_{2} = \overrightarrow {{X_{\beta } }} - \overrightarrow {{A_{1} }} .\left( {\vec{D}_{\beta } } \right),\;\vec{X}_{3} = \overrightarrow {{X_{\delta } }} - \overrightarrow {{A_{1} }} .\left( {\vec{D}_{\delta } } \right), $$
(32)
$$\overrightarrow{X}\left(t+1\right)=\frac{{\overrightarrow{X}}_{1}+{\overrightarrow{X}}_{2}+{\overrightarrow{X}}_{3}}{3}$$
(33)

All in all, the GWO algorithm starts its search with the creation of a randomly-generated population of grey wolves or candidate solutions. The probable position of the prey is then estimated by alpha, beta and delta wolves during the iteration. Candidate solutions update their distances to the prey. The parameter “a” will be reduced from 2 to 0 to strengthen the prey identification process and attack to it. When |A|> 1, the candidate solutions are divergent, and when |A|< 1, the candidate solutions are converging. The pseudo-code of the suggested GWO algorithm is depicted in Fig. 2.

Fig. 2
figure 2

Pseudo-code of the GWO algorithm (Medjahed et al., 2016)

To implement these structures in this research, Eqs. (27)–(33) are calculated for each row of each solution representation matrix. An example for this calculation is presented in Table 3.

Table 3 An example of the GWO procedure

The GWO algorithm has three main parameters: the maximum number of iteration (N_iter), number of search agents (N_search), and position determination factor (a), which can affect the quality of the results. In this research, GWO parameters are specified using a trial and error method on extensive examples. Finally, these parameters are set with the values of N_iter = 500, N_search = 30, and \(a=2-\frac{2 t}{\mathrm{N}\_\mathrm{iter}}\), where t represents the number of iterations.

4.3 Particle swarm optimization algorithm

PSO algorithm was suggested by Eberhart, Kennedy (Eberhart & Kennedy, 1995), which is based on the motion of particle swarm and inspired by the collective behavior of birds in nature. Since the application of this algorithm requires only a few primitive computing operators, the implementation of this algorithm is cost-effective. This algorithm performs as follows: if a swarm of particles is distributed as optimization variables in the search space, it is obvious that some particles will have a superior position to the other particles. Consequently, according to the forward behavior of the particles, other particles try to get to the position of the better particles, while the positions of the better particles are also changing. It should be noted that the changes made to the positions of particles are according to the experience of the particles in previous movements and the experience of neighboring particles. In other words, each particle is aware of its own superiority or non-superiority over the neighboring particles as well as the whole group.

The main steps to run this algorithm are as follow:

Step 1 Creating a random population.

Step 2 Determining the best particle and the best personal memories of each particle.

Step 3 Updating the speed and positions of all particles.

Step 4 Determining the best particle and the best personal memories of each particle.

Step 5 Going to Step 3 if the stopping conditions are not met; otherwise, the algorithm is terminated.

The first population of the particles is randomly initialized. In each iteration, the particles are assessed using a fitness function. The fitness function represents the objective of the proposed mathematical model. If the generated particle fitness value is the best one, this particle stores it as the personal best (Pbest). The particle with the best fitness value is chosen as a global best (Gbest) at the end of each iteration. In each iteration, each particle changes its position regarding the Pbest and Gbest. At the end of the algorithm, the Gbest is set as the best solution (AbuNaser et al., 2015). Figure 3 represents the pseudo-code of the suggested PSO algorithm.

Fig. 3
figure 3

The pseudo-code of the PSO algorithm (Kennedy & Eberhart, 1995)

According to Fig. 3, in each iteration, Pbest and Gbest are specified and then the velocity of each particle (\({V}_{(t)}\)) is calculated by Eq. (34). Then, the position of each particle (\({X}_{(t)}\)) is updated to \({X}_{(t+1)}\) using Eq. (35).

$${V}_{(t)}={V}_{(t-1)}+C1\times Rand\times \left(Pbest-{X}_{(t)}\right)+C2\times Rand\times (Gbest-{X}_{(t)})$$
(34)
$${X}_{(t+1)}={X}_{(t)}+{V}_{(t)}$$
(35)

In this research, all cells of a solution should be between 0 and 1. On the other hand, according to Eq. (35), no constraint is applied to ensure this condition. Thus, in this research, we modify \({X}_{(t+1)}\) using Eqs. (36) and (37).

$${X}_{(t+1)}=\mathrm{max }\{{X}_{(t+1)},0\}$$
(36)
$${X}_{(t+1)}=\mathrm{min }\{{X}_{(t+1)},1\}$$
(37)

The procedure of the PSO algorithm is described for each row of the proposed solution representation. An example is given in Table 4.

Table 4 An example of the PSO procedure

The trial and error technique is employed to determine the best values of PSO. Table 5 provides the PSO parameters and their best values.

Table 5 The best values for PSO parameters

5 Numerical results

This section presents the computational and analytical results provided by the suggested solution techniques. First, to validate the proposed mathematical model and evaluate the solution methods, several random instance problems are generated in different sizes. The input information of these problems and the values of the parameters are given in Tables 6 and 7, respectively. Table 8 provides the obtained results by different solution methods. After testing the validation of the proposed mathematical model by the exact method and comparing the algorithms in different problems, a case study of Kaleh Dairy Industries Company in Iran is analyzed to test the applicability of the methodology. Then, the optimal policies are obtained and analyzed using the sensitivity analysis performed on the retailers’ demand and warehouses’ disruption parameters.

Table 6 The input data of the generated problems
Table 7 Input data related to the model’s parameters
Table 8 Computational results

5.1 Testing the validation of the proposed mathematical model

The mathematical model is validated using GAMS optimization software version 24.1.2 and solved by CPLEX solver. Furthermore, the proposed algorithms are coded in the MATLAB 2014 software package using a system with 2.60 GHz processor of core i7, and 12.00 GB of RAM.

According to the results given in Table 8, The CPLEX was able to solve 8 out of 10 problems considering 3600 s runtime limitation. It was able to solve the first 7 problems optimally and was unable to solve P8 optimally within 3600 s. Additionally, as the results show, the GWO algorithm outperformed the PSO algorithm, compared with the exact method in all instance problems with an average gap of 0.78%, while the PSO algorithm showed the average gap of 0.90% in the first 8 problems.

Furthermore, the average runtime of the CPLEX in the 8 initial problems is about 981.97 s. Meanwhile, the average runtimes of the PSO and GWO algorithms are 49.13 and 65.17 s, respectively. Both algorithms could solve the problems in less than 300 s. By considering these acceptable runtimes, the average gaps of the proposed algorithms can be ignored. Finally, it can be mentioned that based on the results obtained and the importance degree of runtime against the objective gap, the GWO algorithm acted better than the PSO algorithm; therefore, it was chosen for solving the case study problem.

To illustrate the obtained runtimes schematically, the comparison of the computational runtimes is displayed in Fig. 4. Briefly, the results show that the PSO and GWO algorithms obtain the optimal solution in small and medium sizes within a very short runtime.

Fig. 4
figure 4

Comparison of runtime of different solution methods

5.2 Case study

In this section, a case study of a dairy supply chain is considered with a distribution of 22 different dairy products in a given network with 26 retailers. The goal is to find the optimal locations for central warehouses to be linked with a pre-established source plant that can supply all these products. The manager wants to specify the optimal policy for potential development plans. The proposed model was modified according to the input information. For example, Eq. (4) changes as \(\sum_{p\in P}^{ }{Y}_{ip }=22, \forall i=1\). The values of parameters are based on historical data and expert forecasts, which have been gathered for a 5-year planning. It should be noted that \({\alpha }_{j}=0.02\) is considered in each period. Other parameter values are provided by historical data that existed in Kaleh Dairy Industries Company.

The case is solved using the superior algorithm, i.e., the GWO algorithm, and the obtained result is depicted in Fig. 5. The obtained objective value is 10,5462,24,613 monetary units.

Fig. 5
figure 5

The schematic solution of the case

As it is shown in Fig. 5, three central warehouses are chosen to be established and located with the numbers 3, 4, and 5. Eight retailers are assigned to the central warehouse 3. Nine retailers are assigned to central warehouse 4, and nine remaining retailers are assigned to central warehouse 5 such that all of these warehouses are supplied only by one plant. The warehouses cover all demands of retailers for each product. This hierarchy is formed according to Fig. 5.

The optimal routes and the number of required vehicles are presented in Table 9.

Table 9 The optimal routes of vehicles

According to Table 9, two and five vehicles have been used in the plant and warehouses, respectively. In addition, the optimal routes are shown with the sequence of serving in each echelon.

In the following, a variety of sensitivity analyses are conducted on the retailers’ demand and disruption parameters in order to study the behavior of the objective function against the parameters’ fluctuations in the real world. In other words, sensitivity analysis can be utilized as a critical tool in organizations to help managers in different situations.

Table 10 represents the obtained results of sensitivity analyses. Moreover, Figs. 6 and 7 depict the behavior of the objective function against changing the retailers’ demand and disruption occurrence probability in warehouses, respectively.

Table 10 The sensitivity analysis of the case
Fig. 6
figure 6

The sensitivity analysis of the retailers’ demand parameter

Fig. 7
figure 7

The sensitivity analysis of the disruption occurrence probability in central warehouses

As it is obvious from the results of sensitivity analyses, the objective function has different fluctuations against different change intervals of the parameters. In Fig. 6, due to a 20% increase in retailers' demand, the problem has become infeasible, which is due to the lack of estimation of the demand for central warehouses by the only existing plant that is determined by the demand of all retailers for different products. However, in case of a 10% increase, the objective increase is significant (up to 34%). In the decrease intervals of the demand parameter, these changes are less in the objective function and with a relatively steady slope. In Fig. 7, there is no remarkable change in the objective function for a 10% reduction of the parameter, while the change in the objective function is noticeable for the parameter reduction of 20%. By increasing the disruption percentages, the increase in the objective function has been accompanied by a relatively steady slope, which can increase it up to 16.9%.

To come up with managerial insights, it should be noted that in the real world, managers are looking for low-cost solutions. This is while many different types of costs have opposite effects on each other which can be found in the studies of logistics systems. For example, reducing the cost of locating warehouses greatly increases the cost of distributing goods. The approach used in this research helps logistics system managers, especially in the dairy industry, to make the best possible decision with a comprehensive overview of all processes. Another important point is that determining the best possible decision-making will be very difficult and time-consuming due to the complexity of the problem, therefore, the suggested GWO algorithm as an efficient tool will help to find the best solution in a reasonable time.

Furthermore, the outputs derived from the sensitivity analysis can be considered in the decision-making of the organization’s management to specify the optimal policy in a way to meet the retailers' demand and develop the organization. In other words, managers can handle different situations by analyzing them and evaluating the required level of resources to move toward the minimum total cost without any failure.

6 Conclusion

This study proposed an MILP formulation for a 2EH-LARP within an SCN of three levels: production plants, warehouses, and retailers. The proposed mathematical model was designed based on supply chain disruptions, environmental pollution, and fuel consumption aspects to minimize the total cost. Two metaheuristic algorithms, i.e., the PSO algorithm and the GWO algorithm, were used to solve the problem. Then, the results were compared with the CPLEX solver of the GAMS software with the applied exact method. The obtained computational results proved the validation of the developed model and compared the suggested algorithms in terms of performing their defined task. It was found that the GWO algorithm has a clear superiority over PSO. Finally, a case study was conducted on a dairy supply chain, and the optimal policy was depicted schematically considering the estimated optimal total cost. After performing a sensitivity analysis on the case study, it was found that the objective was highly dependent on the number of retailers’ demand and the disruption parameters. As the retailer’s demand increased by 10%, the total cost increased up to 34% and by 20% increase in disruption percentage of the warehouse, the total cost increased up to 16.9%. The findings can be taken into consideration by managers in managerial decision-making and policy making of the plant development.

Regarding future studies, the following recommendations are given based on the main limitations of the research. The study of uncertainty conditions in the mathematical model such as utilizing fuzzy logic or robust optimization would be helpful to make the model closer to real-world conditions. Other well-known metaheuristic algorithms, such as TS algorithm or a hybrid version can be employed and compared with the proposed GWO and PSO. Moreover, considering a monthly or annual planning period in the model is one of the useful recommendations to create a dynamic view of the problem. Eventually, the application of Internet-of-Things can be studied in the problem to improve the efficiency of vehicles and finally the performance of the SCN.