# Reflection/Expansion

## Basic reflection/expansion (r0)

We combine four individuals, $x_{best}$, $x_{worst2}$, $w_{worst}$, and the current $x_i$ that has to be moved. The idea is that a move from $x_{worst}$ to $x_{worst2}$ is probably a good one, so, on the contrary, the same move applied to $x_{best}$ is probably a bad one, i.e. it tends to deteriorate the position. But on the other hand, it also gives a chance to escape from the attraction basin of $x_{best}$.

Of course, for a unimodal landscape, this is a waste of time, but for multimodal ones, it may be useful. Moreover, this move is not applied on all dimensions, but only on some of them, according to the probability estimated at the end of the selection phase. So, finally, the formulae to define the new point $x_e$ are, for each dimension $d$:

if ($rand(0,1)<p)$

$ x_{r,d}=x_{best,d}+(x_{worst2,d}-x_{worst,d})$

else

$ x_{r,d}=x_{i,d}$

If $x_{r}$ is better than $x_i$, decrease the population cost $$ C\leftarrow C-f(x_i)+f(x_r)$$

If $x_{r}$ is better than the best ever found (i.e. $Best$), set $Best=x_{r}$.

.