Created
March 22, 2021 15:00
-
-
Save daanklijn/73f729a4279c7852a12abce31c2d9e67 to your computer and use it in GitHub Desktop.
Bit flip mutation and 1-point crossover LaTeX Tikz visualization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\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}, | |
]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Bit flip | |
\foreach \x/\y in {0/1, 0.5/1,1/0,1.5/1,2/1,2.5/0,3/0,4/1}{ | |
\node[box] at (\x,0){\y}; | |
\node[box] at (\x+9,0){\y}; | |
} | |
\node[dbox] at (3.5,0){1}; | |
\node[dbox] at (3.5 + 9,0){0}; | |
\draw [->] (5,0) -- node [text width=1.5cm,midway,above] {Bit flip} (8,0); | |
% 1 - point crossover | |
\foreach \x/\y in {0/1, 0.5/1,1/0,1.5/1,2/1,2.5/0,3/0,3.5/1,4/1}{ | |
\node[box] at (\x,-2){\y}; | |
} | |
\foreach \x/\y in {0/0, 0.5/1,1/1,1.5/0,2/1,2.5/1,3/0,3.5/0,4/0}{ | |
\node[dbox] at (\x,-3){\y}; | |
} | |
\foreach \x/\y in {0/1, 0.5/1,1/0,1.5/1,2/1,2.5/0}{ | |
\node[box] at (\x+9,-2){\y}; | |
} | |
\foreach \x/\y in {3/0,3.5/0,4/0}{ | |
\node[dbox] at (\x+9,-2){\y}; | |
} | |
\foreach \x/\y in {0/0, 0.5/1,1/1,1.5/0,2/1,2.5/1}{ | |
\node[dbox] at (\x+9,-3){\y}; | |
} | |
\foreach \x/\y in {3/0,3.5/1,4/1}{ | |
\node[box] at (\x+9,-3){\y}; | |
} | |
\draw [->] (5,-2.5) -- node [text width=2.7cm,midway,above] {1-point crossover} (8,-2.5); | |
\end{tikzpicture} | |
\caption{Visualization of the bit-flip and 1-point crossover operators.} | |
\label{bitflip} | |
\end{figure} |
Author
daanklijn
commented
Mar 22, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment