171 lines
11 KiB
TeX
171 lines
11 KiB
TeX
\hypertarget{classeo_algo_foundry_e_a}{}\doxysection{eo\+Algo\+Foundry\+EA$<$ E\+OT $>$ Class Template Reference}
|
|
\label{classeo_algo_foundry_e_a}\index{eoAlgoFoundryEA$<$ EOT $>$@{eoAlgoFoundryEA$<$ EOT $>$}}
|
|
|
|
|
|
{\ttfamily \#include $<$eo\+Algo\+Foundry\+E\+A.\+h$>$}
|
|
|
|
|
|
|
|
Inheritance diagram for eo\+Algo\+Foundry\+EA$<$ E\+OT $>$\+:
|
|
\nopagebreak
|
|
\begin{figure}[H]
|
|
\begin{center}
|
|
\leavevmode
|
|
\includegraphics[width=336pt]{classeo_algo_foundry_e_a__inherit__graph}
|
|
\end{center}
|
|
\end{figure}
|
|
|
|
|
|
Collaboration diagram for eo\+Algo\+Foundry\+EA$<$ E\+OT $>$\+:
|
|
\nopagebreak
|
|
\begin{figure}[H]
|
|
\begin{center}
|
|
\leavevmode
|
|
\includegraphics[width=350pt]{classeo_algo_foundry_e_a__coll__graph}
|
|
\end{center}
|
|
\end{figure}
|
|
\doxysubsection*{Public Member Functions}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
\mbox{\hyperlink{classeo_algo_foundry_e_a_a1dc8e4bdb9522440292bdf946ba1ac45}{eo\+Algo\+Foundry\+EA}} (\mbox{\hyperlink{classeo_pop_eval_func}{eo\+Pop\+Eval\+Func}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \&eval, size\+\_\+t max\+\_\+gen)
|
|
\item
|
|
void \mbox{\hyperlink{classeo_algo_foundry_e_a_a96535b5dd4f2a5c588a079bc1c0c95e0}{operator()}} (\mbox{\hyperlink{classeo_pop}{eo\+Pop}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \&pop)
|
|
\item
|
|
std\+::string \mbox{\hyperlink{classeo_algo_foundry_e_a_ae18f36338d80bbd2627f0b3b9d19a867}{name}} ()
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a25ffcdb0c7bfd9dce17381d0c7e5f8a6}\label{classeo_algo_foundry_e_a_a25ffcdb0c7bfd9dce17381d0c7e5f8a6}}
|
|
\mbox{\hyperlink{classeo_continue}{eo\+Continue}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \& {\bfseries continuator} ()
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a98ee68bf85edb25f01fba31ea066b8a5}\label{classeo_algo_foundry_e_a_a98ee68bf85edb25f01fba31ea066b8a5}}
|
|
\mbox{\hyperlink{classeo_quad_op}{eo\+Quad\+Op}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \& {\bfseries crossover} ()
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a0dd3215122afe9ffd4e17512f6cb2e75}\label{classeo_algo_foundry_e_a_a0dd3215122afe9ffd4e17512f6cb2e75}}
|
|
\mbox{\hyperlink{classeo_mon_op}{eo\+Mon\+Op}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \& {\bfseries mutation} ()
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a4e639ad5b91fec261be3890f24b87e26}\label{classeo_algo_foundry_e_a_a4e639ad5b91fec261be3890f24b87e26}}
|
|
\mbox{\hyperlink{classeo_select_one}{eo\+Select\+One}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \& {\bfseries selector} ()
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_abb961d39e42cb3dfc6947b491218894a}\label{classeo_algo_foundry_e_a_abb961d39e42cb3dfc6947b491218894a}}
|
|
\mbox{\hyperlink{classeo_replacement}{eo\+Replacement}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \& {\bfseries replacement} ()
|
|
\end{DoxyCompactItemize}
|
|
\doxysubsection*{Public Attributes}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a294d8f551fda4e363c5b14754865e297}\label{classeo_algo_foundry_e_a_a294d8f551fda4e363c5b14754865e297}}
|
|
\mbox{\hyperlink{classeo_operator_foundry}{eo\+Operator\+Foundry}}$<$ \mbox{\hyperlink{classeo_continue}{eo\+Continue}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ $>$ {\bfseries continuators}
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a0fdc5204b6a844585d33e54513156f5e}\label{classeo_algo_foundry_e_a_a0fdc5204b6a844585d33e54513156f5e}}
|
|
\mbox{\hyperlink{classeo_operator_foundry}{eo\+Operator\+Foundry}}$<$ \mbox{\hyperlink{classeo_quad_op}{eo\+Quad\+Op}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ $>$ {\bfseries crossovers}
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a60f5dd28000e7501c8bf71c5590efa28}\label{classeo_algo_foundry_e_a_a60f5dd28000e7501c8bf71c5590efa28}}
|
|
\mbox{\hyperlink{classeo_operator_foundry}{eo\+Operator\+Foundry}}$<$ \mbox{\hyperlink{classeo_mon_op}{eo\+Mon\+Op}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ $>$ {\bfseries mutations}
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_acf95280ad9790adff231ea3575c13f80}\label{classeo_algo_foundry_e_a_acf95280ad9790adff231ea3575c13f80}}
|
|
\mbox{\hyperlink{classeo_operator_foundry}{eo\+Operator\+Foundry}}$<$ \mbox{\hyperlink{classeo_select_one}{eo\+Select\+One}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ $>$ {\bfseries selectors}
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a8867ecc05c1a92085c7fdd0efe12c15a}\label{classeo_algo_foundry_e_a_a8867ecc05c1a92085c7fdd0efe12c15a}}
|
|
\mbox{\hyperlink{classeo_operator_foundry}{eo\+Operator\+Foundry}}$<$ \mbox{\hyperlink{classeo_replacement}{eo\+Replacement}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ $>$ {\bfseries replacements}
|
|
\end{DoxyCompactItemize}
|
|
\doxysubsection*{Protected Attributes}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_aa77ebc9383dee6571b4388c393549c97}\label{classeo_algo_foundry_e_a_aa77ebc9383dee6571b4388c393549c97}}
|
|
\mbox{\hyperlink{classeo_pop_eval_func}{eo\+Pop\+Eval\+Func}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \& {\bfseries \+\_\+eval}
|
|
\item
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a67f291e20ee1983846d3580aa9a9cdd3}\label{classeo_algo_foundry_e_a_a67f291e20ee1983846d3580aa9a9cdd3}}
|
|
const size\+\_\+t {\bfseries \+\_\+max\+\_\+gen}
|
|
\end{DoxyCompactItemize}
|
|
\doxysubsection*{Additional Inherited Members}
|
|
|
|
|
|
\doxysubsection{Detailed Description}
|
|
\subsubsection*{template$<$class E\+OT$>$\newline
|
|
class eo\+Algo\+Foundry\+E\+A$<$ E\+O\+T $>$}
|
|
|
|
A class that assemble an \mbox{\hyperlink{classeo_easy_e_a}{eo\+Easy\+EA}} on the fly, given a combination of available operators.
|
|
|
|
The foundry should first be set up with sets of operators for the main modules of an EA\+: continuators, crossovers, mutations, selection and replacement operators.
|
|
|
|
This is done through public member variable\textquotesingle{}s {\ttfamily add} method, which takes the class name as template and its constructor\textquotesingle{}s parameters as arguments. For example\+:
|
|
\begin{DoxyCode}{0}
|
|
\DoxyCodeLine{foundry.selectors.add< \mbox{\hyperlink{classeo_stoch_tournament_select}{eoStochTournamentSelect<EOT>}} >( 0.5 );}
|
|
\end{DoxyCode}
|
|
|
|
|
|
\begin{DoxyWarning}{Warning}
|
|
If the constructor takes a reference Y\+OU S\+H\+O\+U\+LD A\+B\+S\+O\+L\+U\+T\+E\+LY wrap it in a {\ttfamily std\+::ref}, or it will silently be passed as a copy, which would effectively disable any link between operators.
|
|
\end{DoxyWarning}
|
|
In a second step, the operators to be used should be selected by indicating their index, just like the foundry was a array of five elements\+:
|
|
\begin{DoxyCode}{0}
|
|
\DoxyCodeLine{foundry = \{0, 1, 2, 0, 3\};}
|
|
\DoxyCodeLine{\textcolor{comment}{// \string^ \string^ \string^ \string^ \string^ replacement}}
|
|
\DoxyCodeLine{\textcolor{comment}{// | | | + selection}}
|
|
\DoxyCodeLine{\textcolor{comment}{// | | + mutation}}
|
|
\DoxyCodeLine{\textcolor{comment}{// | + crossover}}
|
|
\DoxyCodeLine{\textcolor{comment}{// + continue}}
|
|
\end{DoxyCode}
|
|
|
|
|
|
\begin{DoxyNote}{Note}
|
|
\+: by default, the firsts of the five operators are selected.
|
|
\end{DoxyNote}
|
|
If you don\textquotesingle{}t (want to) recall the order of the operators in the encoding, you can use the {\ttfamily index()} member, for example\+:
|
|
\begin{DoxyCode}{0}
|
|
\DoxyCodeLine{foundry.at(foundry.continuators.index()) = 2; \textcolor{comment}{// select the third continuator}}
|
|
\end{DoxyCode}
|
|
|
|
|
|
Now, you can call the fourdry just like any \mbox{\hyperlink{classeo_algo}{eo\+Algo}}, by passing it an \mbox{\hyperlink{classeo_pop}{eo\+Pop}}\+:
|
|
\begin{DoxyCode}{0}
|
|
\DoxyCodeLine{foundry(pop);}
|
|
\DoxyCodeLine{@encode}
|
|
\DoxyCodeLine{It will instantiate the needed operators (only) and the algorithm itself on-\/the-\/fly,}
|
|
\DoxyCodeLine{and then run it.}
|
|
\DoxyCodeLine{}
|
|
\DoxyCodeLine{@note: Thanks to the underlying \mbox{\hyperlink{classeo_operator_foundry}{eoOperatorFoundry}}, not all the added operators are instantiated.}
|
|
\DoxyCodeLine{Every instantiation is deferred upon actual use. That way, you can still reconfigure them}
|
|
\DoxyCodeLine{\mbox{\hyperlink{classeo_algo_foundry_a4330a983b77169d032a1d81702f70414}{at}} any time with `eoForgeOperator::setup`, \textcolor{keywordflow}{for} example:}
|
|
\DoxyCodeLine{@code}
|
|
\DoxyCodeLine{foundry.selector.at(0).setup(0.5); \textcolor{comment}{// using constructor's arguments}}
|
|
\end{DoxyCode}
|
|
|
|
|
|
\doxysubsection{Constructor \& Destructor Documentation}
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a1dc8e4bdb9522440292bdf946ba1ac45}\label{classeo_algo_foundry_e_a_a1dc8e4bdb9522440292bdf946ba1ac45}}
|
|
\index{eoAlgoFoundryEA$<$ EOT $>$@{eoAlgoFoundryEA$<$ EOT $>$}!eoAlgoFoundryEA@{eoAlgoFoundryEA}}
|
|
\index{eoAlgoFoundryEA@{eoAlgoFoundryEA}!eoAlgoFoundryEA$<$ EOT $>$@{eoAlgoFoundryEA$<$ EOT $>$}}
|
|
\doxysubsubsection{\texorpdfstring{eoAlgoFoundryEA()}{eoAlgoFoundryEA()}}
|
|
{\footnotesize\ttfamily template$<$class E\+OT $>$ \\
|
|
\mbox{\hyperlink{classeo_algo_foundry_e_a}{eo\+Algo\+Foundry\+EA}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$\+::\mbox{\hyperlink{classeo_algo_foundry_e_a}{eo\+Algo\+Foundry\+EA}} (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classeo_pop_eval_func}{eo\+Pop\+Eval\+Func}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \&}]{eval, }\item[{size\+\_\+t}]{max\+\_\+gen }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}
|
|
|
|
The constructon only take an eval, because all other operators are stored in the public containers.
|
|
|
|
\doxysubsection{Member Function Documentation}
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_ae18f36338d80bbd2627f0b3b9d19a867}\label{classeo_algo_foundry_e_a_ae18f36338d80bbd2627f0b3b9d19a867}}
|
|
\index{eoAlgoFoundryEA$<$ EOT $>$@{eoAlgoFoundryEA$<$ EOT $>$}!name@{name}}
|
|
\index{name@{name}!eoAlgoFoundryEA$<$ EOT $>$@{eoAlgoFoundryEA$<$ EOT $>$}}
|
|
\doxysubsubsection{\texorpdfstring{name()}{name()}}
|
|
{\footnotesize\ttfamily template$<$class E\+OT $>$ \\
|
|
std\+::string \mbox{\hyperlink{classeo_algo_foundry_e_a}{eo\+Algo\+Foundry\+EA}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$\+::name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}
|
|
|
|
Return an approximate name of the seected algorithm.
|
|
|
|
\begin{DoxyNote}{Note}
|
|
\+: does not take into account parameters of the operators, only show class names.
|
|
\end{DoxyNote}
|
|
\mbox{\Hypertarget{classeo_algo_foundry_e_a_a96535b5dd4f2a5c588a079bc1c0c95e0}\label{classeo_algo_foundry_e_a_a96535b5dd4f2a5c588a079bc1c0c95e0}}
|
|
\index{eoAlgoFoundryEA$<$ EOT $>$@{eoAlgoFoundryEA$<$ EOT $>$}!operator()@{operator()}}
|
|
\index{operator()@{operator()}!eoAlgoFoundryEA$<$ EOT $>$@{eoAlgoFoundryEA$<$ EOT $>$}}
|
|
\doxysubsubsection{\texorpdfstring{operator()()}{operator()()}}
|
|
{\footnotesize\ttfamily template$<$class E\+OT $>$ \\
|
|
void \mbox{\hyperlink{classeo_algo_foundry_e_a}{eo\+Algo\+Foundry\+EA}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$\+::operator() (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classeo_pop}{eo\+Pop}}$<$ \mbox{\hyperlink{struct_dummy}{E\+OT}} $>$ \&}]{pop }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}
|
|
|
|
instantiate and call the pre-\/selected algorithm.
|
|
|
|
Implements \mbox{\hyperlink{classeo_u_f_a786e028409366dc273e19104f17ba68a}{eo\+U\+F$<$ eo\+Pop$<$ E\+O\+T $>$ \&, void $>$}}.
|
|
|
|
|
|
|
|
The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
|
|
\item
|
|
eo/src/eo\+Algo\+Foundry\+E\+A.\+h\end{DoxyCompactItemize}
|