# Differential Evolution in Waveform Design for Wireless Power Transfer
## 3 Evolutionary Algorithms
### Differential Evolution  
The iterations in DE algorithm are called generations (\(g\)) and the termination criterion can be set by selecting a maximum number of generations (\(g_{max}\)). Alternatively, the termination criterion can be a maximum number of objective function evaluations (\(FE_{max}\)). The parameter vectors are called population vectors or individuals and are denoted by \(x_{i,g}\), where \(i=1,2,\ldots,NP\) and \(g=1,2,\ldots,g_{max}\). \(NP\) is called population size and it is one of the three control parameters of DE. Each vector \(x_{i,g}\) consists of \(D\) elements that correspond to the decision variables of the optimization problem and are denoted by \(x_{j,i,g}\), where \(j=1,2,\ldots,D\). Consequently, the dimensionality of the optimization problem is \(D\). The population vectors in generation \(g\) are usually organized in a population matrix denoted by \(\mathbf{P}_{x,g}\), which is given in (9). \[\mathbf{P}_{x,g}= \begin{bmatrix}\mathbf{x}_{1,g}\\ \vdots\\ \mathbf{x}_{NP,g}\end{bmatrix} = \begin{bmatrix}x_{1,1,g}&\cdots&x_{D,1,g}\\ \vdots&\ddots&\vdots\\ x_{1,NP,g}&\cdots&x_{D,NP,g}\end{bmatrix}  \tag{9}\]  
The first step in DE algorithm is the initialization of NP individuals. The population vectors of the first generation are initialized randomly inside the feasible search space. Consequently, when the decision variables are subject to some constraints, these constraints should be taken into account. After the initialization phase, the algorithm enters the main loop, which consists of three different operations called mutation, crossover, and selection. Mutation is the operation that generates mutant vectors. A mutant vector is created by perturbing one of the population vectors with the weighted difference of two others. In this way, DE exploits information from different individuals to direct the search. During mutation, each \(\mathbf{x}_{i,g}\) serves once as a target vector and a corresponding mutant vector \(\mathbf{v}_{i,g}\) is generated by:  
\[\mathbf{v}_{i,g}=\mathbf{y}_{i,g}+F\cdot(\mathbf{x}_{72,g}-\mathbf{x}_{73,g}) \tag{10}\]  
where \(\mathbf{y}_{i,g}\) is called the base vector. In the classic DE version it is \(\mathbf{y}_{i,g}=\mathbf{x}_{r1,g}\). Indices \(r1\), \(r2\) and \(r3\) are randomly chosen every time a mutant vector is generated, under the condition that \(r1,r2,r3\in\{1,2,\ldots,NP\}\) and \(r1\
eq r2\
eq r3\
eq i\). The scale factor (SF), denoted by \(F\), is one of the control parameters of DE. It is always \(>0\) and while there is no upper limit, it is rarely \(>1\)[23]. We should note that (10) describes the mutation strategy in the classic version of DE, but many other different mutation strategies have been introduced in the literature. Crossover is the operation responsible for the diversity enhancement of the population. During crossover, a new trial vector \(\mathbf{u}_{i,g}\) is generated for each target vector by combining some parameters of \(\mathbf{v}_{i,g}\) with some parameters of \(\mathbf{x}_{i,g}\). This operation is controlled by a control parameter called Crossover Rate (\(CR\)), which may take values in the range \([0,1]\). For the generation of a trial vector, a random number in the range \((0,1)\) is generated for each \(j\). If this number is smaller than or equal to \(CR\), the trial vector inherits its \(j\)th parameter from the corresponding mutant vector, otherwise, it retains the \(j\)th parameter of the target vector. Moreover, a random index \(j_{rand}\in\{1,2,\ldots,D\}\) is generated for each \(i\) and the new trial vector inherits its \(j\)th = \(j_{rand}\) parameter from the corresponding mutant vector. This is to ensure that \(\mathbf{u}_{i,g}\) takes at least one element from \(\mathbf{v}_{i,g}\). The crossover operation is described by:\[u_{j,i,g}= \begin{cases}v_{j,i,g}&\text{if }rand_{j}(0,1)\leq CR\text{ or }j=j_{rand}\\ x_{j,i,g}&\text{otherwise}\end{cases}  \tag{11}\]  
At this point, we should note that various other crossover strategies have been also introduced in the literature.