*Article* **Hybrid Genetic and Spotted Hyena Optimizer for Flow Shop Scheduling Problem**

**Toufik Mzili 1,\*, Ilyass Mzili 2, Mohammed Essaid Riffi <sup>1</sup> and Gaurav Dhiman 3,4,5,6,7,8**


**Abstract:** This paper presents a new hybrid algorithm that combines genetic algorithms (GAs) and the optimizing spotted hyena algorithm (SHOA) to solve the production shop scheduling problem. The proposed GA-SHOA algorithm incorporates genetic operators, such as uniform crossover and mutation, into the SHOA algorithm to improve its performance. We evaluated the algorithm on a set of OR library instances and compared it to other state-of-the-art optimization algorithms, including SSO, SCE-OBL, CLS-BFO and ACGA. The experimental results show that the GA-SHOA algorithm consistently finds optimal or near-optimal solutions for all tested instances, outperforming the other algorithms. Our paper contributes to the field in several ways. First, we propose a hybrid algorithm that effectively combines the exploration and exploitation capabilities of SHO and GA, resulting in a balanced and efficient search process for finding near-optimal solutions for the FSSP. Second, we tailor the SHO and GA methods to the specific requirements of the FSSP, including encoding schemes, objective function evaluation and constraint handling, which ensures that the hybrid algorithm is well suited to address the challenges posed by the FSSP. Third, we perform a comprehensive performance evaluation of the proposed hybrid algorithm, demonstrating its effectiveness in terms of solution quality and computational efficiency. Finally, we provide an in-depth analysis of the behavior of the hybrid algorithm, discussing the roles of the SHO and GA components and their interactions during the search process, which can help understand the factors contributing to the success of the algorithm and provide insight into potential improvements or adaptations to other combinatorial optimization problems.

**Keywords:** flow shop scheduling problem; SHOA; hybrid algorithm; metaheuristics; optimization; spotted hyena optimizer; genetic algorithm; uniform crossover; OR library; computational efficiency

#### **1. Introduction**

Combinatorial problems [1] involve finding the optimal arrangement, selection or sequencing of a finite set of elements based on specific constraints and objectives. They are prevalent in various fields, such as mathematics, computer science, engineering, operations research, economics and biology. The importance of solving combinatorial problems stems from their practical applications in decision-making, resource allocation and optimization tasks critical for the efficiency and effectiveness of real-world systems.

**Citation:** Mzili, T.; Mzili, I.; Riffi, M.E.; Dhiman, G. Hybrid Genetic and Spotted Hyena Optimizer for Flow Shop Scheduling Problem. *Algorithms* **2023**, *16*, 265. https://doi.org/10.3390/ a16060265

Academic Editor: Frank Werner

Received: 21 April 2023 Revised: 15 May 2023 Accepted: 17 May 2023 Published: 25 May 2023

**Copyright:** © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

Examples of combinatorial problems include the traveling salesman problem [2], which seeks the shortest route for a salesman visiting a set of cities once before returning to the starting point; the knapsack problem, which aims to select items with different weights and values to maximize the total value without exceeding a given weight limit; and the graph coloring problem, which assigns colors to graph vertices so that no two adjacent vertices share the same color. These problems, although seemingly different, share common challenges in terms of computational complexity, as they often require exploring an extensive solution space to identify the optimal solution.

One specific combinatorial problem of significant practical importance is the Flow Shop Scheduling Problem (FSSP) [3]. In this problem, a set of jobs must be processed on a collection of machines in a specific order, with each job consisting of multiple operations executed sequentially. The objective is to find a schedule that minimizes the makespan or the total time required to complete all jobs. Due to the combinatorial nature of this problem, finding an optimal solution becomes increasingly difficult as the number of jobs and machines increases.

Swarm intelligence algorithms [4] have emerged as effective approaches for tackling the optimization of makespan in the FSSP. These algorithms are inspired by the collective behavior of social organisms such as birds, fish, and insects, and their ability to solve complex problems through decentralized and self-organizing processes. Some widely used swarm intelligence algorithms for solving the FSSP include Particle Swarm Optimization (PSO) [5], Ant Colony Optimization (ACO) [6], Whale Swarm Algorithm (WOA) [7] and Rat Swarm Optimization [8].

In the context of the FSSP [9], these algorithms encode potential solutions as particles, ants or bees and iteratively explore the solution space by updating the position or path of these agents based on their own experiences and the collective knowledge of the swarm. The agents collaborate and compete, allowing the swarm to converge towards an optimal or near-optimal solution for the makespan. The effectiveness of swarm intelligence algorithms in solving the FSSP has been demonstrated in various industrial applications, such as manufacturing, transportation and logistics, where efficient job scheduling is critical for reducing production costs, improving resource utilization and enhancing overall performance.

In this article, we propose a novel hybrid algorithm that combines the Spotted Hyena Optimizer (SHO) [10] and Genetic Algorithm (GA) [11] to solve the Flow Shop Scheduling Problem (FSSP). The FSSP is a particular case of the Flow Shop Scheduling Problem (FSSP), in which jobs are processed on a set of machines in a specific order, and all jobs follow the same sequence of operations on the machines. The primary objective is to minimize the makespan, which is the total time required to complete all jobs.

The Spotted Hyena Optimizer (SHO) is a nature-inspired optimization algorithm based on the unique hunting behavior of spotted hyenas. It incorporates four main mechanisms: searching, encircling, attacking and mobbing. These mechanisms help explore the solution space efficiently and exploit the best solutions found during the search process.

The Genetic Algorithm (GA) is a widely-used, population-based optimization method inspired by the principles of natural selection and genetics. It operates on a population of candidate solutions and evolves them over generations using genetic operators, such as selection, crossover and mutation. GAs have been successfully applied to solve numerous combinatorial optimization problems, including the FSSP.

In our hybrid approach, we combine the strengths of both SHO and GA to improve the overall search efficiency and solution quality. The proposed algorithm starts with an initial population generated by the SHO. During the search process, the SHO mechanisms are employed to explore the solution space and to update the hyenas' positions. After a predefined number of iterations, the GA is integrated into the algorithm to further refine the solutions. The GA takes the current hyena positions as an input population and performs selection, crossover and mutation operations to generate offspring. The offspring then replace some of the least fit hyenas in the population, ensuring the best solutions are retained.

This hybridization of SHO and GA capitalizes on the exploration capabilities of the SHO and the exploitation abilities of the GA, resulting in a more robust and efficient algorithm for solving the FSSP. The proposed hybrid method is tested on a set of benchmark instances from the literature, and the results demonstrate its effectiveness in finding nearoptimal solutions with competitive computational times. The successful application of the hybrid spotted hyena and genetic algorithm to the FSSP indicates its potential for addressing other complex combinatorial optimization problems in various domains.

The main contributions of this paper can be summarized as follows:


This article is organized into six sections: (1) Introduction, which provides an overview of the combinatorial optimization problem and the motivation for developing the hybrid algorithm; (2) Related Works and Literature Review, where we discuss existing research on swarm intelligence algorithms and their application to the FSSP; (3) Flow Shop Scheduling Problems (FSSP), which offers a detailed description of the FSSP, its challenges and its significance in real-world applications; (4) Methodology, where we present the design and implementation of the proposed hybrid algorithm, combining the Spotted Hyena Optimizer (SHO) and Genetic Algorithm (GA); (5) Experimental Outcomes, where we analyze the performance of the hybrid algorithm using benchmark instances and compare the results with existing state-of-the-art approaches; and finally, (6) Conclusion, where we summarize the main findings of the study, discuss the implications of the results and suggest future research directions in the field of combinatorial optimization.

#### **2. Related Works**

In recent years, swarm intelligence has been increasingly applied to solve Flow Shop Scheduling Problems (FSSP) due to its ability to effectively explore and exploit the solution space. The following studies have made significant contributions to this area:


proposed a Referenced Iterated Greedy (RIG) algorithm, incorporating novel destruction and reconstruction methods as well as local search methods based on a reference. Experimental results demonstrated the effectiveness of the RIG algorithm, positioning it as a state-of-the-art solution for DAMNIPFSP with the total tardiness criterion.


Some of the state-of-the-art optimization algorithms for FSSP include GA-SHOA, WD [19], GA [19], IHSA [19], PSO [19], CLS-BFO [20], AGGA [20] and SSO [20]. These algorithms were selected and used for comparison with the hybrid algorithm we propose in this paper. GA-SHOA is a new hybrid algorithm that combines the exploration capabilities of SHOA with the exploitation capabilities of GA to efficiently search the solution space. CLS-BFO is a hybrid algorithm that combines the cuckoo search algorithm (CS) with the Broyden-Fletcher-Goldfarb-Shanno (BFGS) method to solve the FSSP. WD is an algorithm that uses differential evolution (DE) to optimize the FSSP. GA is a well-known metaheuristic algorithm that has been widely used to solve the FSSP. IHSA is a hybrid algorithm that combines the improved harmony search (IHS) algorithm and simulated annealing (SA). PSO is a swarm intelligence algorithm that has been applied to FSSP with promising results. AGGA is another hybrid algorithm that combines the genetic algorithm and the gravitational search algorithm (GSA). SSO is an algorithm that mimics the social behavior of the spotted hyena and has been shown to be effective in solving the FSSP.

Table 1 introduces a comparison of these methods.


**Table 1.** Comparison of optimization algorithms for the FSSP.

#### **3. Flow Shop Scheduling Problems (FSSPs)**

Flow Shop Scheduling Problems (FSSPs) is a class of scheduling problems that arise in manufacturing and production systems, where a set of jobs or tasks must be processed through a series of machines in a specific order. FSSPs is a well-studied optimization problem in the field of operations research and has numerous applications in various industries, such as automotive, semiconductor, food processing and textile production, among others.

In a typical flow shop environment, there are multiple machines or workstations, and each job must be processed on every machine in a predetermined sequence. The main objective of the FSSP is to determine the optimal scheduling of jobs on machines to achieve certain performance criteria, such as minimizing makespan, total completion time, total tardiness or a combination of these objectives.

The importance of flow shop scheduling problems lies in their ability to optimize the utilization of resources, reduce production costs and improve overall efficiency in manufacturing systems. Effective flow shop scheduling can lead to:


Despite its importance, FSSP is a challenging combinatorial optimization problem known to be NP-hard, meaning that finding an optimal solution becomes increasingly difficult as the problem size increases. As a result, researchers have developed various heuristic and metaheuristic algorithms to find near-optimal solutions for the FSSP in a reasonable amount of time, such as particle swarm optimization, genetic algorithms, simulated annealing and ant colony optimization, among others. These methods have been successfully applied to tackle real-world flow shop scheduling problems, resulting in significant improvements in manufacturing efficiency and cost reduction.

The Fob-Shop Scheduling Problem (FSSP) involves assigning a set of n jobs, each consisting of multiple operations, to a set of m machines. The primary objective is to find a schedule that minimizes the makespan (*Cmax*), which is the total completion time of all jobs. A solution can be represented as an n × m vector of operation sequences that optimizes the completion time.

$$\mathbb{C}\_{\text{max}} = \max(t\_{i\bar{j}} + p\_{i\bar{j}}) \tag{1}$$

$$\min(\mathbb{C}\_{nm} + 1)\tag{2}$$

where

$$\mathbb{C}\_{kl} \le \mathbb{C}\_{ji} - d\_{kl}; \; j = 1, \dots, n; \; i = 1, \dots, m; \; kl \in P\_{ji} \tag{3}$$

$$\sum\_{j:j \circ \alpha(t)}^n r\_{ji} \le 1; \ i \in M; \ t \ge 0 \tag{4}$$

$$\mathcal{C}\_{-}j i \ge 0; \ j = 1, \dots, n; \ i = 1, \dots, m \tag{5}$$

The constraints are as follows:


#### **4. Methodology**

The Spotted Hyena Optimizer (SHO) is a metaheuristic, bio-inspired optimization algorithm developed by Dhiman et al. The algorithm is based on the social behaviors of spotted hyenas, which are the largest among the three other hyena species (striped, brown and aardwolf). Spotted hyenas are skillful hunters that typically live and hunt in groups, relying on networks with over 100 members. The SHO algorithm comprises four main steps that emulate the encircling, hunting, attacking and searching behaviors of spotted hyenas (as shown in Figure 1 [10]).

• Encircling prey:

**Figure 1.** Spotted Hyena Hunting Behavior [10].

The best solution is considered the target prey, and other search agents update their positions based on the obtained best solution. The mathematical model for this behavior is given by:

$$D\mathbf{h} = |B \cdot P p(\mathbf{x}) - P(\mathbf{x})|,\tag{6}$$

$$P(\mathbf{x} + \mathbf{1}) = P p(\mathbf{x}) - E \cdot D \mathbf{h} \tag{7}$$

• Hunting:

The hunting strategy of the SHO is defined as follows:

$$D\mathbf{h} = |B \cdot P\mathbf{h} - P\mathbf{k}|\_{\prime} \tag{8}$$

$$Pk = P\hbar - E \cdot D\hbar\,,\tag{9}$$

$$\text{Ch} = Pk + Pk + 1 + \dots + Pk + N \text{ \textquotedbl{}} \tag{10}$$

• Attacking prey:

The mathematical formulation for attacking prey is given by:

$$P(\mathbf{x} + 1) = \frac{ch}{N} \, \text{\,\, \,} \tag{11}$$

• Searching for prey:

The search for a suitable solution involves evaluating the E and B vectors. The SHO algorithm can solve various high-dimensional problems with low computational efforts and avoid local optimum issues.

In this study, we will focus on using the encircling behavior to solve the flow shop scheduling problem, and the pseudo-code of the SHO algorithm is provided in Algorithm 1.

Alterations to mathematical operators for flow shop problems:

The mathematical operators are redefined to accommodate the flow shop problem as follows:



The Genetic Algorithm (GA) is a popular metaheuristic technique for solving optimization problems, including the Flow Shop Scheduling Problem (FSSP). The Uniform Crossover and Mutation are two genetic operators used within GA that combine parent solutions to create offspring. Here's an example of using a Genetic Algorithm with Uniform Crossover and Mutation to solve the FSSP:

Crossover: Perform the Uniform Crossover on the selected parent individuals to create offspring. In the Uniform Crossover, for each position in the parent's permutation, a random decision is made as to which parent's gene will be inherited by the offspring. For example:


Mutation: Apply a mutation operator to each gene of the offspring with a certain probability. The mutation operator randomly changes the value of the gene to another valid value. In the FSSP case, which is a random permutation of two tasks, the mutation operator may swap the positions of two tasks in the offspring's permutation.

For example:


The final algorithm is described as follows in Algorithm 2:

**Algorithm 2** Discrete Hybrid Spotted Hyena Optimizer with Uniform Crocgover



<sup>1:</sup> **procedure** HYBRID SHO(2) 2: **Input:** Spotted hyenas population *Pi* (*i* = 1, 2, ..., *n*) 3: **Output:** The optimal search agent 4: Initialize parameters *h*, *B*, *E*, and *N* 5: Evaluate the fitness of each search agent 6: *Ph* ← Identify the best search agent 7: *Ch* ← Form a group or cluster of all distant optimal solutions

<sup>8:</sup> **while** *x* < *MaxIteration* **do**

<sup>11:</sup> **end for**

<sup>12:</sup> Perform Uniform Crossover on selected parent individuals to create offspring

#### **5. Experimental Outcomes**

The performance of the hybrid GA-SHO algorithm was assessed using over 50 instances from the OR library. The evaluation results are presented in Table 2, which include the instance name ("Instance"), the number of jobs (n) and machines (m) for each instance ("n × m"), the best result achieved by other algorithms ("*BKS*"), the best and worst results obtained through the SHO method ("Best" and "Worst"), the average results ("*Average*") and the average execution time in seconds for 20 runs ("Time"). The "*PDav(%)*" column displays the percentage deviation of the average solution length from the optimal solution length, computed using Equation (12).

$$PDav(\%) = \frac{\left(\left(Average - BKS\right) \times 100\%\right)}{BKS} \tag{12}$$

**Table 2.** Parameters of Discrete GA-SHO.


The "*PDav(%)*" column emphasizes values of 0.00 in bold when all solutions found in the 20 runs are equal to the length of the best-known solution. If the average of the solutions discovered in all tests is less than the length of the best-known solution, these values are highlighted in bold and blue. This suggests that the GA-SHO algorithm managed to find solutions that either match or surpass the best-known solutions for these instances.

To properly evaluate the effectiveness of the GA-SHO algorithm, it is crucial to compare it with other methods for solving problems.

The comparison is made with the following algorithms: CLS-BFE [20], DEO [19], GA [19], IHSA [19], PSO [19], AGGA [20] and SSO [20].

The initial parameters are described in Table 2:

Figure 2 shows the comparison of the best-obtained results, clearly demonstrating that the GA-SHOA algorithm outperforms other methods (CLS-BFO, IHSA, PSO, DEO, SSO, GA, AGGA) across all instances (REC01 to REC23).

**Figure 2.** The comparison of the best-obtained results.

Tables 3 and 4 clearly demonstrates that the GA-SHOA algorithm outperforms other methods (CLS-BFO, IHSA, PSO, DEO, SSO, GA, AGGA) across all instances (REC01 to REC23). Here's a more detailed analysis of the data:


**Table 3.** Comparison between GA-SHOA, CLS-BFO, IHSA, and PSO.


**Table 4.** Comparison between DEO, SSO, GA and ACGA.


Conclusively, based on the data provided, GA-SHOA excels over the other algorithms in terms of solution quality (best), solution consistency (std) and computational speed (time). This superior performance is consistent across all instances, positioning GA-SHOA as a more reliable and efficient choice for this specific problem.

To further scrutinize GA-SHOA's performance against other algorithms, we can conduct an Analysis of Variance (ANOVA) to ascertain if there is a significant difference in the mean objective function values. ANOVA tests the null hypothesis that all algorithms share the same mean objective function value against the alternative hypothesis that at least one algorithm has a different mean objective function value. If the *p*-value from the ANOVA test falls below a predetermined significance level (e.g., 0.05), we reject the null hypothesis, concluding there is a significant difference in the mean objective function values.

The results of the ANOVA test are described in Table 5:

**Table 5.** Anova test comparison.


The ANOVA test shows that there is a significant difference in the mean objective function values across the algorithms, with a *<sup>p</sup>*-value of 2.20 × <sup>10</sup><sup>−</sup>16. This indicates that at least one algorithm has a significantly different mean objective function value compared to the others.

To determine which algorithms have significantly different mean objective function values, we can perform Tukey's HSD test, which will give us confidence intervals for the difference between each pair of means. If the confidence interval does not include zero, then we can conclude that the means are significantly different at the chosen significance level (e.g., 0.05).

Here are the results of Tukey's HSD test in Table 6:



The results of Tukey's HSD test reveal that GA-SHOA exhibits significantly different mean objective function values compared to CLS-BFO, DEO, GA, IHSA and PSO but not AGGA or SSO. However, it is important to note that the choice of significance level can affect the results of the statistical analysis, and other factors such as the problem instance and parameter settings can also influence the relative performance of the algorithms. Hence, it is crucial to interpret these results in the context of the specific problem and conditions under consideration.

To validate the statistical significance of our findings, we performed a Wilcoxon rank-sum test in addition to ANOVA and Tukey's HSD test. Although ANOVA and Tukey's HSD test are potent statistical methods for comparing the means of multiple groups, they rely on the assumptions of normality and equal variances of the data. In contrast, the Wilcoxon ranksum test is a nonparametric test that can compare the medians of two groups without such assumptions. By conducting the Wilcoxon rank-sum test, we verified our results and ensured

the statistical significance of the performance differences between our proposed algorithm and the other methods. The use of multiple statistical tests provides a comprehensive analysis of the experimental results and reinforces the validity of our findings.

Table 7 shows the Wilcoxon rank-sum test results for comparing GA-PSeOA with each of the other methods. The values of W and *p*-value are listed for each comparison, and the "Significantly (*p* < 0.05)?" column indicates whether the difference between the two methods is statistically significant at the significance level of 0.05.


**Table 7.** The Wilcoxon signed rank test comparison.

Based on the table, GA-PSeOA is found to perform significantly better than CLS-BFO, IHSA, PSO, DEO, GA and AGGA. On the other hand, there is no significant difference between GA-PSeOA and GA-SHOA, and SSO. The *p*-values for the significant differences are all less than 0.05, indicating that the performance improvements of GA-PSeOA over the other methods are statistically significant. Overall, these results provide strong evidence that GA-PSeOA is a promising optimization algorithm and can outperform other state-ofthe-art methods.

#### **6. Conclusions**

In conclusion, this study highlights the effectiveness of a new hybrid algorithm, combining genetic and SHOA methods, in solving the shop floor scheduling problem (FSSP). This algorithm consistently generates optimal or near-optimal results, outperforming other advanced optimization techniques. Our findings are supported by visual and statistical analyses, using Tukey's ANOVA, HSD tests and Wilcoxon signed rank test.

FSSP is a critical and complex problem in many areas of manufacturing. Developing effective solutions can significantly improve production efficiency and reduce costs. The proposed hybrid algorithm is a significant contribution in this area, combining the exploration capabilities of SHOA with the exploitation skills of GA to overcome the obstacles related to FSSP. Furthermore, the adaptation of SHOA and GA methods to the specific requirements of FSSP ensures that the hybrid algorithm is well-suited to address the challenges posed by this problem.

Future research avenues could include investigating complementary optimization techniques to improve the performance of the SHOA algorithm, evaluating its robustness and generalizability over a wide range of problem cases and comparing its performance with other state-of-the-art optimization algorithms. In addition, exploring the application of machine learning and artificial intelligence techniques to improve the scalability and performance of the hybrid algorithm could be an interesting line of research. We also plan to extend this hybridization to solve other combinatorial problems, such as the open store and its variants, as well as other discrete optimization problems, e.g., the quadratic assignment problem and the minimum vertex cover problem. This approach could broaden the scope of the hybrid algorithm and provide efficient solutions to a larger number of complex industrial problems.

Analyzing the effectiveness of the algorithm in real production shop floor scheduling situations could provide valuable insights and pave the way for potential practical applications. In addition, examining the implementation of the hybrid algorithm in various

industries and evaluating its scalability in large-scale production environments could make important contributions to the optimization literature.

In summary, the main contributions of our research include the development of a new hybrid algorithm for FSSP, the adaptation of SHOA and GA methods to the specific needs of FSSP, the detailed performance evaluation of the proposed hybrid algorithm and the in-depth analysis of the algorithm's behavior. Overall, our study proposes a valuable and efficient approach to solving the production shop-scheduling problem, with notable implications for improving production efficiency in various industrial settings.

**Author Contributions:** Conceptualization, T.M., I.M., M.E.R. and G.D.; methodology, T.M., I.M., M.E.R. and G.D.; software, T.M., I.M., M.E.R. and G.D.; validation, T.M., I.M., M.E.R. and G.D.; formal analysis, T.M., I.M., M.E.R. and G.D.; investigation, T.M., I.M., M.E.R. and G.D.; resources, T.M., I.M., M.E.R. and G.D.; data curation, T.M., I.M., M.E.R. and G.D.; writing—original draft preparation, T.M., I.M., M.E.R. and G.D.; writing—review and editing, T.M., I.M., M.E.R. and G.D; supervision, I.M. and M.E.R.; project administration, T.M., I.M., M.E.R. and G.D funding acquisition, T.M., I.M., M.E.R. and G.D. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors have no conflict of interest to declare that are relevant to the content of this article.

#### **References**


**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

#### MDPI

St. Alban-Anlage 66 4052 Basel Switzerland Tel. +41 61 683 77 34 Fax +41 61 302 89 18 www.mdpi.com

*Algorithms* Editorial Office E-mail: algorithms@mdpi.com www.mdpi.com/journal/algorithms

Academic Open Access Publishing

www.mdpi.com ISBN 978-3-0365-8277-1