# GBUO: \"The Good, the Bad, and the Ugly\" Optimizer
## 2 \"The Good, the Bad, and the Ugly\" Optimizer (GBUO)  
In this section, the design steps of the \"the good, the bad, and the ugly\" optimizer (GBUO) are explained and modeled. In GBUO, search agents scan the problem search space under the influence of three specific members of the population. Each population member is a proposed solution to the optimization problem that provides specific valuesfor the problem variables. Thus, the population members of an algorithm can be modeled as a matrix. The population matrix of the algorithm is specified in Equation (1). \[X=\left[ \begin{array}{c}X_{1}\\ \vdots\\ X_{i}\\ \vdots\\ X_{N}\end{array} \right]_{N\times m}=\left[ \begin{array}{cccc}x_{1}^{1}& \cdots&x_{1}^{d}&\cdots&x_{1}^{m}\\ \vdots&\ddots&\vdots&&\vdots\\ x_{i}^{1}&\cdots&x_{i}^{d}&\cdots&x_{i}^{m}\\ \vdots&&\vdots&\ddots&\vdots\\ x_{N}^{1}&\cdots&x_{N}^{d}&\cdots&x_{N}^{m}\end{array} \right]_{N\times m}, \tag{1}\]  
Here, \(X\) is the population matrix, \(X_{i}\) is the \(i^{\prime}\)th population member, \(x_{i}^{d}\) is the value for \(d^{\prime}\)th variable specified by \(i^{\prime}\)th member, \(N\) is the number of population members, and \(m\) is the number of variables. A specific value is calculated for each population member for the objective function given that each population member represents the proposed values for the optimization problem variables. The values of the objective function are specified as a matrix in Equation (2). \[OF=\left[ \begin{array}{c}OF_{1}(X_{1})\\ \vdots\\ OF_{i}(X_{i})\\ \vdots\\ OF_{N}(X_{N})\end{array} \right]_{N\times 1}, \tag{2}\]  
Here, \(OF\) is the objective function matrix and \(OF_{i}(X_{i})\) is the value of the objective function for \(i^{\prime}\)th population member. The objective function's value is an indicator of whether a solution is good or bad. Based on these values, it can be determined which member provides the best quasi-optimal solution and provides the worst quasi-optimal solution. In GBUO, the algorithm's population is updated according to three members entitled good, bad, and ugly. The good is a member of the population that is the best quasi-optimal solution, and the bad is a member of the population that has presented the worst quasi-optimal solution according to the value of the objective function. Ugly is a population member that leads the algorithm's population to situations in the opposite direction. In this challenging phase, those situations of the search space that offer suitable quasi-optimal solutions are discovered. These three main members are defined in the proposed optimizer using Equations (3)-(5). \[Good=X_{g}|OF_{g}=minimum\;of\;OF\;matrix, \tag{3}\]  
\[Bad=X_{b}|OF_{b}=maximum\;of\;OF\;matrix, \tag{4}\]  
\[Ugly=X_{u}\;and\;ue[1,2,\;\ldots,\;N-\{g,b\}], \tag{5}\]  
Here, \(Good\) is the good member, \(Bad\) is the bad member, and \(Ugly\) is the ugly member selected randomly. In each algorithm iteration, the position of the population members is updated in three following phases. In the first phase, the population moves towards the good member. In the second phase, the population distances itself from the bad member. Finally, in the third phase, the ugly member leads the population to positions contrary to the population's movement. The concepts expressed in these three phases are mathematically simulated using Equations (6)-(11). The algorithm population update is modeled based on the good member in Equations (6) and (7). \[x_{i,ugy}^{d}=x_{i}^{d}+rand\times\left(Good^{d}-2\times x_{i}^{d}\right), \tag{6}\]\[X_{i}=\left\{ \begin{array}{cc}X_{i}^{nbg},&OF_{i}^{nbg}\leq OF_{i}\\ &X_{i},\ else\end{array} \right., \tag{7}\]  
Here, \(x_{i,nbg}^{d}\) is the new value for the \(d^{\prime}\)th variable of \(i^{\prime}\)th member updated based on the good member, \(X_{i}^{nbg}\) is the new status of \(i^{\prime}\)th member updated based on the good member, and \(OF_{i}^{nbg}\) is the corresponding value of the objective function. The algorithm population update is carried out based on the bad member using Equations (8) and (9).