# GBUO: \"The Good, the Bad, and the Ugly\" Optimizer
## 2 \"The Good, the Bad, and the Ugly\" Optimizer (GBUO)
\[x_{i,nbb}^{d}=x_{i}^{d}+rand\times\left(2\times x_{i}^{d}-Bad^{d}\right), \tag{8}\]  
\[X_{i}=\left\{ \begin{array}{cc}X_{i}^{nbb},&OF_{i}^{nbb}\leq OF_{i}\\ &X_{i},\ else\end{array} \right., \tag{9}\]  
Here, \(x_{i,nbb}^{d}\) is the new value for \(d^{\prime}\)th variable of \(i^{\prime}\)th member updated based on the bad member, \(X_{i}^{nbb}\) is the new status of \(i^{\prime}\)th member updated based on the bad member, and \(OF_{i}^{nbb}\) is the corresponding value of the objective function. The algorithm population update is modeled based on the ugly member in Equations (10) and (11). \[x_{i,nbu}^{d}=x_{i}^{d}+0.2\times rand\times\left(Ugly^{d}-x_{i}^{d}\right) \times sign(OF_{u}-OF_{i}), \tag{10}\]  
\[X_{i}=\left\{ \begin{array}{cc}X_{i}^{nbu},&OF_{i}^{nbu}\leq OF_{i}\\ &X_{i},\ else\end{array} \right., \tag{11}\]  
Here, \(x_{i,nbu}^{d}\) is the new value for \(d^{\prime}\)th variable of \(i^{\prime}\)th member updated based on the ugly member, \(sign\) denotes the sign function, \(X_{i}^{nbu}\) represents the new status of \(i^{\prime}\)th member updated based on the ugly member, and \(OF_{i}^{nbu}\) is the corresponding value of the objective function. After updating all population members based on the mentioned three phases and storing the best quasi-optimal solution, the algorithm starts the next iteration and the population members are updated by using Equations (3)-(11) and according to the new values of the objective functions. This process is repeated until the algorithm is stopped. The pseudo-code of the proposed optimizer is presented in Algorithm 1. Also, various steps of the proposed GBUO are shown as a flowchart in Figure 1.  
``` Start. 1. Input information of optimization problem. 2. Set parameters. 3. Create an initial population. 4. Calculate objective function. 5. For iteration = 1:\(T\) \(T\): maximum number of iteration
6. Update the Good, the Bad, and the \(Ugly\). Equations (3)-(5). 7. For \(i\)=1:\(N\): number of population members
8. Update \(X_{i}\) based on the Good. Equations (6) and (7). 9. Update \(X_{i}\) based on the Bad. Equations (8) and (9). 10. Update \(X_{i}\) based on the \(Ugly\). Equations (10) and (11). 11. End for \(i\). 12. Save the best quasi-optimal solution in this iteration. 13. End for iteration. 14. Output the best quasi-optimal solution of the objective function found by GBUO. 15. ## 3 Simulation Study and Results

This section evaluates GBUO performance for optimization problem resolution. For this purpose, the proposed optimizer is implemented on a set of twenty-three standard objective functions. Figure 1: Flowchart of “the good, the bad, and the ugly” optimizer (GBUO). ### Algorithms Used for Comparison and Objective Functions

The results of other well-known optimization algorithms are compared with those obtained by GBUO in order to further evaluate its capability for solving optimization problems. These optimization algorithms are genetic algorithm (GA), particle swarm optimization (PSO), gravitational search algorithm (GSA), teaching-learning-based optimization (TLBO), grey wolf optimizer (GWO), grasshopper optimization algorithm (GOA), spotted hyena optimizer (SHO), and marine predators algorithm (MPA). The values used for the main controlling parameters of the comparative algorithms are specified in Table 2.

The proposed optimizer's performance and the eight optimization algorithms are evaluated for optimizing twenty-three different objective functions. These objective functions are classified into three types including unimodal, multimodal, and fixed-dimension multimodal functions. Information on these objective functions is provided in Appendix A, Tables A2, A3 and A1. The simulation and the algorithms have been implemented in the Matlab R2020a version, run in Microsoft Windows 10 with 64 bits on a Core i-7 processor with 2.40 GHz and 6 GB memory. The average (Ave) and standard deviation (std) of the best obtained optimal solution until the last iteration are computed as performance evaluation metrics.