A wale optimization algorithm for distributed flow shop with batch delivery

In this study, a distributed flow shop scheduling problem with batch delivery constraints is investigated. The objective is to minimize the makespan and energy consumptions simultaneously. To this end, a hybrid algorithm combining the wale optimization algorithm (WOA) with local search heuristics is developed. In the proposed algorithm, each solution is represented by three vectors, namely a job scheduling sequence vector, batch assignment vector, and a factory assignment vector. Then, an efficient neighborhood structure is applied in the proposed algorithm to enhance search abilities. Furthermore, the simulated annealing algorithm and clustering method are embedded to improve the global search abilities of the algorithm. Finally, 30 instances are generated based on realistic application to test the performance of the algorithm. After detailed comparisons with three efficient algorithms, i.e., ABC-Y, ICA-K, and IWOANS, the superiority of the proposed algorithm is verified.


Introduction
With the rapid development of manufacturing, many enterprises began to consider multiple factories working at the same time which formed distributed scheduling (DS). In DS, the distributed flow shop scheduling problem (DFSP) is the most widely studied (Hatami et al. 2015;Li et al. 2020Li et al. , 2021Rifai et al. 2016;Ying et al. 2017;Deng and Wang 2017;Gonzalez-Neira et al. 2017;Bargaoui et al. 2017;Shaya et al. 2018;Shao et al. 2019;Seidgar et al. 2019), where many types of constraints have been researched, such as sequence-dependent setup times (Hatami et al. 2015;, no-wait (Shao et al. 2019), no-idle (Ying et al. 2017), stochastic time (Gonzalez-Neira et al. 2017), release time , and random machines breakdowns (Seidgar et al. 2019). In addition, many types of objectives, such as makespan (Li et al. 2020), total cost, and average tardiness (Rifai et al. 2016), total tardiness (Deng and Wang 2017), and energy consumption (Li et al. 2021), are also minimized. These studies considered different types of constraints and objectives in DFSP, which can be closer to the reality. However, most jobs should be assembled into different groups of products and delivered to different companies, where the assembly constrains should be taken as a challenging factor .
Nowadays, batch delivery has been used in various fields (Marandi and Ghomi 2019;Shen et al. 2014;Akbalik and Rapine 2018). Wang et al. (2019) considered order selection and assignment in the distributed problems. Yin et al. (2016) integrated production and batch delivery scheduling that processed and delivered jobs together in batches. Qi and Yuan (2017) studied a two-agent scheduling problem with batch delivery. Basir et al. (2018a) presented a batch delivery system on a two-stage assembly flow shop. Noroozi et al. (2018) considered a third-party logistics distribution, where production scheduling and batch delivery were combined. Jiang et al. (2019) studied the scheduling problem to deliver the products to the customers in batches. Kong et al. (2018) proposed a Just-in-Time strategy to precast construction in a batch delivery problem. Kazemi et al. (2017) considered batching delivery with assembly flow shop scheduling. The batch delivery procedures have also been researched by Agnetis et al. (2016) and Wang et al. (2017). However, less literature has considered DFSP with batch delivery constraints.
Recent years, many types of meta-heuristics have been developed for solving different optimization problems (Basir et al. 2018b;Karaboga et al. 2014;Peng et al. 2018;Yurtkuran et al. 2018;Liao et al. 2012;Gao et al. 2013;Chen et al. 2018;Ark 2020;Mirjalili and Lewis 2016;Lakshminarayana 2017, 2018;Hasanien 2018;Sun et al. 2018;Nasiri and Khiyabani 2018;Fu et al. 2017;Mafarja and Mirjalili 2017;Abdel-Basset et al. 2018;Jiang et al. 2018;Luan et al. 2019). Basir et al. (2018b) presented a bi-level improved genetic algorithm to solve the twostage assembly flow shop scheduling problem with batch delivery system. Peng et al. (2018) developed an improved artificial bee colony algorithm for a steelmaking casting process. Liao et al. (2012) introduced a particle swarm optimization algorithm for hybrid flow shops. Several meta-heuristics have also been developed for the permutation flow shop scheduling problem, such as a populationbased tabu search (Ark 2020), a hybrid whale algorithm (Abdel-Basset et al. 2018). For the distributed permutation flow shop scheduling problem, Gao et al. (2013) developed an efficient tabu search algorithm. In addition, the whale optimization algorithm (WOA), as an efficient swarm intelligent algorithm, has also been applied for many optimization problems (Fu et al. 2017;Mafarja and Mirjalili 2017;Abdel-Basset et al. 2018;Jiang et al. 2018;Luan et al. 2019).
Based on the above-discussed optimization problems and meta-heuristics, we develop a hybrid algorithm combining the wale optimization algorithm (WOA) with local search heuristics to solve the distributed flow shop scheduling problem with batch delivery constraints (DFSP-BD). The main contributions are as follows: (1) a hybrid algorithm combining the wale optimization algorithm (WOA) with local search heuristics is developed; (2) each solution is represented by two vectors, namely a job scheduling sequence vector, and a two-dimensional vector to record the factory assignment, and product assignment, respectively; (3) an efficient neighborhood structure is applied in the proposed algorithm to enhance search abilities; and (4) a simulated annealing algorithm and clustering method are embedded, to improve the global search abilities of the algorithm.
The remainder of this paper is organized as follows. Section 2 gives the problem description. Section 3 introduces the related algorithms. Section 4 describes the proposed algorithm with all of the components. The computational results and comparisons are reported in Sect. 5. Finally, the last section presents the concluding remarks and future research directions.

Problem description
The DFSP-BD is a typical realistic optimization problem, which combines DFSP and batch delivery to customer process. Therefore, two charging tasks should be solved, i.e., schedule jobs in the processing stage, and assign jobs in the batch delivery stage. Figure 1 shows a realistic example for the considered problem.
In processing stage, first, a set of jobs {J 1 , J 2 , J 3 …, J n } are randomly assigned to a set of factories {F 1 , F 2 , F 3 …, F f }. Then, at each factory, the assigned jobs will be processed through the same machine sequence. In the batch delivery stage, each job is assigned to a certain batch, where all the jobs in the same batch can be delivered to certain customers. The assumptions are described as follows: • All machines and jobs are ready at 0 time; • Each machine can process only one job at a time; • Each job can be processed at exactly one machine at a time; • Processing overlap is not permitted, i.e., all operations belonging to the same jobs should be processed one by one. • Each job should be assigned to exactly one batch.
• All jobs belonging to the same batch should be delivered at the same time. • Each job should be assigned to exactly one factory.

Problem formulation
The notations and decision variables are given in Table 1. Minimize:

Mk
Machine k in a DFSP Released jobs Fig. 1 Illustration of a realistic DFSP-BD problem The objective function (1) is to minimize the weighted sum of makespan and total energy consumption. Constraint (2) indicates that each job has a unique processing speed on each machine. Constraint (3) indicates that the processing speed of each product s on the machine is unique. Constraint (4) calculates the processing speed of each job on each machine. Constraint (5) calculates the processing speed of each batch on each machine. Constraints (6)-(10) restrict that two jobs belonging to the same factory should have a unique processing sequence relationship. The constraint (11) means that each factory allocates at least one job. Constraint (12) indicates that any job can only be assigned to one factory. Constraint (13) restricts that each factory has at least one job. Constraint (14) calculates the makespan of the first operation of each job. Constraint (15) indicates that there is no overlap between processes. Constraint (16) indicates that the processing between two adjacent jobs in each factory is not allowed to overlap. Constraint (17) calculates the makespan of each factory. Constraint (18) ensures that there is only one previous product (l) to be delivered just before each product s. Constraint (19) ensures that no more than one product (s) can be processed after each product. Constraint (20) checks that a product to be delivered cannot be both a predecessor and successor of another product to be delivered at the same time. Constraint (21) indicates that every product s will not start the batch delivery stage until all work on the last machine (M) has been completed. Constraint (22) restricts no overlap between the batches, determines that if the batch s is to be delivery immediately after the batch l, the operation of the batch l must end before the operation of the batch s begins. Constraint (23) limits the range of decision variables. Constraints (24-26) calculate the total energy consumption.

Problem illustration
Given a simple DFSP-BD problem, there are two factories, seven jobs, and two machines in each factory. All the jobs should be delivered to two customers with three batches. Table 2 gives the processing times and batch deliver times, and Fig. 2 shows the resulted Gantt chart for the example.
It can be seen from Fig. 2 that (1) four jobs including J 1 , J 3 , J 5 , and J 6 are processed in the first factory, while the following three jobs, i.e., J 2 , J 4 , and J 7 , have been assigned to the second factory; and (2) all the jobs belonging to the same batch should be assembled into a batch to deliver to the given customer. For example, J 1 and J 2 are assigned to batch 1 to dispatch to customer 1.

The canonical WOA
The WOA algorithm, proposed by Mirjalili and Lewis (2016), is inspired by the process of whales to prey food. In the canonical WOA, two typical procedures including bubbling and encircling are embedded to perform the searching tasks.

Framework of the canonical WOA
The framework of WOA is described in Algorithm 1.

Bubbling and encircling procedure
Whales swim around their prey and update the location of the search agent according to the best location of the search agent. Encircling the prey mechanism can be defined as follows: where t is the current iteration number, X Ã t is the current best solution, X t is the position vector, and K is a coefficient. D is a distance ranging between X Ã t and X t . A is randomly selected between ½Àa; a, and r is a random number from ½0; 1.
The whale attacks the prey by spiral upgrading way, and the process can be defined as follows: where D 0 is a distance value between X Ã t and X t , b is a constant to define the shape of the logarithmic spiral, l is a value range between ½À1; 1.
The probability of encircling the prey and spiral bubblenet attacking is 50%, respectively. The model is as follows:

Exploration phase
The exploration phase can be defined as: where X Ã rand is a random whale individual which is selected from the current population.

Solution representation
In DFSP-BD, we used three vectors to represent each solution, which is shown in Fig. 3. The first vector, named factory assignment vector, assigns each job to a certain factory. The second vector, named scheduling vector, arranges the processing order of the jobs in the assigned factory. The last vector assembles several different jobs into the given batch. As shown in Fig. 3, different colors represent different products. J 1 and J 2 belong to P 2 , J 3 and J 4 belong to P 1 , the rest of jobs belong to the P 3 . Four jobs, i.e., J 1 , J 3 , J 5 , and J 6 are processing in F 1 , and three jobs, i.e., J 2 , J 4 , and J 7 are processing in F 2 .

Neighborhood structures
To balance the global and local search abilities, four types of neighborhood structures are developed. The neighborhood structure is given in Algorithm 2.

Swap different products in a batch
This method aims to swap different products in a randomly selected batch. The detailed steps are as follows: (1) first, randomly select a batch and two products (e.g., P 5 and P 7 ); and (2) select better positions for the selected products with the minimum completion time. Figure 4 shows an example to swap two products in a selected batch (Fig. 5).

Swap different jobs in a factory
This method aims to swap different jobs in a randomly selected factory. The detailed steps are as follows: (1) select the factory with the maximum completion time as the critical factory; (2) and randomly select two jobs in the selected factory; and (3) swap the two selected jobs and update the current solution if the newly generated solution is better. Figure 6 shows the swap procedure of this approach.

Swap different jobs in different factories
This method aims to swap different jobs in different factories. The detailed steps are as follows: (1) randomly select two jobs from two different factories; and (2) swap the two selected jobs and update the current solution if the newly generated solution is better. Figure 7 shows the procedure of this approach.

Job insertion approach
The job insertion approach aims to delete jobs from the critical factory and insert them into other factories. The detailed steps are as follows: (1) firstly, select a factory with the maximum completion time as the critical factory; (2) secondly, insert all jobs of the critical factory into other factories; and (3) during the insertion of deleted jobs to other factories, the newly generated solutions are evaluated

K-means discretization exploitation phase
The K-means discretization method is an iterative clustering analysis algorithm, and it is applied to divide the population into several subpopulations. In exploitation phase, bubble-net attacking of the whale as a cluster of subpopulations, which can find locally optimal solution in each cluster . The main steps of K-means discretization method are as follows: Step 1.
Divide the data into K groups, and K center individuals are randomly selected as the initial clustering centers.
Step 2. Calculate the distance between each individual and each seed clustering center, and each individual is assigned to the nearest clustering center. Cluster centers and the individuals assigned to them represent a cluster. The distance is calcu- , where S i is a dimension of solution and C i is a dimension of center,D i is the distance between S i and C i .
Step 3. Each cluster center of the cluster will be recalculated according to the existing individuals in the cluster.
The above process will be repeated until a termination condition is met.

SA-based local search acceptance criterion
The SA-based acceptance criterion is embedded to enhance the global search abilities of the proposed algorithm. The detailed steps are given as follows: Step 1. Compared the values of the neighboring solution X n and the best solution found so far X best , if EðX n Þ \ EðX best Þ, replace X best with X n directly.
if EðX n Þ [ EðX best Þ, accept X n with probability of Pðx best ; x n ; TÞ ¼ e Eðx best ÞÀEðx n Þ=T , where T stands for temperature, which determines the probability of acceptance. The calculation process of T is shown in formula (36), and the parameter decreases continuously during the iteration.

Framework of the proposed algorithm
The framework of the proposed algorithm is described in Algorithm 3.

Effectiveness of CPLEX
For evaluating the performance of IWOA NS , the exact solver IBM ILOG CPLEX 12.7.1 is used to calculate the MIP model. The comparison experiment results are shown in Table 3. The first column is problem scale which contains the number of jobs, machines, and factories . The best value of each instance is illustrated in second column, the next two columns are minimum fitness value of IWOA NS and CPLEX, and the last two columns are percentage deviation difference obtained by each algorithm with respect to the corresponding optimal value, the calculation formula is given at (37): where f c represents the best solution generated by IWOA NS or CPLEX; f b represents the best solution between IWOA NS and CPLEX. From Table 3, it can be observed that (1) under six instances, IWOA NS obtains a higher solution quality, while CPLEX has worse performance; and (2) compared with the last row, the average of IWOA NS is less than CPLEX.

Sensitivity analysis
In this subsection, to analysis the sensitivity, we set two experiments: performance changes under different parameters and performance of the algorithm at different scales. Details are shown as follows.

Performance changes under different parameters
In this paper, there are two parameters, namely the temperature (T) and population group numbers (N). We set five levels of two parameters to obtain experimental data and analyze for a better group of parameters.
As shown in Table 4, the different values of the two parameters are combined. Thus, the influence of these two parameters on the performance of the algorithm is analyzed using DOE's Taguchi method. An orthogonal array L16 (42) is used to analyze the parameters at four-factor levels. Each parameter group is run independently 30 times to get the average value, which is the response variable (RV). The  RV for the 16 groups of parameters is listed in Table 4, and the parameters are analyzed by the line graph in Fig. 8. From Table 5 and line graph Fig. 8, when the parameter T is at the first level and N is at the first level, the result is the best, and the parameters T and N were set to 0.1 and 0.9, respectively.

Performance of the algorithm at different scales
In this section, in order to show clearly and directly the superiority of the IWOA NS in solving DFSP-BD, we construct experiments to compare the three algorithms on DFSP-BD.
To verify the performance of IWOA NS in solving DFSP with batch delivery constraints, the other two typical algorithms were compared with the IWOA NS : ABC algorithm (ABC-Y) was proposed by Yurtkuran in 2018; ICA algorithm (ICA-K) was proposed by Kazemi in 2017, respectively. The main reasons for selecting these compare algorithms are as follows: (1) For the IWOA NS algorithm, first, in the initialization part of the IWOA NS algorithm, neighborhood structures are proposed, and a local search strategy based on whale swarm optimization algorithm is used to enhance the local search abilities; then, the convergence of the algorithm is analyzed, and it is proved that the algorithm has convergence both locally and globally; (2) for the ICA-K algorithm, which include initialization, assimilation, revolution, and colony exchange phases. In ICA-K, one or more colonies of the weakest empires are generally moved to other empires through the empire competition mechanism, which has robust local search ability and faster convergence speed, but it is easier to fall into the local optimization than the WOA; (3) for the ABC-Y algorithm, it can find high-quality honey source with high efficiency in any environment and also can adapt to the change of environment, there are three main parts of the ABC-Y algorithm: the onlooker bee, the employed bee, and the scout bee, where the employed bees and onlookers are used to perform exploitation tasks and the scout bees are designed for performing exploration tasks.
The results are recorded in Table 6 which show that the performance of all three contrast algorithms on scale 20 is far superior to other scales. Moreover, except for the scale 20, the algorithm outperforms the other comparative algorithms on any other scale.

Effectiveness of neighborhood structures
To test the efficiency of the IWOA with local search strategy (IWOA NS ), we compared IWOA NS and the IWOA without local search strategy (IWOA) in Table 7. Through two algorithms, 30 instances are run independently for 30 times, and the maximum, minimum, and average values are obtained and then obtained the best value and the dev.
As shown in Table 6, the first column is problem scale which contains the number of jobs, machines, and factories. The best value of each instance is presented in second column, the next two columns are minimum fitness value of two algorithms, and the last two columns are the values of percentage deviation obtained by each algorithm with respect to the corresponding optimal value, the calculation formula is given at (37).
It can be seen from Table 6: (1) for 30 instances, IWOA NS have 30 best solutions, while IWOA only have three best solutions; and (2) compared with the last row, the average of IWOA NS is far less than IWOA.  To verify the performance with compared IWOA, an ANOVA chart is generated. Figure 9 presents compared result with dev values of the two compared algorithms. The average dev value of 30 instances is calculated. Under the 95% confidence interval, if p value \ 0.05, the performance of the algorithm is significantly better than other algorithms, according to the multi-factor analysis of variance (ANOVA) theory. Through Fig. 6, it can be seen that the p value is 2.20022e-17 which is far less than 0.05, showing the proposed algorithm has better performance.

Comparisons with other efficient algorithms
The experimental results are shown in Table 8. The first column represents the scale of 30 instances. The second column is the optimal value of each example run; the next three columns give the best solution of each algorithm after 30 independent experiments. The last three columns are the deviations calculated by each algorithm. It can be seen from Table 8 that (1) Among the 30 instances, the IWOA NS algorithm has 28 optimal solution, while the ABC-Y algorithm has only eight optimal solutions and the ICA-K algorithm has only one optimal solution. (2) Compared The bold solution is the best solution The bold solution is the best solution In order to further prove the superiority of the IWOA NS , Fig. 10 illustrates the compared result of ABC-Y algorithm and IWOA NS . From the p value = 1.07668e-06 which is far less than 0.05, showing the proposed algorithm has better performance.
Four instances were randomly selected to further analyze the performance of IWOA NS and ICA-K. And the convergence curve is drawn based on the experimental data as shown in Fig. 11. The results show that IWOA NS is far superior to ICA-K. As shown in these convergence curves, the IWOA NS shows better convergence abilities for the considered DFSP with batch delivery constraint. The bold solution is the best solution As shown in Fig. 12, the Gantt chart contains two customers and four batches and has 20 jobs, eight machines, five factories. Each rectangle corresponds to a job, and the color represents different batches.

Conclusion
In this study, a distributed flow shop scheduling problem with batch delivery constraint is solved. The problem can be applied to the field of garment processing. The processed products are delivered to customers in batches according to customer needs. One-stop service not only shortens the time of garment processing, but also improves the efficiency. To solve this problem, a whale swarm optimization algorithm is employed. Moreover, the algorithm can be used in a wide range of fields, such as distributed scheduling, flexible job shop, distribution network, and power systems. In this research, a wale optimization algorithm (IWOA) combined with neighborhood structure is utilized to solve the problem. Then, the local search strategy is applied in the proposed algorithm to enhance search ability. Furthermore, the SA and clustering method are embedded, to improve the performance of the algorithm. Finally, comparing algorithms with ABC-Y and ICA-K, IWOA NS has the best performance.
In the future, next works are mainly developed as follows: (1) considering distribute flow shop problem with fuzzy constraint; (2) studying more accurate energy consumption in batch delivery; (3) combining the proposed algorithm with other kinds of problems, such as the parallel machine scheduling problem; and (4) proposing better optimization algorithms or more strategies to solve the current problem.