### Differential Evolution

##### Description

Differential Evolution (DE) is an evolutionary computation variant designed primarily for multi- dimensional real-valued spaces, and which introduces two new twists. First, children must compete directly against their immediate parents for inclusion in the population. Second, DE determines the size of Mutates largely based on the current variance in the population. If the population is spread out, Mutate will make major changes. If the population is condensed in a certain region, Mutates will be small.

Crossover can be anything: but one common approach is to do a uniform crossover, but guarantee that at least one gene from Qi (the gene is chosen at random) survives in Pi.

##### Parameters

$FES = d * 20000$, $N = 20$ and $CR = 0.8$

##### Pseudo Code
\begin{algorithm}
\caption{DE Algorithm}
\begin{algorithmic}
\STATE $\alpha \gets \text{mutation rate}$ \COMMENT{Commonly between 0.5 and 1.0, higher is more explorative}
\STATE $\textit{popsize} \gets \text{desired population size}$
\STATE $\textit{P} \gets \text{[]}$ \COMMENT{Empty population (it’s convenient here to treat it as a vector), of length $\textit{popsize}$}
\STATE $\textit{Q} \gets \text{[]}$ \COMMENT{The parents. Each parent $Q_i$ was responsible for creating the child $P_i$}
\FOR{$\textit{i}$ from one to $\textit{popsize}$}
\STATE $P_i \gets \text{new random individual}$
\ENDFOR
\STATE $\textit{Best} \gets \text{Null}$
\WHILE{$\textit{Best}$ is the ideal solution or we ran out of time}
\FOR{each individual $P_i$ $\epsilon$ $P$}
\STATE AssessFitness($P_i$)
\IF{$Q$ \not $\textbf{empty}$ and Fitness($Q_i$) > Fitness($P_i$)}
\STATE $P_i \gets Q_i$ \COMMENT{Retain the parent, throw away the kid}
\ENDIF
\IF{$\textit{Best}$ = $\text{Null}$ or Fitness($\textit{Best}$) > Fitness($P_i$)}
\STATE $\textit{Best} \gets P_i$
\ENDIF
\ENDFOR
\STATE $Q \gets P$
\FOR{each individual $Q_i$ $\epsilon$ $Q$} \COMMENT{Retain the parent, throw away the kid}
\STATE $\overrightarrow{a} \gets \text{a copy of an individual other than } Q_i \text{, chosen at random with replacement from } Q$
\STATE $\overrightarrow{b} \gets \text{a copy of an individual other than } Q_i \text{ or } \overrightarrow{a} \text{, chosen at random with replacement from } Q$
\STATE $\overrightarrow{c} \gets \text{a copy of an individual other than } Q_i,\overrightarrow{a} \text{ or } \overrightarrow{b} \text{, chosen at random with replacement from } Q$
\STATE $\overrightarrow{d} = \overrightarrow{a} + \alpha (\overrightarrow{b} - \overrightarrow{c})$
\STATE $P_i \gets \text{one child from }Crossover(\overrightarrow{d}, Copy(Q_i))$
\ENDFOR
\ENDWHILE
\RETURN $\textit{Best}$
\end{algorithmic}
\end{algorithm}