*Article* **An Improved Crystal Structure Algorithm for Engineering Optimization Problems**

**Wentao Wang, Jun Tian \* and Di Wu**

College of Software, Nankai University, Tianjin 300071, China

**\*** Correspondence: jtian@nankai.edu.cn

**Abstract:** Crystal Structure Algorithm (CryStAl) is a new meta-heuristic algorithm, and it has been studied by many scholars because of its wide adaptability and the fact that there is no need to set parameters in advance. An improved crystal structure algorithm (GLCryStAl) based on golden sine operator and Levy flight is designed in this paper. The algorithm makes good use of the relationship between the golden sine operator and the unit circle to make the algorithm exploration space more comprehensive, and then gradually narrows the search space in the iterative process, which can effectively speed up the convergence rate of the algorithm. At the same time, a Levy operator is introduced to help the algorithm effectively get rid of the attraction of local optimal value. To evaluate the performance of GLCryStAl, 12 classic benchmark functions and eight CEC2017 test functions were selected to design a series of comparative experiments. In addition, the experimental data of these algorithms are analyzed using the Wilcoxon and Friedman tests. Through these two tests, it can be found that GLCryStAl has significant advantages over other algorithms. Finally, this paper further tests the optimization performance of GLCryStAl in engineering design. GLCryStAl was applied to optimize pressure vessel design problems and tension/compression spring design problems. The optimization results show that GLCryStAl is feasible and effective in optimizing engineering design.

**Keywords:** crystal structure algorithm; golden sine algorithm; levy flight; engineering optimization problems

#### **1. Introduction**

Nowadays, practical problems in the fields of traffic scheduling, engineering design, machinery manufacturing, etc., are becoming more and more complex and challenging. When dealing with these problems, people often use optimization algorithms to save some costs. Since most production practice problems are multivariate, nonlinear, and have many complex constraints, the traditional conjugate gradient method does not perform well in the optimization of these problems [1]. The meta-heuristic algorithm has the characteristics of not depending on gradient information and wide adaptability, which can effectively make up for the shortcomings of traditional optimization algorithms. At present, the meta-heuristic algorithm is applied in various industries, such as workshop scheduling [2], task planning [3], engineering management [4–7] and so on.

The meta-heuristic algorithm is a mathematical method inspired by the biological behavior and some physical phenomena in nature [8]. The meta-heuristic algorithms mainly include the swarm optimization algorithm [9], evolutionary algorithm [10], physical and chemical algorithms [11] and human based algorithms [12]. The simulated annealing algorithm [13,14] and differential evolution algorithm [15] are classical evolutionary algorithms. Some classic and newly proposed swarm intelligence optimization algorithms are as follows: the bee collecting pollen algorithm (BCPA) [16] is proposed by simulating the behavior of bees collecting pollen. The fruit fly optimization algorithm (FOA) [17] is proposed by simulating the process of drosophila predation using its keen sense of smell

**Citation:** Wang, W.; Tian, J.; Wu, D. An Improved Crystal Structure Algorithm for Engineering Optimization Problems. *Electronics* **2022**, *11*, 4109. https://doi.org/ 10.3390/electronics11244109

Academic Editor: Ping-Feng Pai

Received: 11 November 2022 Accepted: 8 December 2022 Published: 9 December 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 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/).

and vision. The bat-inspired algorithm (BA) [18] is proposed by simulating bats using a sonar to detect prey and avoid obstacles. The grey wolf optimizer (GWO) [19] and the tuna swarm optimization (TSO) [20] are proposed by simulating the hunting behavior of wolves and tuna swarms. At present, the metaheuristic algorithm is applied in more and more fields, which has caused more and more scholars to study it.

In nature, a large number of microscopic material units such as molecules, atoms and ions are regularly arranged to form material structures called crystals. "Lattice points" are the basic units of crystal; they form a periodic lattice in a predefined space. The "basis" associated with each lattice point determines the position of the molecule in the crystal structure. In 2021, SIAMAK TALATAHAR proposed a new meta-heuristic algorithm called crystal structure algorithm (CryStAl) [21], by studying the principle of adding basis to form crystal structures with lattice points. The crystal structure algorithm has the advantages of simple structure, no need to set parameters in advance and strong adaptability, so it has generated widespread interest since it was proposed. Although CryStAl has excellent performance in many aspects, there are still some deficiencies in the crystal structure algorithm. CryStAl is susceptible to local extremes during iteration, resulting in insufficient exploration. Furthermore, the convergence speed of CryStAl is relatively slow. Up to now, no scholars have made relevant improvements to the crystal structure algorithm. Because the crystal structure algorithm has the advantages of simple structure, being easy to understand and low time complexity, this paper improves the algorithm under the premise of retaining these advantages of the crystal structure algorithm so that it can obtain better comprehensive optimization performance.

In view of these shortcomings, this paper developed a crystal structure algorithm improved by using a Levy flight operator and golden sine operator.

To ensure CryStAl has a balanced exploration and development performance, random numbers subject to Levy distribution are added to the CryStAl, which can effectively avoid CryStAl being affected by the suboptimal solution iterative process, and the golden sine operator is applied to modify the update strategy of candidate solutions, so that the algorithm converges faster. GLCryStAl is designed according to the modification strategy above.

The main contents of the article are summarized as follows. Section 2 introduces the CryStAl algorithm. Section 3 introduces the improved algorithm GLCryStAl in detail. In Section 4, a series of comparative experiments are designed and experimental numerical analysis is carried out. Section 5 uses GLCryStAl to optimize two engineering problems. Section 6 provides a comprehensive discussion of GLCryStAl. The paper ends in Section 7.

#### **2. An Overview of the Crystal Structure Algorithm**

The crystal structure algorithm is inspired by the principle of adding basis to lattice points to form crystals. Based on this principle, SIAMAK TALATAHAR proposed a crystal structure algorithm in 2021.

The internal particles of the crystal are regularly arranged. The structural particles that make up a crystal are regularly arranged at certain points in three-dimensional space, and these points periodically form an infinite lattice with a certain geometric shape, called a "lattice". The "basis" associated with each lattice point in the crystal determines the position of the particle in the crystal structure, adding basis to the lattice point to form the crystal structure. The mathematical model of the lattice position is as follows [22]:

$$
\sigma = \sum n\_i a\_i \tag{1}
$$

where *i* represents the number of crystal angles, *ai* is the shortest vector and *ni* is an integer.

CryStAl initializes crystals using the following formula:

$$\mathbf{Cr} = \begin{bmatrix} \mathbf{Cr}\_1 \\ \mathbf{Cr}\_2 \\ \vdots \\ \mathbf{Cr}\_i \\ \vdots \\ \mathbf{Cr}\_n \end{bmatrix} = \begin{bmatrix} \mathbf{x}\_1^1 & \mathbf{x}\_1^2 & \cdots & \mathbf{x}\_1^j & \cdots & \mathbf{x}\_1^d \\ \mathbf{x}\_2^1 & \mathbf{x}\_2^2 & \cdots & \mathbf{x}\_2^j & \cdots & \mathbf{x}\_2^d \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ \mathbf{x}\_i^1 & \mathbf{x}\_i^2 & \cdots & \mathbf{x}\_i^j & \cdots & \mathbf{x}\_i^d \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ \mathbf{x}\_n^1 & \mathbf{x}\_n^2 & \cdots & \mathbf{x}\_n^j & \cdots & \mathbf{x}\_n^d \end{bmatrix}, \begin{cases} i = 1, 2, \cdots, n \\ j = 1, 2, \cdots, d \\ \vdots \\ \end{cases} \tag{2}$$

where *n* is the total number of single crystals and *d* is the total number of variables. Single crystals are initialized using the following formula:

$$\mathbf{x}\_{i}^{j}(0) = \mathbf{x}\_{i,\text{min}}^{j} + \xi(\mathbf{x}\_{i,\text{max}}^{j} - \mathbf{x}\_{i,\text{min}}^{j}),\\\begin{cases} i = 1, 2, \dots, n\\ j = 1, 2, \dots, d \end{cases} \tag{3}$$

where *x<sup>j</sup> <sup>i</sup>*,max and *<sup>x</sup><sup>j</sup> <sup>i</sup>*,min denote the two extreme values of the *j th* decision variable of the *i th* candidate solution, *ξ* is a random value in the range of 0–1 and *x<sup>j</sup> i* (0) denotes the initial position of the single crystal.

In CryStAl, the crystal at the corner is called *Crmain*. The average value of randomly selected crystals is *Fc*. Currently, the best crystal is *Crb*. The crystal structure algorithm has four candidate solution updating strategies, as follows:

Simple cubicle strategy:

$$
\mathbb{C}r\_{new} = \mathbb{C}r\_{old} + r\mathbb{C}r\_{main} \tag{4}
$$

Cubicle with the optimal crystal:

$$\mathcal{C}r\_{new} = \mathcal{C}r\_{old} + r\_1 \mathcal{C}r\_{min} + r\_2 \mathcal{C}r\_b \tag{5}$$

Cubicle with the average crystal:

$$\mathcal{C}r\_{new} = \mathcal{C}r\_{old} + r\_1 \mathcal{C}r\_{main} + r\_2 \mathcal{F}\mathbf{c} \tag{6}$$

Cubicle with the optimal crystal and average crystal:

$$\mathcal{C}r\_{new} = \mathcal{C}r\_{old} + r\_1 \mathcal{C}r\_{main} + r\_2 \mathcal{C}r\_b + r\_3 \mathcal{F}\mathbf{c} \tag{7}$$

where *r*–*r*<sup>3</sup> are four random values, *Crold* is the position of the old crystal and *Crnew* is the position of the new crystal. The pseudocode of CryStAl is displayed in Algorithm 1:

#### **Algorithm 1. Pseudo-code of CryStAl**


#### **3. The Proposed Algorithm**

In this chapter, we first introduce the golden sine operator and Levy flight operator. Based on these two operators, the original crystal structure algorithm is modified. Then, a crystal structure algorithm based on Levy flight and golden sine operators is proposed, which is called GLCryStAl.

#### *3.1. Golden Sine Position Update Strategy*

The golden sine algorithm [23] is called golden-SA for short. It is a new intelligent optimization algorithm proposed by Tanyildizi, inspired by the mathematical model of sine function. Golden-SA is widely studied because of its simple structure, fast convergence speed and strong stability. Golden-SA simulates the search space exploration process by using the sine function to scan the unit circle. It makes good use of the special relationship between the sine function and the unit circle and combines the golden section coefficients to search the algorithm space iteratively, and finally finds the optimal solution set.

The golden section coefficient is a concept proposed by the ancient Greek mathematician Eudoxus. It does not depend on gradient information and only needs to be iterated once per step, while its contraction steps are fixed per step. Scholars have found that the strategy of combining the traditional sine function with the golden section coefficient can help the algorithm quickly find the extreme value of the unimodal function. At the same time, the golden sine search strategy has good ergodicity, so it can effectively prevent the algorithm from being attracted by the local extreme value.

The mathematical description of the Golden-SA strategy is shown in Equation (8):

$$V\_{i}^{t+1} = V\_{i}^{t} |\sin(r\_1)| - r\_2 \sin(r\_1) \left| \mathbf{x}\_1 B\_i^t - \mathbf{x}\_2 V\_i^t \right| \tag{8}$$

where *t* represents the current number of iterations and *B<sup>t</sup> <sup>i</sup>* represents the position of the best individual in the population in the *t*th iteration. *r*<sup>1</sup> and *r*<sup>2</sup> are random numbers in [0,2π] and [0,π], respectively; they determine the moving distance of the current individual in the next iteration and the direction of the current individual position update. *V<sup>t</sup> <sup>i</sup>* and *<sup>V</sup>t*+<sup>1</sup> *i* represent the positions of the *i*th individual in iteration *t* and iteration *t+1*, respectively. *x*<sup>1</sup> and *x*<sup>2</sup> are the golden section coefficients mentioned above, which can help the algorithm gradually narrow the search space and guide the ordinary individuals in the population toward the optimal individuals.

The mathematical expressions of *x*<sup>1</sup> and *x*<sup>2</sup> are as follows:

$$\mathbf{x}\_1 = a \cdot (\mathbf{1} - \boldsymbol{\tau}) + b \cdot \boldsymbol{\tau} \tag{9}$$

$$\mathbf{x}\_2 = a \cdot \boldsymbol{\pi} + b \cdot (1 - \boldsymbol{\pi}) \tag{10}$$

$$
\pi = \frac{\sqrt{5} - 1}{2} \tag{11}
$$

where *a* and *b* are the search interval, and the golden sine algorithm is segmented by the interval of the standard sine function. Since the period of the standard sine function is 2*π*, according to the relationship between the standard sine and the unit circle, in order to enable the population to traverse the searched space in each dimension throughout the period, the values of *a* and *b* are usually *π* and −*π*. *τ* is the golden ratio.

#### *3.2. Levy Flight Position Update Strategy*

Levy operator [24] is a search strategy consistent with Levy distribution, and its step size is random, which makes Levy operator more suitable for exploration in a wider space than Brownian motion [25]. In the search process, Levy flight uses long distance step in low frequency and short distance step in high frequency, which can effectively avoid the algorithm being attracted by local extrema in the optimization process. Due to the high complexity of Levy distribution, researchers often use the Mantegna [26] algorithm to simulate Levy flight step size, which is defined as follows:

$$s = \frac{\mu}{|\nu|^{1/\beta}}\tag{12}$$

where *μ* and *ν* are defined as follows:

$$
\mu \sim \mathcal{N}\left(0, \sigma\_{\mu}^{2}\right) \tag{13}
$$

$$\nu \sim N\left(0, \sigma\_\nu^2\right) \tag{14}$$

$$\sigma\_{\mu} = \left\{ \frac{\Gamma(1+\beta)\sin\left(\frac{\pi\beta}{2}\right)}{\Gamma\left[\frac{(1+\beta)}{2}\right] \cdot \beta \cdot 2^{\frac{(1+\beta)}{2}}} \right\}, \ \sigma\_{\nu} = 1\tag{15}$$

where the value of *β* is usually 1.5.

In order to show the global exploration capability of Levy flight more intuitively, this paper compares Levy flight with random walk strategy. The comparison results are presented in Figure 1.

**Figure 1.** Simulation comparison experiment diagram of Levy flight and random walk.

Figure 1 shows that the Levy flight has a larger search range. The jump points of random walk strategy are more concentrated, and the jump points of Levy flight strategy are widely distributed. This means that the crystal structure algorithm modified by Levy flight can effectively enhance its global search performance.

#### *3.3. Improved Crystal Structure Algorithm*

Aiming at the shortcomings of crystal structure algorithm, such as slow convergence speed and the requirement of practical engineering project for algorithm accuracy, this paper proposes a crystal structure algorithm (GLCryStAl) combining golden sine and Levy flight operator.

The GLCryStAl algorithm introduces the golden sine algorithm and the golden section coefficient into the three position update strategies mentioned in Equations (4)–(6), and determines its update position according to Equation (8). Because the golden sine operator has excellent ergodicity, it can make the optimization space of the algorithm more comprehensive and control the distance and direction of the candidate solution update through the parameters *r*<sup>1</sup> and *r*2, so the exploration space of the algorithm can be gradually reduced. Therefore, the introduction of the golden sine operator can reduce the solution time of the algorithm and help the algorithm to obtain a more ideal solution.

Levy operator can significantly enhance the algorithm's global exploration performance. In this paper, the update strategy in Equation (7) is mutated by using the jump characteristics of the combination of long and short steps of the Levy operator, which can greatly improve the diversity of the algorithm population and make the optimization efficiency of the algorithm higher. The specific steps of GLCryStAl are as follows:

The modified simple cubicle strategy:

$$\mathcal{C}r\_{new} = \mathcal{C}r\_1|\sin(r\_1)| - r\_2\sin(r\_1)|x\_1\mathcal{C}r\_b - x\_2\mathcal{C}r\_1| \tag{16}$$

The modified cubicle with the optimal crystal:

$$\mathcal{C}r\_{new} = \mathcal{C}r\_2|\sin(r\_1)| - r\_2\sin(r\_1)|\mathbf{x}\_1\mathcal{C}r\_b - \mathbf{x}\_2\mathcal{C}r\_2|\tag{17}$$

The modified cubicle with the average crystal:

$$Cr\_{new} = Cr\_3|\sin(r\_1)| - r\_2 \sin(r\_1)|x\_1Cr\_b - x\_2Cr\_3|\tag{18}$$

Cubicle with the optimal crystal and average crystal:

$$\mathbb{C}r\_{nrw} = \mathbb{C}r\_{old} + \mathfrak{a} \otimes \mathrm{Levy}(\lambda) \otimes \mathbb{C}r\_{main} + \mathfrak{a} \otimes \mathrm{Levy}(\lambda) \otimes \mathbb{C}r\_b + \mathfrak{a} \otimes \mathrm{Levy}(\lambda) \otimes \mathrm{Fc} \tag{19}$$

where *Crb* is the optimal candidate in the current population. *Cr*1, *Cr*<sup>2</sup> and *Cr*<sup>3</sup> are the candidate solutions produced by Equations (16)–(18) in the last execution,*α* is a distance control parameter, ⊗ denotes point multiplication, and *Levy*(*λ*) is the jump path whose jump distance obeys Levy distribution. Considering that the exploration step size of Levy flight is too aggressive, it may jump out of the main search range during the algorithm search process, so this paper sets α to 0.01.

The pseudocode of GLCryStAl is displayed in Algorithm 2:


#### **4. Simulation Experiments and Results Analysis**

In this section, 12 classic benchmark functions and eight CEC2017 test functions are applied to design comparative experiments of the other five algorithms of GLCryStAl in two different dimensions. To avoid the length of the article being too long, this paper selected part of the CEC2017 test function, which is also representative. Finally, the experimental results are numerically analyzed to verify the optimization performance of GLCryStAl.

#### *4.1. Benchmark Functions and Experimental Design*

The details of the test functions are displayed in Table 1. *F*1–*F*<sup>6</sup> are unimodal functions, which are applied to evaluate the solution speed of these algorithms. *F*7–*F*<sup>9</sup> are multimodal functions, which are applied to evaluate whether these algorithms have excellent global exploration capacity. *F*10–*F*<sup>12</sup> are combined functions, which are suitable for testing algorithm performance in fixed dimensions and are used to test the answer accuracy of these algorithms. *F*13–*F*<sup>20</sup> are the CEC2017 functions which are applied to test the comprehensive capability of these algorithms.

Based on these 20 test functions, this paper designs a series of experiments comparing GLCryStAl with some of the latest algorithms and an improved algorithm. These competitor algorithms are CryStAl, Accelerated Particle Swarm Optimization Algorithm (APSO) [27], Whale Optimization Algorithm (WOA) [28], Golden Jackal Optimization (GJO) [29], Tunicate Swarm Algorithm (TSA) [30] and the newly proposed Dung beetle optimizer (DBO) [31]. Functions *F*1–*F*<sup>9</sup> are tested in 30 and 100 dimensions, respectively, and *F*10–*F*<sup>12</sup> are tested in their suitable dimension. Eight CEC2017 benchmark functions are tested in 50 dimensions. The maximum number of evaluations of *F*1–*F*<sup>12</sup> is 1000. Since CEC2017 benchmark functions are too complex, the number of evaluations of eight CEC2017 functions are simplified to 3000 without losing representativeness. The population size of each algorithm is 30. To avoid accidental interference, we run each algorithm 30 times independently in each experiment. The parameter values of these algorithms involved in these experiments are shown in Table 2.


**Table 1.** Benchmark functions.

**Table 2.** Parameter values of the algorithms.


#### *4.2. Results and Analysis*

Table 3 displays the experimental results of GLCryStAl and other competitors in low dimensional benchmark functions (dimension = 30). Std is the standard deviation and mean is the average. The mean reflects the solution accuracy of these algorithms and Std reflects their robustness. *F*10–*F*<sup>12</sup> are tested in their suitable dimension.

Table 4 displays the test data of GLCryStAl and competitors in high-dimensional benchmark functions (dimension = 100). The experimental results of eight test functions in CEC2017 are shown in Table 5.


**Table 3.** Experimental results in 30 dimensions.

**Table 4.** Experimental results in 100 dimensions.



**Table 5.** Test results of CEC2017 functions.

As can be seen from the above three tables, when the dimension is 30, GLCryStAl can obtain the theoretical optimal values in test functions *F*1–*F*<sup>4</sup> and *F*7–*F*9; GLCryStAl still shows excellent performance in other functions. The solution accuracy of GLCryStAl in *F*<sup>5</sup> is slightly worse than that of WOA, GJO and DBO, and the solution accuracy of GLCryStAl in *F*<sup>6</sup> is not good, but the gap between GLCryStAl and other competitive algorithms in these two test functions is not large. The results are analyzed according to the Std value. Among the functions other than *F*<sup>5</sup> and *F*6, the Std value of GLCryStAl is the smallest, which indicates that the optimization effect of GLCryStAl is very stable.

When the dimension is 100, GLCryStAl has the best solution accuracy in all benchmark functions, and GLCryStAl can find the theoretical optimal value in all functions except *F*<sup>5</sup> and *F*6. All the data were analyzed according to Std value. The Std value of CL in *F*<sup>5</sup> was only ever worse than CryStAl, and the Std value of GLCryStAl in *F*<sup>6</sup> was the second best, indicating that GLCryStAl still has excellent robustness when solving high-dimensional problems. From the data in Table 5, we can see that the optimization performance of GLCryStAl does not decrease as the test case dimensions increase.

The experimental results of CEC2017 function indicate that all algorithms do not obtain the theoretical optimal value. However, GLCryStAl can achieve better optimization accuracy than other competitors in all test functions. This indicates that the GLCryStAl algorithm modified by Levy operator and golden sine operator can get rid of the attraction of local extreme value more efficiently when solving difficult optimization problems. At the same time, the development and exploration ability of the algorithm are balanced to ensure that the algorithm has a fast convergence rate.

Based on the above three tables for overall analysis, GLCryStAl has the characteristics of high accuracy in 85% of the function optimization problems in the classical benchmark function. Combined with the experimental results of two different dimensions, the Std value of GLCryStAl shows obvious advantages in 76% of the functions. It is not difficult to see that the optimization effect of GLCryStAl is not easily affected by contingency probability, and GLCryStAl can always maintain a stable solution accuracy. In the CEC2017 experimental environment, GLCryStAl can calculate more accurate results within a limited number of executions. None of the comparison algorithms calculate the theoretical optimal value in eight CEC2017 experiments, but this can illustrate that the proposed Levy operator and golden sine operator can accelerate the convergence speed of GLCryStAl and enable it to obtain a better global exploration vision.

Because the golden sine operator has excellent ergodicity, the optimization space of the algorithm can be more comprehensive. The introduction of the golden section coefficient in the iterative process further reduces the search space of the algorithm, which greatly improves the convergence rate of GLCryStAl. Using the Levy flight strategy to modify the candidate solution update formula expands the exploration scope of GLCryStAl, and reduces the probability that GLCryStAl is attracted by local optimal solution. The above data strongly prove the superiority of GLCryStAl and the effectiveness of the proposed operator.

Figure 2 shows the convergence curves of GLCryStAl and other six comparison algorithms on 20 test functions, where Figure 2a–i are the curves of *F*1–*F*<sup>9</sup> in 100 dimensions, Figure 2j–l are the curves of *F*10–*F*<sup>12</sup> in their suitable dimension and Figure 2m–u are the curves of eight CEC2017 functions.

The convergence curves of these algorithms indicate that GLCryStAl has more excellent convergence performance than its competitors. For simple optimization problems, GLCryStAl can obtain theoretical optimal values within 400–700 iterations. For complex and challenging problems, GLCryStAl can also maintain a faster convergence rate and get rid of the influence of local attraction points, and ultimately achieve higher optimization accuracy.

In order to further test whether GLCryStAl has an obvious enhancement advantage compared with other algorithms, this paper uses the Wilcoxon [32] statistical method and Friedman method to analyze the experimental data of these algorithms in 100-dimensional benchmark functions. The data of *F*10–*F*<sup>12</sup> are based on their respective dimensions. The experimental data of eight CEC2017 benchmark functions are measured in 50 dimensions. The results of Friedman and Wilcoxon tests are listed in Tables 6 and 7.

The smaller the rank mean of the algorithm, the better its performance. As can be seen from Table 6, GLCryStAl has the smallest rank mean, CryStAl ranks second, followed by DBO, GJO, WOA, TSA, APSO. According to the statistical analysis results, the rank mean of the second-ranked competitive algorithm is almost twice that of GLCryStAl, and the rank mean of APSO is more than three times that of GL, which indicates that the improvement effect of the operator proposed in this paper is significant.

In the Wilcoxon statistical test results, if the *p*-value is less than 0.05 and close to 0, it proves that the experimental results of the two algorithms are significantly different. If the *p*-value exceeds 0.05, it proves that the experimental results of the two algorithms are not significantly different. If the *p*-value is equal to NaN, it proves that the experimental results of the two algorithms are not different.

As can be seen from Table 7, the *p*-values of GLCryStAl are basically less than 0.05 and close to 0, which means that GLCryStAl has significant advantages compared with other algorithms. A small number of the data in Table 7 are greater than 0.05, as are a small number for NaN. This is because the final solution accuracy of these competitive algorithms is not much different from that of GLCryStAl, but it can be seen from the convergence curves of all algorithms that although the solution accuracy of these competitive algorithms is not much different from that of GLCryStAl, their convergence speed is generally much slower than that of GLCryStAl.

**Table 6.** Friedman analysis results.



**Figure 2.** *Cont*.

**Figure 2.** Convergence curve of each algorithm.

#### **5. Optimization Engineering Example Using GLCryStAl**

#### *5.1. Using GLCryStAl to Optimize Pressure Vessel Design Problem*

The design of pressure vessel is a classical and important problem in practical engineering projects. The structure of the pressure vessel is shown in Figure 3, which consists of a cylindrical container and two hemispherical containers. In this optimization problem, there are four key variables, which are *Ts*, *Th*, *R* and *L*. *Ts* denotes the thickness of the shell of the cylindrical container, *Th* denotes the thickness of the hemispheric container lid, *R* is the radius inside the hemispherical container and *L* is the length of the cylinder container. These four variables can be expressed as the following equation when using algorithms to optimize the pressure vessel design problem.

$$\mathbf{x} = \begin{pmatrix} \mathbf{x}\_1, \mathbf{x}\_2, \mathbf{x}\_3, \mathbf{x}\_4 \end{pmatrix}^T = \begin{pmatrix} T\_s, T\_h, \mathbf{R}, L \end{pmatrix}^T \tag{20}$$

**Figure 3.** Pressure vessel structure diagram.

In this optimization problem, we use heuristic algorithm to regulate these four variables, so as to minimize the sum of material cost, forming cost and welding cost of the pressure vessel, which is transformed into the problem of finding the minimum of objective function with constraints.

The objective function of the pressure vessel design optimization problem is as follows:

$$\begin{array}{ll} \min f\left(\stackrel{\rightarrow}{\mathbf{x}}\right) = 0.6224 \mathbf{x}\_1 \mathbf{x}\_3 \mathbf{x}\_4 + 1.7781 \mathbf{x}\_2 \mathbf{x}\_3^2 + 3.1661 \mathbf{x}\_1 \mathbf{^2} \mathbf{x}\_4 + 19.84 \mathbf{x}\_1 \mathbf{^2} \mathbf{x}\_3; \\ \qquad \text{s.t.} \quad \mathbf{g}\_1(\mathbf{x}) = -\mathbf{x}\_1 + 0.0193 \mathbf{x}\_3 \le 0; \\ \qquad \text{g}\_2(\mathbf{x}) = -\mathbf{x}\_2 + 0.00954 \mathbf{x}\_3 \le 0; \\ \qquad \text{g}\_3(\mathbf{x}) = -\pi x\_3 \mathbf{x}\_4^2 \mathbf{x}\_4 - \frac{4}{3} \pi x\_3^3 + 1296000 \le 0; \\ \qquad \text{g}\_4(\mathbf{x}) = \mathbf{x}\_4 - 240 \le 0; \\ 1 \le \mathbf{x}\_1, \mathbf{x}\_2 \le 99, 10 \le \mathbf{x}\_3, \mathbf{x}\_4 \le 200 \end{array} \tag{21}$$

To verify the effectiveness of GLCryStAl in pressure vessel design, this paper selects PSO, WOA, GJO, TSA, DBO and CryStAl to compare with GLCryStAl, and runs each algorithm 10 times. The population size of all algorithms is 30, and the maximum number of iterations *t*max = 1000. The specific results are listed in Tables 8 and 9.

**Table 8.** Total cost of six algorithms for optimizing pressure vessel design problems.


**Table 9.** The best results of six algorithms.


It is clear from the above two tables that the total cost calculated by GLCryStAl is the smallest in the pressure vessel optimization design problem. In addition, the Std of GLCryStAl is within an acceptable range, which proves from another aspect that GLCryStAl has excellent stability when solving constrained engineering design optimization problems.

#### *5.2. Optimizing the Design of Tension/Compression Spring Using GLCryStAl*

To fully prove the feasibility and effectiveness of the GLCryStAl algorithm in engineering optimization problems, this paper applies the GLCryStAl algorithm to the optimization design problem of a tension/compression spring. A schematic of the spring is shown in Figure 4. This optimization problem is to select the most appropriate wire diameter (D), the average coil diameter (L) and the number of effective coils (P) under a series of specific constraints, so as to minimize the weight of the spring. In this paper, the three variables D, L and P are represented as *x*1, *x*<sup>2</sup> and *x*3. The mathematical modeling of the optimization problem in this section is as follows:

$$\begin{array}{rl} \min f\left(\stackrel{\rightarrow}{\mathbf{x}}\right) = (\mathbf{x}\_{3} + 2)\mathbf{x}\_{2}\mathbf{x}\_{1}^{2};\\ \text{s.t.} & \mathbf{g}\_{1}(\mathbf{x}) = 1 - \frac{\mathbf{x}\_{1}^{3}\mathbf{x}\_{3}}{71785\mathbf{x}\_{1}^{4}} \le 0;\\ & \mathbf{g}\_{2}(\mathbf{x}) = \frac{4\mathbf{x}\_{2}^{2} - \mathbf{x}\_{1}\mathbf{x}\_{2}}{12566\left(\mathbf{x}\_{2}\mathbf{x}\_{1}^{3} - \mathbf{x}\_{1}^{4}\right)} + \frac{1}{5108\mathbf{x}\_{1}^{2}} - 1 \le 0;\\ & \mathbf{g}\_{3}(\mathbf{x}) = 1 - \frac{140.45\mathbf{x}\_{1}}{\mathbf{x}\_{2}^{2}\mathbf{x}\_{3}} \le 0;\\ & \mathbf{g}\_{4}(\mathbf{x}) = \frac{\mathbf{x}\_{1} + \mathbf{x}\_{2}}{1.5} - 1 \le 0;\\ & 0.05 \le \mathbf{x}\_{1} \le \mathbf{2}, 0.25 \le \mathbf{x}\_{2} \le 1.3, 2 \le \mathbf{x}\_{3} \le 15 \end{array} \tag{22}$$

**Figure 4.** Schematic diagram of tension/compression spring design.

To evaluate the effectiveness of GLCryStAl in the design of tension/compression spring, a comparative experiment is designed. PSO, WOA, GJO, TSA, DBO and CryStAl are selected to compare with GLCryStAl, and the results are listed in Tables 10 and 11. In this comparison experiment, each algorithm runs 10 times independently. The population size of each algorithm is 30, and the maximum number of iterations *t*max = 1000.

**Table 10.** Comparison results of six algorithms in spring design problem.


**Table 11.** The best results of six algorithms.


From the experimental results, in the optimization results of all algorithms, the mean value obtained by GLCryStAl is second only to the mean value obtained by GJO. However, from another point of view, the best value of spring weight optimized by the GLCryStAl algorithm is smaller than that of all the competitors. This proves that the GLCryStAl algorithm proposed in this paper is feasible and effective in the optimization design problem of a tension/compression spring.

#### **6. Discussion of GLCryStAl**

CryStAl is a heuristic algorithm with a simple structure and no need to set hyperparameters. This paper uses Levy operator and golden sine operator to make targeted optimization based on some subsidies of the original CryStAl algorithm. Firstly, this paper uses the golden sine operator to optimize the candidate solution update equation in CryStAl. The golden sine operator has excellent ergodicity to speed up the convergence of the algorithm. Secondly, this paper uses the levy flight operator to perturb the candidate solution update method of the CryStAl algorithm. By using the method of combining the long and short steps of the operator for optimization, the algorithm is effectively prevented from being attracted by the local optimal value during execution. The excellent optimization capability of GLCryStAl is demonstrated by comparison with various competitive algorithms. A series of experiments have proved the effectiveness of GLCryStAl from multiple viewpoints, which strongly indicates that GLCryStAl has a wide range of engineering applications.

In a series of function test experiments, GLCryStAl has higher solution accuracy than other competitors in 85% of classical benchmark functions. GLCryStAl has a higher Std value than other competitors in 76% of classical functions, which proves that the accuracy of GLCryStAl is not easily affected by random factors. In the comparison of CEC2017 benchmark functions, although all algorithms cannot calculate the theoretical optimal value, GLCryStAl can calculate a more accurate solution in a limited number of executions. The comparison results of a series of functions are analyzed by statistical methods. GLCryStAl achieved the smallest rank mean in the Friedman analysis experiment, and the *p*-value in the Wilcoxon analysis experiment is basically less than 0.05 and close to 0. These statistical analyses prove that the two operators proposed in this paper have significant improvement effects on CryStAl. Applying GLCryStAl to the pressure vessel design problem and the tension/compression spring design problem, compared with other competitors, GLCryStAl can calculate the minimum cost pressure vessel design and the minimum weight stretch/compression spring design. It can be proven from a series of experiments in this paper that the optimization performance of GLCryStAl is significantly improved compared with the original CryStAl algorithm, but the performance of GLCryStAl in solving some multi-peak complex problems still needs to be improved, which is also a major research direction in our future.

#### **7. Conclusions**

Focusing on the problem of the crystal structure algorithm being easily attracted by local extremum and the solution accuracy not being high enough, GLCryStAl is proposed. In GLCryStAl, the golden sine operator and Levy operator are applied to modify the update strategy of the four candidate solutions in the crystal structure. This improvement can effectively prevent GLCryStAl from being attracted by local extreme values in the optimization process, and the optimization speed of GLCryStAl is significantly accelerated. In this paper, 10 classical benchmark functions and eight CEC2017 test functions are applied to design a series of comparison experiments with the latest algorithms and our improved algorithm. When solving low-dimensional functions, GLCryStAl can calculate the theoretical optimal value of the function in *F*1–*F*<sup>4</sup> and *F*7–*F*9, and GLCryStAl can maintain the minimum standard deviation in functions other than *F*<sup>5</sup> and *F*6. When solving high-dimensional functions, GLCryStAl obtains theoretical optimal values in seven functions. It can be concluded from the experimental results that the optimization capability of GLCryStAl is obviously stronger. In addition, the experimental data of the six algorithms were analyzed by Wilcoxon and Friedman

method. The statistical results show that the rank mean of GL is only 1.7, which indicates that GLCryStAl algorithm is superior to other competitors.

Finally, this paper uses GLCryStAl to optimize two practical engineering problems. In the first engineering problem, GLCryStAl is applied to the optimal design of pressure vessels. GLCryStAl achieved the best performance in this experiment. In the second engineering problem, GLCryStAl is applied to optimize the stretch/compression spring design. In this experiment, the optimal spring weight designed by GLCryStAl is second only to that of GJO. These two design problems fully demonstrate the feasibility and effectiveness of GLCryStAl in optimizing practical engineering problems.

**Author Contributions:** Conceptualization, W.W. and J.T.; methodology, W.W.; software, D.W.; validation, W.W.; formal analysis, D.W.; investigation, W.W.; resources, W.W.; data curation, W.W.; writing—original draft preparation, W.W.; supervision, J.T.; All authors have read and agreed to the published version of the manuscript.

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

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**

