Skip to content

Instantly share code, notes, and snippets.

@daanklijn
Created March 23, 2021 15:57
Show Gist options
  • Save daanklijn/5051d14e07a1f8e824d27e2daac445e1 to your computer and use it in GitHub Desktop.
Save daanklijn/5051d14e07a1f8e824d27e2daac445e1 to your computer and use it in GitHub Desktop.
Evolution Strategies Recombination LaTeX TiKz
\begin{figure}[h]
\centering
\captionsetup{justification=centering}
\begin{tikzpicture}
[%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
box/.style={rectangle,draw=black, thick, minimum size=0.5cm},
dbox/.style={rectangle,draw=black, thick, minimum size=0.5cm, fill=black!20},
gbox/.style={rectangle,draw=black, thick, minimum size=0.5cm, fill=black!5},
]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1 - Discrete
\foreach \x/\y in {0/1, 0.5/4, 1/2, 1.5/3, 2/8, 2.5/2, 3/3, 3.5/2, 4/1}{
\node[box] at (\x,0){\y};
}
\foreach \x/\y in {0/2, 0.5/5, 1/3, 1.5/4, 2/9, 2.5/3, 3/4, 3.5/3, 4/2}{
\node[dbox] at (\x,1){\y};
}
\foreach \x/\y in {0/1, 0.5/4, 1/2, 1.5/3, 2/8, 2.5/2, 3/3, 3.5/2, 4/1}{
\node[box] at (\x+9,0.5){\y};
}
\foreach \x/\y in {2.5/3,3.5/3,4/2}{
\node[dbox] at (\x+9,0.5){\y};
}
\draw [->] (5,0.5) -- node [text width=2.7cm,midway,above] {Discrete crossover} (8,0.5);
% 1 - Intermeidate
\foreach \x/\y in {0/1, 0.5/4, 1/2, 1.5/3, 2/8, 2.5/2, 3/3, 3.5/2, 4/1}{
\node[box] at (\x,-2){\y};
}
\foreach \x/\y in {0/2, 0.5/5, 1/3, 1.5/4, 2/9, 2.5/3, 3/4, 3.5/3, 4/2}{
\node[dbox] at (\x,-3){\y};
}
\foreach \x/\y in {0/1.5, 0.5/4.5, 1/2.5, 1.5/3.5, 2/8.5, 2.5/2.5, 3/3.5, 3.5/2.5, 4/1.5}{
\node[gbox] at (\x+9,-2.5){\footnotesize\y};
}
\draw [->] (5,-2.5) -- node [text width=3.4cm,midway,above] {Intermediate crossover} (8,-2.5);
\end{tikzpicture}
\caption{Visualization of the bit-flip and 1-point crossover operators.}
\label{es_recombination}
\end{figure}
@daanklijn
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment