Description
The code above is a LaTeX document that uses the TikZ package to create a flowchart diagram. The diagram depicts the steps of an evolutionary algorithm, showing a population of individuals that are subject to various operations, including crossover, inversion, and mutation, and that undergo survivor selection to produce the next generation of parents. The diagram also shows that the algorithm starts with a random initialization and ends when a termination condition is met. The diagram includes various nodes with different styles and positions, as well as arrows connecting the nodes to indicate the flow of the algorithm. The nodes include a population, parents, and offspring, as well as nodes for random initialization and termination, with the latter node including a label that describes the specific termination condition used in the algorithm.
Keywords
tikz, arrows, shadows, positioning, nodes, font, styles, rectangle, draw, text width, centered, minimum height, drop shadow, fill, rounded corners, line, latex, termination, population, parents, offspring, random initialization, survivor selection, crossover, inversion, mutation, features, maximum features.
Source Code
\documentclass[margin=3pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows,shadows,positioning}
\tikzset{
frame/.style={
rectangle, draw,
text width=6em, text centered,
minimum height=4em,drop shadow,fill=yellow!40,
rounded corners,
},
line/.style={
draw, -latex',rounded corners=3mm,
}
}
\begin{document}
\begin{tikzpicture}[font=\small\sffamily\bfseries,very thick,node distance = 4cm]
\node [frame] (pop) {Population};
\node [above=2cm, text width=2cm, align=center, left of=pop] (init) {Random \\ Initialisation};
\node [below=2cm, text width = 2cm, align = center, left of=pop] (term) {Termination};
\node [frame, above=2cm, right of=pop] (parents) {Parents};
\node [frame, below=2cm, right of=pop] (off) {Offspring};
% termination condition label
\node [draw=none, text width=3cm, above right = -0.1cm and -1cm of term ] () {(unique features \\ less than $\frac{1}{3}$ of \\ maximum features)};
\path [line] (parents)
-- node[right,align=left,pos=.5] {Crossover\\[3mm]Inversion\\[3mm]Mutation}
(off);
\path [line] (init) |- (pop.170);
\path [line] (pop.190) -| (term);
\path [line] (off) -| node[below,pos=.25, align=center] {Survivor\\ selection}(pop);
\path [line] (pop) |- node[above,pos=.75, align=center] {Parents\\ selection}(parents);
\end{tikzpicture}
\end{document}