## 4 Differential Evolution
### Measuring the Fitness of Individuals  
When an optimization problem includes neither equality nor inequality constraints, each individual's fitness in the DE can be measured in terms of the value of the objective function. For minimization, the smaller the value of the objective function evaluated on an individual, the fitter the individual is. At the other extreme, where the optimization problem is subject to such constraints, the fitness must also consider the fulfillment of the constraints. One of the simplest and most efficient methods for comparing the fitness of two different solutions in terms of feasibility (compliance with equality and inequality constraints) and optimality (minimization of the objective function) is known as [PERSON]'s rules [38]. For two distinct solutions \(\vec{p}_{1}\) and \(\vec{p}_{2}\), these rules state the following:  
1. If \(\vec{p}_{1}\) is feasible and \(\vec{p}_{2}\) is unfeasible, then \(\vec{p}_{1}\) is fitter, i.e., \(fit(\vec{p}_{1})>fit(\vec{p}_{2})\). When the contrary occurs, i.e., \(\vec{p}_{1}\) is unfeasible and \(\vec{p}_{2}\) is feasible, then \(fit(\vec{p}_{1})<fit(\vec{p}_{2})\);
2. If both \(\vec{p}_{1}\) and \(\vec{p}_{2}\) are feasible, the solution with the smaller objective function value is fitter (for minimization problems); \begin{table}
\begin{tabular}{l l} \hline \hline
**Nomenclature** & **Variant** \\ \hline best/b/bin & \(\vec{u}_{i,j}=\left\{\begin{array}{ll}\vec{p}_{n_{\text{rand}},j}+F\cdot \sum_{k=1}^{b}\left(\vec{p}_{\vec{x}_{j},j}-\vec{p}_{\vec{r}_{i,j}}\right)& \textbf{if}\ rand(0,1)<CR\ \textbf{or}\ j=j_{\text{rand}}\\ \vec{p}_{i,j}&\textbf{otherwise}\\ \end{array}\right.\) \\ best/b/exp & \(\vec{u}_{i,j}=\left\{\begin{array}{ll}\vec{p}_{n_{\text{rand}},j}+F\cdot \sum_{k=1}^{b}\left(\vec{p}_{\vec{x}_{j},j}-\vec{p}_{\vec{r}_{i,j}}\right)& \textbf{if}\ rand(0,1)<CR\ \textbf{or}\ j=j_{\text{rand}}\\ \vec{p}_{i,j}&\textbf{otherwise}\\ \end{array}\right.\) \\ current-to-best/b & \(\vec{u}_{i}=\vec{p}_{i}+K\cdot(\vec{p}_{n_{\text{rand}}}-\vec{p}_{i})+F\cdot \sum_{k=1}^{b}\left(\vec{p}_{\vec{x}_{k}}-\vec{p}_{\vec{r}_{i}}\right)\) \\ current-to-rand/b & \(\vec{u}_{i}=\vec{p}_{i}+K\cdot(\vec{p}_{n_{\text{rand}}}-\vec{p}_{i})+F\cdot \sum_{k=1}^{b}\left(\vec{p}_{\vec{x}_{j}}-\vec{p}_{\vec{r}_{i}}\right)\) \\ current-to-rand/b & \(\vec{u}_{i,j}=\left\{\begin{array}{ll}\vec{p}_{i,j}+K\cdot\left(\vec{p}_{n_{ \text{rand}}}-\vec{p}_{i,j}\right)+F\cdot\sum_{k=1}^{b}\left(\vec{p}_{\vec{x}_{ j},j}-\vec{p}_{\vec{r}_{i,j}}\right)&\textbf{if}\ rand(0,1)<CR\ \textbf{or}\ j=j_{\text{rand}}\\ \vec{p}_{i,j}&\textbf{otherwise}\\ \end{array}\right.\) \\ rand/b/bin & \(\vec{u}_{i,j}=\left\{\begin{array}{ll}\vec{p}_{n_{\text{rand}},j}+F\cdot \sum_{k=1}^{b}\left(\vec{p}_{\vec{x}_{j},j}-\vec{p}_{\vec{r}_{i,j}}\right)& \textbf{if}\ rand(0,1)<CR\ \textbf{or}\ j=j_{\text{rand}}\\ \vec{p}_{i,j}&\textbf{otherwise}\\ \end{array}\right.\) \\ rand/b/exp & \(\vec{u}_{i,j}=\left\{\begin{array}{ll}\vec{p}_{n_{\text{rand}},j}+F\cdot \sum_{k=1}^{b}\left(\vec{p}_{\vec{x}_{j},j}-\vec{p}_{\vec{r}_{i,j}}\right)& \textbf{from}\ rand(0,1)<CR\ \textbf{or}\ j=j_{\text{rand}}\\ \vec{p}_{i,j}&\textbf{otherwise}\\ \end{array}\right.\) \\ rand/2/dir & \(\vec{u}_{i}=\left\{\begin{array}{ll}\vec{p}_{n_{\text{rand}},j}+F\cdot \sum_{k=1}^{b}\left(\vec{p}_{\vec{x}_{k}}-\vec{p}_{\vec{r}_{k}}\right)& \textbf{otherwise}\\ \end{array}\right.\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Some of the most commonly used variants of Differential Evolution. 3. If both \(\vec{p}_{1}\) and \(\vec{p}_{2}\) are unfeasible, the solution with the smaller value of the constraint violation sum is fitter. ```
Input: Number of generations (\(G_{max}\)), Population size (\(NP\)), Crossover Rate (\(CR\)), Scaling factor (\(F\)). Output: Best individual (\(\vec{p}_{best}\)). 1\(G\gets 0\)
2 Generate an initial population \(P\) with \(NP\) random individuals.