A Study on the Optimal Flexible Job-Shop Scheduling with Sequence-Dependent Setup Time Based on a Hybrid Algorithm of Improved Quantum Cat Swarm Optimization

: Multi-item and small-lot-size production modes lead to frequent setup, which involves signiﬁcant setup times and has a substantial impact on productivity. In this study, we investigated the optimal ﬂexible job-shop scheduling problem with a sequence-dependent setup time. We built a mathematical model with the optimal objective of minimization of the maximum completion time (makespan). Considering the process sequence, which is inﬂuenced by setup time, processing time, and machine load limitations, ﬁrst, processing machinery is chosen based on machine load and processing time, and then processing tasks are scheduled based on setup time and processing time. An improved quantum cat swarm optimization (QCSO) algorithm is proposed to solve the problem, a quantum coding method is introduced, the quantum bit (Q-bit) and cat swarm algorithm (CSO) are combined, and the cats are iteratively updated by quantum rotation angle position; then, the dynamic mixture ratio (MR) value is selected according to the number of algorithm iterations. The use of this method expands our understanding of space and increases operation efﬁciency and speed. Finally, the improved QCSO algorithm and parallel genetic algorithm (PGA) are compared through simulation experiments. The results show that the improved QCSO algorithm has better results, and the robustness of the algorithm is improved.


Introduction
Since 1990, the flexible job-shop scheduling problem (FJSP) has attracted attention due to its wide application and high complexity. In the last decades, fruitful results have been reported concerning the FJSP. To narrow the gap between the problem and practical manufacturing, the general FJSP was extended by considering some additional practical factors. In those extended FJSP problems, setup time is a commonly considered factor. In many real-life manufacturing systems, the setup operations, such as cleaning up or changing tools, are not only often required between jobs but also strongly depend on the immediately preceding process on the same machine. This motivates researchers to study the FJSP with sequence-dependent setup time (SDST). It is well known that the general FJSP has been proven to be an NP-hard problem. As an extended problem, SDST is obviously more complex than the general FJSP. Therefore, efficient methods are needed to acquire satisfactory solutions that are of high quality in a reasonable computational time. Considering that exact methods are too intractable to solve the problem, heuristic algorithms have received extensive attention from scholars. A summary of research optimization algorithms on FJSP-SDST is presented in Table 1. With regard to the previous work, various heuristic algorithms have been adopted, but no heuristic can perform best for all types of SDST problems or all instances of the same problem, which is in accordance with the "no free lunch" theorem [1]. This is also the main motivation behind presenting a fresh heuristic algorithm for the considered SDST problem. Table 1. Summary of research optimization algorithms on FJSP-SDST.

Literature Objective Function Algorithms
Mousakhani [2] Minimize total tardiness Iterated local search Shen et al. [3] Minimize makespan Tabu search with specific neighborhood search function Bagheri and Zandieh [4] Minimize makespan and mean tardiness Variable neighborhood search Abdelmaguid [5] Minimize makespan Tabu search with specific neighborhood functions Naderi et al. [6] Minimize makespan Genetic algorithm Li and Lei [7] Minimize makespan, total tardiness, and total energy consumption Imperialist competitive algorithm with feedback Defersha and Chen [8] Minimize makespan Parallel genetic algorithm Azzouz et al. [9] Minimize makespan and bi-criteria objective function Hybrid genetic algorithm and variable neighborhood search Wang and Zhu [10] Minimize makespan Hybrid genetic algorithm and tabu search Li et al. [11] Minimize makespan and total setup costs Elitist nondominated sorting hybrid algorithm Azzouz et al. [12] Minimize makespan Hybrid genetic algorithm and iterated local search Azzouz et al. [13] Minimize makespan Adaptive genetic algorithm Abderrabi et al. [14] Minimize total flow time Genetic algorithm and iterated local search Parjapati and Ajai [15] Minimize makespan Genetic algorithm Sadrzadeh [16] Minimize makespan and mean tardiness Artificial immune system and particle swarm optimization Tayebi Araghi et al. [17] Minimize makespan Genetic variable neighborhood search with affinity function Sun et al. [18] Minimize makespan, total workload, workload of critical machine, and penalties of earliness/tardiness Hybrid many-objective evolutionary algorithm Li et al. [19] Minimize energy consumption and makespan Improved Jaya algorithm Müller et al. [20] Minimize makespan Decision trees and deep neural networks Wei et al. [21] Minimize the makespan and total energy consumption Energy-aware estimation model Li et al. [22] Minimize the makespan and the total workload Hybrid self-adaptive multi-objective evolutionary algorithm Türkyılmaz et al. [23] Minimize makespan Hybrid Genetic Algorithm-hypervolume contribution measure Jiang et al. [24] Handle the issues of low production efficiency, high energy consumption and processing cost A novel improved crossover artificial bee colony algorithm Exploration and exploitation are treated as the most important features of heuristic algorithms. The trade-off between the two features is crucial to the computational performance. However, for many famous heuristics, some algorithms have a better global search ability, such as particle swarm optimization (PSO), ant colony optimization (ACO), the genetic algorithm (GA), and the whale optimization algorithm (WOA) [25], while others have a better local search ability, such as simulated annealing (SA), variable neighborhood search (VNS), the crow search algorithm (CSA) [26], and tabu search (TS). Compared to the mentioned algorithms, cat swarm optimization (CSO), a novel swarm intelligence algorithm proposed by Chu et al. [27], is inspired by the behavioral modes of cats in nature, specifically their seeking mode and tracing mode, corresponding to global search and local search in the algorithm. The main advantage of the CSO algorithm is that the local and global search can be performed simultaneously during the evolutionary process. This feature provides the chance to find a balance between exploration and exploitation by elaborately designing the algorithm. Since it was proposed, CSO has been successfully applied to various optimization problems [28][29][30][31][32][33][34][35][36][37]. However, to the best of our knowledge, it is seldom adopted for SDST. Therefore, the aim of this paper is to apply CSO to the FJSP-SDST. To enhance the search ability, the quantum computing principle is incorporated with the conventional CSO to form quantum cat swarm optimization (QCSO). In QCSO, some improvements are made, as follows: (1) Quantum encoding is employed to enhance the search ergodicity of the algorithm. (2) The individual positions of cats are updated by adjusting the quantum rotation angle to improve the search efficiency and speed of the algorithm. (3) A dynamic adjustment strategy for the mixture ratio of the two search modes (seeking and tracing) is adopted to maintain the balance between exploration and exploitation. Extensive experimental results demonstrate that the proposed QCSO is effective in solving the considered problem.
The remainder of this paper is structured as follows: Section 2 describes the presented problem. Section 3 presents the proposed QCSO algorithm. Section 4 describes the extensive experiments and analyzes the computational results. Section 5 provides the conclusions and future work.

Problem Assumption
In a workshop, n jobs {J 1 , J 2 , · · · , J n } need to be processed by m machines {M 1 , M 2 , · · · , M m }. Each job contains O i operations and its own processing route. O ij represents the jth operation of the ith job. Each operation O ij can be processed on any machine selected from a compatible machine set. The processing time of each operation is determined by the processing capacity of the assigned machine. The setup time of each machine depends on the two consecutive operations on it. In this study, we chose an eligible machine for each operation, then sequenced the operations on each machine in order to minimize the makespan, i.e., minC = min{maxC k |1 ≤ k ≤ m}, where C k represents the completion time of the last job on machine k. For this problem, the following assumptions help to simplify the problem: (1) Machines and jobs are available at time zero.
(2) There exist precedence constraints among different operations of the same job, i.e., each operation can only be processed after its predecessor is completed. (3) There are no precedence constraints among different jobs, i.e., jobs are independent of each other. (4) Preemption is not allowed, i.e., the processing of each operation must not be interrupted once it starts. (5) Each machine can only process one operation at a given time. (6) Job transportation and machine breakdown are not considered.

Description of Parameters and Variables
Some necessary parameters and variables are shown in Table 2.
Equation (1) gives the objective function aiming to minimize the makespan. Constraints (2) and (3) show that the operation o of job j is just the processing task on position r of machine k. Constraints (4) and (5) indicate that any operation must be assigned to only one machine. Constraint (6) shows that if operation o of job j is arranged on position r of machine k, then any successive operation o' of job j cannot be arranged on any earlier run r' of machine k for processing. Constraint Equation (7) is a symmetric constraint of Constraint Equation (6); in other words, it ensures that the precedence activity of the job has been processed.

Encoding Approach
To implement QCSO, the first task is to design an appropriate encoding approach. Here, the probability amplitude is used to represent the current position of each individual cat. This paper maintains a population of Q-bit individuals, Q(t) = q t 1 , q t 2 , · · · , q t N at generation t, where N is the size of the population and q t i is a Q-bit individual, defined as: where α t ij , β t ij T , (i = 1, 2, . . . , n × m) is a Q-bit that should satisfy the normalization gives the probability that the Q-bit will be found in the 0 state and β t ij 2 gives the probability that the Q-bit will be found in the 1 state. According to what is observed, Q(t) can collapse to binary string P(t) composed by 0 and 1. A random number r is generated from the range [0, 1]; if r > β t ij 2 , the bit of the binary string is set to 1. Thus, a binary string of length L is formed from the Q-bit individual. Meanwhile, every L binary string is converted to a decimal string in the range of 0 to n. Then, a decimal string of length n × o is formed. The decimal string is sorted from small to large to get the location, and its procedures are encoded.
For the FJSP with O procedures, n jobs, and m machines, the individual length of a quantum bit is defined as represents an integer that is not more than x.

Decoding Mechanism
This paper investigates the FJSP-SDST with the purpose of facilitating high achievement for all performance indices, such as the makespan of jobs, under the conditions of satisfying the process constraints, ensuring that the precedence activities of the job are completed, and minimizing the setup time of the work procedure of the same machine. The quantum individual is a linear superposition state of the solution through the probability amplitude, so the solution of the linear superposition state should be translated into a decimal solution through the decoding mechanism [38]. Because [log n 2 ] + 1 ≥ log n 2 , every [log n 2 ] + 1 binary string should be converted to a decimal number, and finally a decimal string of length m × n is formed. The decimal string is sorted in order from small to large to make sure that the relative position of each number is unchanged. The smallest numbers of m represent the first job, while the next smallest numbers represent the second job. In this way, we can get the decimal string based on the working procedure code.
Step 1: Set P(t) as a Q-bit individual: where t represents the generation of the qubit, and in order to increase the chance that each solution will be searched, α 0 i and β 0 Step 2: Generate a random number r from the range else let x i (t) = 0 (i = 1, 2, . . . , n). For every P(t), we can get a binary X(t) = x 1 , x 2 , · · · , x n of length n.
Step 3: In X(t), convert each [log n 2 ] + 1 binary string to a decimal string, to form a decimal string D(t) = (d 1 , d 2 , · · · , d m×n ) of length m × n.
Step 4: Let the numbers in D(t) be ordered from small to large; the smallest numbers of m represent the first job, the next smallest numbers represent the second job, and so on. The relative position of each number in D(t) is kept constant during the process. Thus, we can get a permutation W(t), by which each n job serial number is repeated m times. The number i that appears in W(t) for j times will represent operation j of job i. If there are two or more of the same numbers in D(t), then the smaller serial number represents the job that has the smaller process number.
The data processing of the 4 × 3 scale problem is shown in Table 3, and the specific decoding process is as follows: Table 3. Data processing of a 4 × 3 scale problem.

Seeking Mode
The seeking mode corresponds to a global search in the search space of the optimization problem. According to the value of MR, the individuals of the cat swarm in the search mode are determined first, and a global local search is carried out for each individual. The mutation operator is used to evaluate the fitness after the position exchange of its quantum coding. If it is better than the current solution, the current optimal solution is replaced. The steps involved in this mode are as follows: Step 1: Make j copies of the cat's current location c k and place them in the memory pool; the size of the memory pool is j, and j = SMP. If the value of SPC is true, then j = (SMP − 1), and leave the current position as a candidate solution.
Step 2: According to the value of CDC, each individual copy in the memory pool randomly increases or decreases SRD percent from the current value, and the original value is replaced.
Step 3: Calculate the fitness value (FS) of each candidate solution separately.
Step 4: Select the candidate point with the highest FS from the memory pool to replace the current cat's position and update the cat's position.
Step 5: Select a random position from the cat's candidate position to move, and replace the position c k .
If the target of the fitness function is the minimum value, then FS b = FS max , otherwise FS b = FS min .

Tracing Mode
The tracing mode corresponds to a local search in the optimization problem. In this mode, cats move to each dimension according to their own speed; individual cats approach the local optimal position, and their individual position is updated by comparing it with the optimal position of the group. The crossover operator is used for local search, and each individual cat is optimized by tracking its history and the local optimization of the current cat population. The crossover operator is as follows: Individual: α 1 , α 2 , . . . , |α i , . . . , α j |, . . . , α l Individual historical extremes: β 1 , β 2 , . . . , |β i , . . . , β j |, . . . , β l New individual after crossing: α 1 , α 2 , . . . , |β i , . . . , β j |, . . . , α l The steps of tracing mode can be described as follows: Step 1: Update the speed (v i , d ) of each dimension direction. The best position update that the entire cat group has experienced is the current optimal solution, and it is denoted as x best . The speed of each cat is denoted as v i = {v i1 , v i2 , . . . , v id }, and each cat updates its speed according to Equation (11): where x best,d is the position of the cat with the best fitness value; x i,d is the position of c k , c 1 is a constant, and r 1 is a random value in the range [0, 1]; v i,d is the updated speed of cat i in dimension d, and M is the dimension size; x best,d (t) represents the position of the cat with the best fitness value in the current swarm.
Step 2: Determine whether the speed is within the maximum range. To prevent the variation from being too large, a limit is added to the variation of each dimension, which also results in a blind random search of the solution space. SRD is given in advance; if the changed value of each dimension is beyond the limits of the SRD, set it to the given boundary value.
Step 3: Update location. Update the position of the cat according to Equation (12): In CSO, cats represent a feasible solution to the optimization problem to be solved. Some cats perform in seeking mode, and the rest follow in tracing mode. Two models interact through MR, and MR represents the number of cats in tracing mode as a proportion of the entire cat swarm. Most of the time, cats are resting and observing the environment, and the actual tracing and capturing time is quite short, so MR should be a smaller value in the program.

Updating Quantum Rotation Angle
As the executive mechanism of evolution operation, quantum gates can be selected according to specific issues. At present, there are many kinds of quantum gates. According to the calculation features of QCSO, the quantum rotation gate is used to update the cat swarm position in this paper. The adjusted operation of the quantum rotation gate is as follows: The update process is as follows: In tracing mode, the increment of qubit argument of cat P i is updated as follows: Let θ gj − θ ij ∈ [−π, π]; if the value is out of range, it should be plus or minus 2π. In seeking mode, random disturbance is achieved by small range fluctuation of qubit argument.
where c 1 and c 2 are two constants and r 1 is a random value in the range [0, 1]. Meanwhile, the standard CSO allocates fixed proportions of the entire cat swarm in searching and tracking mode. However, the requirements of global and local search in the evolutionary process of CSO are different, so it cannot effectively improve the search capability of the algorithm. In view of this problem, in this paper we propose a method related to the number of iterations to select the behavior mode of a cat swarm with variable iteration times: where n max is the maximum iterations and L is the current run time.
In order to improve the global search ability and the convergence rate, the algorithm uses a larger ratio of the seeking cat swarm in the early run period and a larger ratio of the tracing cat swarm in the later run period to improve the local search ability, which guarantees the convergence property of the algorithm.

Fitness Function
The optimization objective of this paper is to minimize the makespan. When the population is large, the elitist strategy could be used to select individuals for quantum crossover, and the optimization objective minimizes the makespan as the fitness function. Due to the large number of populations, the probability that the optimal individual and the worst individual will be selected is very high. To allow better individuals to have a larger probability of being selected, we create the fitness function: In Equation (18), M t (x) and M B (min) indicate the completion time of the current individual and the current minimum makespan in generation t. In other words, it is the current optimal solution.

Flowchart of QCSO
The flow of QCSO is as follows: 1 Initialize the population Q(t 0 ), and randomly create n chromosomes that encoded by qubit. 2 Decode chromosomes and convert qubit encoding to decimal. 3 Measure each individual in initial population Q(t 0 ), and get a definite solution P(t 0 ). 4 Evaluate the fitness value of each solution, and save the optimal individual and its corresponding fitness value. 5 According to the value of MR, determine the individual searching and tracking status of the cat group, and judge whether the calculation process can be over. If the end condition is satisfied, then exit; otherwise, continue to calculate. 6 Measure each individual in population Q(t), and get the corresponding definite solution. 7 Evaluate the fitness value of each definite solution. 8 Use the quantum rotation gate G(t) to update the individual position of the cat swarm, and get the new population Q(t + 1). 9 Save the optimal cat swarm, optimal individual, and corresponding fitness value; 10 Increase the number of iterations by 1, and return to step 5 . The flowchart of the quantum cat swarm optimization algorithm is shown in Figure 1.

Data Generation
This paper runs 2 × 4, 4 × 4, 4 × 6, 8 × 4, and 10 × 4 five-scale problems, in which every job has four procedures. For example, 8 × 4 indicates that there are eight kinds of jobs on four machines. The relevant data of the simulation analysis in this paper come from the literature [8], and each operation is processed on a different machine. Different processing times and setup times for the same machining tasks are scheduled on different machines, and the setup time matrix is asymmetric. Part of the data is shown in Tables 4-17.
There is an initial setup time on each machine, which also differed. In the data tables, J i refers to job I, O j refers to operation j, J ij refers to operation j of job i, and M i refers to the machine number.

Calculation Result
In this paper, Matlab R2010a software was used in a PC with CORE i3 M 380 CPU, the main frequency of the CPU was 2.53 GHz, and the RAM was 500 GB. The relevant parameters of QCSO used in this paper refer to the literature [8,25]. The operation parameters were as follows: population size p = 60, termination algebra T = 200, dynamic rotation angle ∆θ = 0.15π, 0.16π, 0.2π, and everyone was tested 20 times, SMP = 15, and MR varied randomly in the range [0.2, 0.8] according to the number of iterations of the algorithm. Further, c 1 = 2, r 1 is a random number in the range [0, 1]. The QCSO algorithm was compared to the parallel genetic algorithm (PGA) [8], and the comparison of calculation results included the following aspects: target minimum value (Min.sol), target average value (Avg.sol), target maximum value (Max.sol), times for optimal solution, average relative percentage error (RPE), and their standard deviation (SD). The percentage, which represents the absolute deviation of a measurement value to the mean value, is called RPE, and it is used to measure the deviation of a single measurement result from the mean value. SD is the square root of the sum of the squared deviation from the mean, and it is also the arithmetic square root of variance. It can reflect the discrete degree of the dataset, which is represented by σ. The smaller the value of σ, the better the stability of the algorithm. The formulas for RPE and σ are as follows: In Equation (19), C PGA max and C QCSO max indicate the optimization value of minimizing the makespan solved by PGA [8] and improved QCSO used in this paper.
In Equation (20), x i are real numbers, and µ is the arithmetic mean value of x i . QCSO and PGA are used to solve different scale problems, and they were all run 20 times. It can be seen in Table 18 that there is little difference in the optimization ability of the two algorithms when the scale of the problem is relatively small, but when the scale of the problem increases, the optimization ability of QCSO is obviously better than that of PGA. Although the average difference of the optimal solution is not very large, the SD contrast is obvious. For the 8 × 4 problem scale, σ calculated by QCSO is 62.48 and by PGA is 1103, and the difference is 53.55. For the 10 × 4 problem scale, σ calculated by QCSO is 91.81 and by PGA is 192.51, and the difference is 100.7. This illustrates that when the scale of the problem increases, QCSO is better than PGA. In addition, the results of running it 20 times show that with increased problem scale, QCSO searches for the optimal solution more times than PGA. For example, for the 6 × 4 problem scale, the ratio of times QCSO searched for the optimal solution is 80%, while the ratio for PGA is 70%. For the 8 × 4 problem scale, the ratio of times QCSO searched for optimal solution is 80%, but the ratio for PGA is 60%. For the 10 × 4 problem scale, the ratio of times QCSO searched for the optimal solution is 75%, while the ratio for PGA is 40%. All of this shows that the stability of QCSO is better. Twenty RPE values of different scale problems running results are shown in Table 19. The mean values of RPE for three kinds of scale problems are all positive, indicating that QCSO is significantly better than PGA, and QCSO is improved by about 2% on average. The analysis in this paper shows that the improved QCSO algorithm introduces quantum coding, which expands the ergodicity of the algorithm. By renewing the quantum rotation angle, the position of the cat swarm is iteratively updated, and the search efficiency and running speed of the algorithm are improved. MR, the number of cats that execute tracing mode, accounting for a proportion of the entire cat swarm, is set to a range of [0.2, 0.8] in this paper. It varies dynamically according to the change in iteration number of the algorithm, which improves its optimization capability.
The 6 × 4, 8 × 4, and 10 × 4 problem working sketches solved using QCSO and PGA are shown in Figures 2-4, respectively, and the number of iterations for all of them is 20. It is confirmed that the convergence speed and the stability of QCSO is better, especially for solving large-scale problems. Gantt charts of optimal solutions for the 6 × 4, 8 × 4, and 10 × 4 problems based on QCSO are shown in Figures 5-7, respectively; the numbers on the colored progress bars represent the procedure of the job. For example, in Figure 7, 101 on the first progress bar of the second line indicates that the first operation of the first job is arranged to be processed on machine 3. The space between the colored progress bars on each line is the setup time, and its size indicates the length of the setup time. The space in front of the job operation ranked first on each machine represents the initial setup time of that machine.

Conclusions
To improve production efficiency, reduce cost, and increase the flexible production of the job-shop, each operation of the same job can be processed on a different machine, and the processing and setup times of the same operation on the different machines are not the same. Different job sequences on the same machine result in different setup times, and because of the extremely low repetition rate of single-item and small-batch products, it is impossible to obtain setup times for different processing sequences. To shorten the setup times and improve the utilization rate of equipment and other resources, in this paper we examine a job-shop scheduling optimization scheme based on group technology. First, we cluster the job into groups according to the similarity of the required processing resources. Second, we select the processing machines according to the machine load and processing time. Finally, we schedule the procedures on the machines with the optimization objective of minimizing the completion time according to the setup and processing time. In this paper, we combine qubit and QCSO and propose the improved QCSO to solve the FJSP. We also introduce quantum coding, which extends the ergodicity of the algorithm. By renewing the quantum rotation angle, the position of the cat swarm is iteratively updated, and the operation efficiency and speed of the algorithm are improved. Dynamic MR values in the range of [0.2, 0.8] are used in this paper, which vary randomly according to the number of iterations of the algorithm. Finally, the operation results of the improved QCSO and PGA are compared through simulation experiments [8], and the minimum, average, and maximum values of the objective function, relative percentage deviation, and standard deviation are compared. The results show that the improved QCSO has better optimization results and robustness, and these results confirm the feasibility and validity of the method used in this paper.