An Improved Sparrow Search Algorithm for Solving the Energy-Saving Flexible Job Shop Scheduling Problem

: Due to emerging requirements and pressures related to environmental protection, manufacturing enterprises have expressed growing concern for adopting various energy-saving strategies. However, environmental criteria were usually not considered in traditional production scheduling problems. To overcome this deficiency, energy-saving scheduling has drawn more and more attention from academic scholars and industrial practitioners. In this paper, an energy-saving flexible job shop scheduling problem (EFJSP) is introduced in accordance with the criterion of optimizing power consumption and processing costs simultaneously. Since the classical FJSP is strongly NP-hard, an Improved Sparrow Search Algorithm (ISSA) is developed for efficiently solving the EFJSP. In the ISSA, a Hybrid Search (HS) method is used to produce an initial high-quality population; a Quantum Rotation Gate (QRG) and a Sine – Cosine Algorithm (SCA) are integrated to intensify the ability of the ISSA to coordinate exploration and exploitation; the adaptive adjustment strategy and Variable Neighborhood Search (VNS) are applied to strengthen diversification of the ISSA to move away from local optima. Extensive computational experiments validate that the ISSA out-performs other existing algorithms in solving the EFJSP due to the advantages of intensification and diversification mechanisms in the ISSA.


Introduction
With the promotion of Industry 4.0, innovation and transformation of the traditional manufacturing enterprise are rapidly developing. Against this background, a new and smart machining mode is being generated [1]. Artificial intelligence and machine learning methods have been introduced into the manufacturing industry to simulate the actual production environment [2]. Manufacturing workshops in various industries tend to be digital and intelligent. In the meantime, with the rapid growth of modern economy and the increasing awareness of environmental protection, manufacturing companies are facing both economic and environmental pressures. Reducing energy consumption is an essential objective for companies due to the requirements of sustainable development. To realize this environmental objective, some researchers proposed the straight method by designing more energy-saving machines for manufacturing procedures [3]. However, compared with the method of designing energy-saving machines, companies can effectively optimize the use of manufacturing resources through production scheduling optimization, so that energy consumption can be saved, and production efficiency can be achieved. Recently, scholars have paid more attention to production scheduling problems with the criterion of optimizing power consumption cost. Energy-saving scheduling has become a new research hotspot in the manufacturing industry and the scheduling community.
The following recent literature review on energy-saving scheduling is presented as follows. In 2012, Duflou et al. [4] applied the concept of energy saving to production scheduling procedures and established a scheduling model with two criteria, i.e., the makespan and the power consumption cost. Carli et al. [5] proposed a two-step scheduling model with the objective of the total cost to obtain a best solution for the material handling activities of electric mobile material handling equipment (MHE). Zhang et al. [6] declared a heuristic evolutionary algorithm for the uncorrelated concurrent machine scheduling problem. Ahmadi et al. [7] employed two types of algorithms, the non-dominated sorting genetic algorithm II (NSGA-II) with elite policies and the modified nondominated sorting genetic algorithm (NSGA), for the job shop problem (JSP). Miguel et al. [8] pronounced an enhanced genetic algorithm (GA) for the JSP where machines can process jobs at speed scaling. Li et al. [9] used an enhanced artificial bee colony (ABC) algorithm for the JSP with three criteria, i.e., the makespan, the carbon emissions, and the total machine load. Zhang et al. [10] proposed an enhanced shuffled frog-leaping algorithm for an energy-aware FJSP with two objectives of minimizing the total power consumption and the makespan. Shahrabi et al. [11] employed a Q-learning algorithm to search the optimal parameters of a variable neighborhood search (VNS) algorithm in dynamic job shop scheduling. Yang et al. [12] developed a novel hybrid whale optimization algorithm for the Flexible Job Shop Problem (FJSP) to optimize the makespan. Wu et al. [13] constructed an energy-aware FJSP model and proposed an improved NSGA for it. Zhu et al. [14] adopted a strengthened whale optimization algorithm for solving the JSP. Anuar et al. [15] solved the FJSP with the dual criteria of makespan and power consumption by continuous and discrete particle swarm optimization (PSO) algorithms. Ding et al. [16] constructed an energy-saving scheduling problem model for the permutation flow shop. Yang et al. [17] designed a hybrid memetic algorithm (MA) with decomposition variable neighborhood for the FJSP with two criteria of minimizing the makespan and the total workload. Dai et al. [18] developed a strengthened GA to optimize the energy consumption and makespan for the FJSP with transportation constraints. Tan et al. [19] devised a modified NSGA-II for the FJSP with double resource constraints. Lu et al. [20] presented a novel multi-objective discrete virus optimization algorithm (MODVOA) for the FJSP with the dual objectives of makespan and total additional resource consumption. Carli et al. [21] introduced a model to achieve the best control scheme for the battery charging of the MHE in warehouses. Yin et al. [22] constructed a novel low-carbon FJSP model and proposed a multi-objective GA based on a simplex lattice. In summary, most studies on energy-saving scheduling have focused on single-machine-unit job shop systems. By comparison, little research has been devoted to investigating the energy-saving flexible job shop scheduling problem (EFJSP), which is our research problem in this paper. To fill this research gap, we investigated the EFJSP from the perspective of energy-saving constraints and environmental criteria.
In recent years, several researchers have designed a variety of artificial intelligence algorithms for solving different combinatorial optimization problems [23][24][25][26][27][28][29][30][31][32][33][34][35]. The Sparrow Search Algorithm (SSA) is a novel metaheuristic algorithm that imitates the life behaviors of sparrow populations in nature [36]. Since its introduction in 2020, the SSA has become a popular research topic by scholars in various research areas. Zhang et al. [37] developed a chaotic SSA for the stochastic configuration network. Ouyang et al. [38] presented an improved SSA (ISSA), which clusters and distinguishes individual positions of sparrows using the K-means clustering method to accelerate the updating effectiveness of the population and get rid of random effects. Zhang et al. [39] developed an ISSA for the classification problem of labeled and unlabeled data. Liu et al. [40] proposed an ISSA for solving the route selection problem. Yuan et al. [41] provided an ISSA to solve the ability mismatch loss problem in photovoltaic microgrid systems. Zhang et al. [42] introduced a discrete SSA to solve the traveling salesman problem (TSP).
Based on the above recent literature review, research gaps have been identified, and the main contributions are highlighted in the following.

▪
It is rare to find relevant papers on the FJSP with the consideration of energy-saving constraints and the optimization criterion of minimizing the total power consumption cost. With energy-saving concerns, this study aims to fill in this research gap by defining, modelling, and solving the EFJSP. ▪ To efficiently solve the EFJSP, we developed an improved sparrow search algorithm (ISSA) that consists of the hybrid search (HS), quantum rotation gate (QRG), sinecosine algorithm (SCA), adaptive adjustment strategy (AAS), and variable neighborhood search (VNS) techniques. ▪ The advantages of the developed ISSA are verified by extensive computational experiments on benchmark and practical instances. ▪ The purpose of this paper is to increase knowledge reserves in the field of energysaving scheduling in theory and to help manufacturing enterprises reduce energy consumption and processing costs in practice.
The organization of the remainder of this paper is as follows: Section 2 presents the definition of the EFJSP. Section 3 describes the traditional SSA. Section 4 develops the ISSA for the EFJSP. Section 5 reports the computational results of the ISSA, and Section 6 gives the conclusion and future research directions.

Problem Description
The EFJSP is stated as follows. There are a group of n jobs and a group of m machines, where i J denotes the number of operations contained in job i , and ij O denotes the jth operation of job i . Each operation ij O can be processed on one machine in a given set of m machines. The EFJSP can be divided into two subproblems: machine allocation and operation sequence. The common optimization objectives for FJSP are to minimize the makespan, total flow time, total tardiness, etc. In this study, the EFJSP aims at optimizing total power consumption while minimizing common objectives simultaneously. The objective of the EFJSP is to optimize the total cost, which is composed of two components: processing cost and energy consumption cost. Moreover, the energy consumption cost includes three parts: power consumption cost in processing mode, energy consumption cost in idle mode, and power consumption cost in transportation of jobs. The following additional constraints are also considered: (1) One machine can deal with only one operation at a time.
(2) One operation must be machined continuously, as it cannot be interrupted midway.
(3) There are sequential constraints among the operations of the same job, as it can start only after the previous one is completed. (4) Different operations of all jobs are independent. (5) There is no interruption when the machine is available. (6) The preparation of the machine before processing, loading, and unloading of the job is ignored. (7) Machine failure and other emergencies are not considered.

Model Illustration
Sets and indices, parameters, and decision variables of EFJSP are defined as follows: Sets and Indices: Accordingly, the objective function of the EFJSP is established as follows: To explain the EFJSP visually, a numerical instance is given in Table 1. There are three jobs M is 7 min and 8 min, respectively, and the corresponding total energy consumption cost is CNY 12 and CNY 18, respectively. After an operation of the job is completed on a machine, it will be transferred to another machine to process the next operation. The transferred time of the job from one machine to another is shown in Table 2. Figure 1 shows an example of calculating the energy consumption cost of a machine on standby mode, e.g., when machine Therefore, the energy consumption cost of a machine on standby mode can be obtained by multiplying the PCCC on standby mode by the idle time.  Table 2. Transferred times between machines (unit: min).

Machine Tool Number
The Gantt chart of the instance mentioned in Table 1.

Sparrow Search Algorithm (SSA)
The SSA is a relatively new metaheuristic algorithm that mimics the predation and anti-predatory action of sparrow populations [36]. Specifically, in foraging, individuals act in two roles: discoverer and joiner. The discoverer is in charge of finding the food and guiding other individuals, and the joiner forages by following the discoverer. A certain percentage of sparrows have been selected as the guarders, which will send out alarm signals and perform anti-predation behaviors when they realize the danger. The position of the discoverer is regenerated by Equation (2): where t denotes the current value of updates. T is the maximal value of updates.
defines the updated location of the ith O is a random parameter. The position of the joiner can be regenerated by Equation (3): where b X denotes the current optimal location of the discoverer.
The location regeneration equation for the guarder is determined by Equation (4) where best X defines the global best position of the agent.  and are two random numbers; i ft represents the fitness value of the agent. w ft and g ft stand for the current worst fitness value and the best fitness value in the population, respectively;  is a minimum number that is close to zero.

Scheduling Scheme Denotation
The EFJSP includes two sub-problems, i.e., machine selection and operation sequence. In consequence, a two-segment code is employed to present the Scheduling Scheme (SS). The first segment selects a suitable machine for every operation, and the second one indicates the machining sequence of jobs.
Taking a 32  (three jobs with six operations and two machines) EFJSP for a numerical example, the SS denotation can be illustrated in Figure 2. For the first part, the notation w represents an operation that selects the wth one in the optional machine set, in which all data are saved in sequence. For the second part, the elements v represent different operations of job v .

Individual Position Vector
In the developed ISSA, the location of the sparrow is represented by a real vector, which consists of two parts, i.e., permutation. For the 3×2 EFJSP in Figure 2, the IPV is illustrated in Figure 3. In addition, the ranges

Transition Mechanism
The traditional SSA was designed for the successional optimization problem. However, the EFJSP is a discrete combinatorial optimization problem. Thus, it is vital to create a transition mechanism between the IPV and the SS. In this paper, the transition method by Yuan et al. [43] is employed here to achieve the transition between the IPV and the SS for the EFJSP.  (1) Machine selection segment: the transition procedure is shown in Equation (5).
where () yi represents the ith data of the IPV. () ri defines the number of machines that can be selected for the corresponding operation of the ith element.
(2) Operation sequence segment: firstly, the real numbers (detonated by u ) are randomly produced between for the SS. Based on the ranked-order-value (ROV) rule, we can allocate one unique ROV datapoint for each real number produced before in an ascending sequence; hence, the ROV datapoint can map to one operation. Then, the ROV datapoint is re-ordered on the basis of the sequence of the operations, and the real number is also re-ordered according to the re-ordered ROV datapoint, which is the data value in the IPV. The transition procedure can be described as  ( ) (2) Operation sequence part: We assign an ROV datapoint to each element of the IPV in ascending order. Then, the ROV datapoint is used as the fixed position number. Finally, the operation permutation can be achieved by matching the ROV datapoint to the operations. The conversion process is described in Figure 5 as follows:

Population Initialization
The performance of the original swarm has an enormous influence on the optimization result of the metaheuristics algorithm. Therefore, we can use certain strategies to improve the original swarm, which can enhance the algorithm's capability. Since this paper uses a two-segment coding mechanism, the swarm initialization will be executed for the machine selection segment and the operation sequence segment separately. Firstly, the machine selection segment in the original swarm is produced by adopting an HS method [44]. Secondly, some operation sequence schemes are randomly produced for each machine selection segment and combined with it, in turn, to produce some scheduling scheme. Finally, the original swarm can be gained by selecting the optimal scheduling scheme each time.

Dynamic Weights and Quantum Rotation Gate
Quantum rotating for a microscopic particle can increase the diversity of its own position. The discoverers are the dominant group in the population, so executing the quantum rotating operation with the single encoding can strengthen the diversity of the swarm. To further improve the effectiveness of the ISSA, dynamic weight is also introduced simultaneously. The improved discoverer's location updating formula is described as Equation (7).
where t i X declares the current position of the sparrow. p X indicates the current optimal position gained by the discoverer.
where q is a random value in (0,1]. max  indicates the maximal value of  (e.g., the value is set as 0.9 in this paper). min  represents the minimum value of  (e.g., the value is set as 0.4 in this paper).

Sine-Cosine Algorithm
The moving of joiners towards the optimal position occupied by the discoverers often leads to gathering of individuals, which leads the SSA to run into a local optimum. The sine-cosine algorithm (SCA) has oscillatory properties. If we replace the original search mechanism of the joiner with the SCA, it can reduce the search blind spots in the solution space. The enhanced position updating method can be described in Equation (9). sin( ) 0.5 where p X indicates the current optimal location obtained by the discoverer; a defines a constant number and 2 a = ;

Adaptive Adjustment Strategy
Like other metaheuristic algorithms, coordination among the capacities of exploitation and exploration is significant for the capability of the SSA. Therefore, the adaptive adjustment strategy for the discoverer-joiner is introduced [45]. In the early stage of iterations, the discoverer occupies the majority. With the increase in iterations, the number of discoverers decreases adaptively while the number of joiners increases adaptively, which progressively transforms the algorithm from exploitation to exploration so that the quality of the scheme obtained can be strengthened. The specific formula is as follows: (11) pNum r N = (12) (1 ) sNum r N = −  (13) where pNum defines the number of discoverers, and sNum presents the number of joiners; b defines a scale factor to control the number of discoverers and joiners;  is the perturbation deviation factor to perturb r , which follows a nonlinear decrease.

Variable Neighborhood Search
In the stage of exploration, the sparrows regenerate their locations guided by p X , which decides the precision of the solution obtained by the SSA to a certain extent. In this case, the VNS is employed to strengthen the capability of the current best scheduling scheme p W , which correspond to p X . Meanwhile, an "Iterative Counter (IC)" is set for p W , which is equal to 0 at the initial time. If the fitness value of p W remains unchanged after iteration, the IC will be increased by 1; otherwise, it will remain unchanged. When the IC reaches the stability threshold  (e.g., the value is set as 15 in this study), the individual has reached a steady state, and the VNS is executed on it. Three neighborhood structures used in this paper are designed as follows: For the neighborhood structure The VNS performed on p W in this paper is the threshold acceptance method, which can be shown as follows: Step Step 2. If 1 Step 3. If Step 4. Set 1 W as ' W , and go to Step 5; if not, return to Step 2.

Parameters of the ISSA
The relevant parameters of the ISSA include: the population size N , the safety threshold value ST , the scale factor b , the perturbation deviation factor  , the dynamic weight  , the maximum iterations max t . The parametrization of the ISSA is performed as follows: ST is used to select different formulas to update the discoverer in Equation (7); the value of ST is set as 0.8 in this study.
 is used to perturb the nonlinear decreasing value r ; the value of  is set as 0.1 in this study.
b is used to adjust the number of discoverers and joiners; the value of b is set as 0.2 in this study.
 is used to update the individuals in the discoverer subpopulation to improve the effectiveness of the ISSA. N is used to control the size of the search space.

Procedure of the ISSA
In the following, the main procedure of the developed ISSA is presented with the illustration by a flow chart in Figure 6.
Step 1. Set parameters and produce the original swarm by using the HS.
Step 2. Determine the objective function values of all scheduling schemes, and then search the optimal and worst schemes.
Step 3. Determine whether the optimal scheduling scheme is in a steady state; if so, execute the VSN on it; otherwise, go to Step 5.
Step 4. Perform the conversion from scheduling scheme to IPV, and retain p X corresponding to p W and the worst individual position vector worst X corresponding to the worst scheduling scheme worst W .
Step 6. Adjust the number of discoverers and joiners using the adaptive adjustment strategy.
Step 7. A conversion mechanism is used to convert the updated IPV in the population to the scheduling scheme; then, find the optimal scheduling scheme.

R2<ST
Update the discoverer position in the light of the first part of Equation (7) Update the discoverer position in the light of the second part of Equation (7) z4<0.5 Update the joiner position according to the first part of Equation (9) Update the joiner position according to the second part of Equation (

Experimental Settings
The ISSA was implemented in MATLAB 2017b and tested on a workstation, which had a configuration of 2.40 GHz, Intel Core i5-6200 CPU, 8G RAM, and Windows 10 operating system. In the experiments, 19 FJSP instances (10 Brandimarte instances, 4 Kacem instances, and 5 random instances) were adopted to test the validity and feasibility of the ISSA. For each instance, 10 independent runs were adopted. The processing cost per unit time on all machines was 50 RMB/min. The transfer time was produced in a uniform distribution on (5,15); the unit was min. The transferred PCCC was produced in a uniform distribution on (5, 10); the unit was kw/min. In both the benchmark and random instances, the PCCC for all machines on the processing and idle mode were randomly produced within (0, 1). For the random instances, the processing times of all operations were produced in a discrete uniform distribution on [0, 100], and the machining order of all operations was also randomly produced. In the ISSA, the swarm scale was 200, and the maximal iteration was 1200; the safety value was 0.8; the scale factor was 0.2; the perturbation deviation factor was 0.1; the initial number of the guarder was 20.

Effectiveness of Enhancement Strategies
In this study, we used the HS to yield the original swarm. Then, the QRG and SCA were employed to enhance the capacity of the ISSA for balancing the capacities of exploration and exploitation. Thirdly, the AAS and VNS were adopted to strengthen the capacity of the SSA to move away from the local optima. In this section, the validity of three strategies is examined. In Table 3, the case name is placed in the first column, and the experiment data are placed in the latter column. "SSA" defines the traditional sparrow search algorithm. "SSA-L" denotes the SSA that adopt the HS method to produce the original population. "SSA-N" denotes the algorithm that introduces the QRG, SCA, and AAS to the SSA-L. "ISSA" is the algorithm that adds the VNS to the SSA-N. Additionally, "Best" defines the optimal result in 10 runs. "Avg" is the mean value of the results in the 10 runs, and the boldface indicates the optimal result achieved by four algorithm variants. To enhance the comparison, the above algorithm variants were set to the same parameters.
As shown in Table 3, we can draw the following conclusions: (1) In the comparison of "Best" value, the ISSA obtained nine optimal values, which is obviously excellent versus the other three variants. The second optimal algorithm, namely SSA-N, obtained eight of the best results. (2) In the comparison of "Avg" values, the ISSA obtained 15 of the best results, which is better than the other three algorithms. The second optimal algorithm, namely SSA-N, only obtained three optimal values. Moreover, the average values obtained by the four algorithms are summarized in Table 3 and comparatively analyzed in Figure 7.

Comparison with Existing Algorithms
To certify the capability of the ISSA, we conducted a comparative study with three other metaheuristic algorithms, namely, the genetic algorithm (GA), the capuchin monkey algorithm (CapSA), and the whale optimization algorithm, with the original population generated randomly (RWOA). In addition, "SD" defines the standard deviation of the data gained in 10 replications, and "ARPD" denotes the average relative percent deviation, i.e.: Min L (14) where "L" is the quantity of replications, "Min" is the minimum value of all performed replications, and " r Aol " is the objective value gained by the algorithm in the rth run. In the GA, the scale of the swarm was 200, the maximal number of iterations was 1200, the crossover probability was 0.8, and the variation probability was 0.6. In the CapSA, the swarm scale was 200, and the maximal number of iterations was 1200. In the RWOA, the swarm scale was 200, the maximal number of iterations was 1200, the spiral constant was 1, and each instance performed 10 independent replications. The results are concluded and analyzed in Table 4 Table 4 and then compared in Figure 8. Figure 9 displays the convergence curve of the four algorithms for the RAND4 instance, with the size of 10 machines and 10 jobs. The Gantt chart for the RAND4 instance obtained by the ISSA is illustrated in Figure 10. The analysis indicates that the ISSA can find the best schedule among the four algorithms.    To examine the objective function values of the four compared algorithms in Table 4, an analysis of variance (ANOVA) test was implemented in Table 5. It is observed from Table 5 that p-value is equal to zero, implying a marked difference among the four algorithms in Table 4.

Conclusions
In this study, an improved sparrow search algorithm (ISSA) was developed for the EFJSP, which aims to optimize the total power consumption and processing cost. In the design of the ISSA, an HS was employed to produce an original swarm with high quality. Then, SCA and QRG were adopted to strengthen the capacity of the ISSA for coordinating exploration and exploitation. Moreover, the AAS and VNS were applied to reinforce the capacity of the ISSA to avoid trapping from local optima.
Numerous experiments were executed to test the capability of the ISSA. Computational results demonstrated that the improvement techniques were effective for enhancing solution accuracy. Furthermore, the proposed EFJSP methodology contributes to improving the theoretical foundation in the field of energy-saving scheduling and to helping manufacturing enterprises reduce energy consumption and processing costs in practice.
Regarding future research directions, energy-saving scheduling will be further investigated by considering more practical energy consumption modes, e.g., different energy consumption costs in sequence-dependent equipment relocation and setup applied to the mining industry [46]. For the ISSA, some discretization enhancement strategies will be adapted to solve the online EFJSP [47]. Finally, it would be a promising research topic to develop the ISSA for solving industry-oriented scheduling problems with the consideration of inter-machine storage, such as blocking, no-wait, and limited-buffer constraints [48][49][50][51][52][53][54].

Data Availability Statement:
The data presented in this study are available on request from the first or corresponding author.

Conflicts of Interest:
The authors claim no conflicts of interest.