git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
137 lines
11 KiB
HTML
137 lines
11 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>EO: make_MyStruct.cpp Source File</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.3.9.1 -->
|
|
<div class="qindex"> <form class="search" action="search.php" method="get">
|
|
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
|
|
<div class="nav">
|
|
<a class="el" href="dir_000003.html">tutorial</a> / <a class="el" href="dir_000026.html">Templates</a></div>
|
|
<h1>make_MyStruct.cpp</h1><div class="fragment"><pre class="fragment">00001
|
|
00006 <span class="comment">/*</span>
|
|
00007 <span class="comment">Template for creating a new representation in EO</span>
|
|
00008 <span class="comment">================================================</span>
|
|
00009 <span class="comment"></span>
|
|
00010 <span class="comment">This is the template file that allows separate compilation of</span>
|
|
00011 <span class="comment">everything that is representation independant (evolution engine and</span>
|
|
00012 <span class="comment">general output) for an Evolutionary Algorithm with scalar fitness.</span>
|
|
00013 <span class="comment"></span>
|
|
00014 <span class="comment">It includes of course the definition of the genotype (eoMyStruct.h) and</span>
|
|
00015 <span class="comment">is written like the make_xxx.cpp files in dirs src/ga (for bitstrings)</span>
|
|
00016 <span class="comment">and src/es (for real vectors).</span>
|
|
00017 <span class="comment"></span>
|
|
00018 <span class="comment">*/</span>
|
|
00019
|
|
00020 <span class="comment">// Miscilaneous include and declaration </span>
|
|
00021 <span class="preprocessor">#include <iostream></span>
|
|
00022 <span class="keyword">using</span> <span class="keyword">namespace </span>std;
|
|
00023
|
|
00024 <span class="comment">// eo general include</span>
|
|
00025 <span class="preprocessor">#include "eo"</span>
|
|
00026 <span class="comment">// the real bounds (not yet in general eo include)</span>
|
|
00027 <span class="preprocessor">#include "utils/eoRealVectorBounds.h"</span>
|
|
00028
|
|
00029 <span class="comment">// include here whatever specific files for your representation</span>
|
|
00030 <span class="comment">// Basically, this should include at least the following</span>
|
|
00031
|
|
00035 <span class="preprocessor">#include "eoMyStruct.h"</span>
|
|
00036
|
|
00037 <span class="comment">// create an initializer: this is NOT representation-independent</span>
|
|
00038 <span class="comment">// and will be done in the main file</span>
|
|
00039 <span class="comment">// However, should you decide to freeze that part, you could use the</span>
|
|
00040 <span class="comment">// following (and remove it from the main file, of course!!!)</span>
|
|
00041 <span class="comment">//------------------------------------------------------------------</span>
|
|
00042 <span class="comment">// #include "make_genotype_MyStruct.h"</span>
|
|
00043 <span class="comment">// eoInit<eoMyStruct<double>> & make_genotype(eoParser& _parser, eoState&_state, eoMyStruct<double> _eo)</span>
|
|
00044 <span class="comment">// {</span>
|
|
00045 <span class="comment">// return do_make_genotype(_parser, _state, _eo);</span>
|
|
00046 <span class="comment">// } </span>
|
|
00047
|
|
00048 <span class="comment">// eoInit<eoMyStruct<eoMinimizingFitness>> & make_genotype(eoParser& _parser, eoState&_state, eoMyStruct<eoMinimizingFitness> _eo)</span>
|
|
00049 <span class="comment">// {</span>
|
|
00050 <span class="comment">// return do_make_genotype(_parser, _state, _eo);</span>
|
|
00051 <span class="comment">// } </span>
|
|
00052
|
|
00053 <span class="comment">// same thing for the variation operaotrs</span>
|
|
00054 <span class="comment">//---------------------------------------</span>
|
|
00055 <span class="comment">// #include "make_op_MyStruct.h"</span>
|
|
00056 <span class="comment">// eoGenOp<eoMyStruct<double>>& make_op(eoParser& _parser, eoState& _state, eoInit<eoMyStruct<double>>& _init)</span>
|
|
00057 <span class="comment">// {</span>
|
|
00058 <span class="comment">// return do_make_op(_parser, _state, _init);</span>
|
|
00059 <span class="comment">// }</span>
|
|
00060
|
|
00061 <span class="comment">// eoGenOp<eoMyStruct<eoMinimizingFitness>>& make_op(eoParser& _parser, eoState& _state, eoInit<eoMyStruct<eoMinimizingFitness>>& _init)</span>
|
|
00062 <span class="comment">// {</span>
|
|
00063 <span class="comment">// return do_make_op(_parser, _state, _init);</span>
|
|
00064 <span class="comment">// }</span>
|
|
00065
|
|
00066 <span class="comment">// The following modules use ***representation independent*** routines</span>
|
|
00067
|
|
00068 <span class="comment">// how to initialize the population </span>
|
|
00069 <span class="comment">// it IS representation independent if an eoInit is given</span>
|
|
00070 <span class="preprocessor">#include <do/make_pop.h></span>
|
|
00071 <a class="code" href="classeo_pop.html">eoPop<eoMyStruct<double></a> >& make_pop(eoParser& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_init.html">eoInit</a><eoMyStruct<double> > & _init)
|
|
00072 {
|
|
00073 <span class="keywordflow">return</span> do_make_pop(_parser, _state, _init);
|
|
00074 }
|
|
00075
|
|
00076 <a class="code" href="classeo_pop.html">eoPop<eoMyStruct<eoMinimizingFitness></a> >& make_pop(eoParser& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_init.html">eoInit</a><eoMyStruct<eoMinimizingFitness> > & _init)
|
|
00077 {
|
|
00078 <span class="keywordflow">return</span> do_make_pop(_parser, _state, _init);
|
|
00079 }
|
|
00080
|
|
00081 <span class="comment">// the stopping criterion</span>
|
|
00082 <span class="preprocessor">#include <do/make_continue.h></span>
|
|
00083 <a class="code" href="classeo_continue.html">eoContinue<eoMyStruct<double></a> >& make_continue(eoParser& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_eval_func_counter.html">eoEvalFuncCounter</a><eoMyStruct<double> > & _eval)
|
|
00084 {
|
|
00085 <span class="keywordflow">return</span> do_make_continue(_parser, _state, _eval);
|
|
00086 }
|
|
00087
|
|
00088 <a class="code" href="classeo_continue.html">eoContinue<eoMyStruct<eoMinimizingFitness></a> >& make_continue(eoParser& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_eval_func_counter.html">eoEvalFuncCounter</a><eoMyStruct<eoMinimizingFitness> > & _eval)
|
|
00089 {
|
|
00090 <span class="keywordflow">return</span> do_make_continue(_parser, _state, _eval);
|
|
00091 }
|
|
00092
|
|
00093 <span class="comment">// outputs (stats, population dumps, ...)</span>
|
|
00094 <span class="preprocessor">#include <do/make_checkpoint.h></span>
|
|
00095 <a class="code" href="classeo_check_point.html">eoCheckPoint<eoMyStruct<double></a> >& make_checkpoint(eoParser& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_eval_func_counter.html">eoEvalFuncCounter</a><eoMyStruct<double> >& _eval, <a class="code" href="classeo_continue.html">eoContinue</a><eoMyStruct<double> >& _continue)
|
|
00096 {
|
|
00097 <span class="keywordflow">return</span> do_make_checkpoint(_parser, _state, _eval, _continue);
|
|
00098 }
|
|
00099
|
|
00100 <a class="code" href="classeo_check_point.html">eoCheckPoint<eoMyStruct<eoMinimizingFitness></a> >& make_checkpoint(eoParser& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_eval_func_counter.html">eoEvalFuncCounter</a><eoMyStruct<eoMinimizingFitness> >& _eval, <a class="code" href="classeo_continue.html">eoContinue</a><eoMyStruct<eoMinimizingFitness> >& _continue)
|
|
00101 {
|
|
00102 <span class="keywordflow">return</span> do_make_checkpoint(_parser, _state, _eval, _continue);
|
|
00103 }
|
|
00104
|
|
00105 <span class="comment">// evolution engine (selection and replacement)</span>
|
|
00106 <span class="preprocessor">#include <do/make_algo_scalar.h></span>
|
|
00107 <a class="code" href="classeo_algo.html">eoAlgo<eoMyStruct<double></a> >& make_algo_scalar(eoParser& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_eval_func.html">eoEvalFunc</a><eoMyStruct<double> >& _eval, <a class="code" href="classeo_continue.html">eoContinue</a><eoMyStruct<double> >& _continue, <a class="code" href="classeo_gen_op.html">eoGenOp</a><eoMyStruct<double> >& _op)
|
|
00108 {
|
|
00109 <span class="keywordflow">return</span> do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
|
|
00110 }
|
|
00111
|
|
00112 <a class="code" href="classeo_algo.html">eoAlgo<eoMyStruct<eoMinimizingFitness></a> >& make_algo_scalar(eoParser& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_eval_func.html">eoEvalFunc</a><eoMyStruct<eoMinimizingFitness> >& _eval, <a class="code" href="classeo_continue.html">eoContinue</a><eoMyStruct<eoMinimizingFitness> >& _continue, <a class="code" href="classeo_gen_op.html">eoGenOp</a><eoMyStruct<eoMinimizingFitness> >& _op)
|
|
00113 {
|
|
00114 <span class="keywordflow">return</span> do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
|
|
00115 }
|
|
00116
|
|
00117 <span class="comment">// simple call to the algo. stays there for consistency reasons </span>
|
|
00118 <span class="comment">// no template for that one</span>
|
|
00119 <span class="preprocessor">#include <do/make_run.h></span>
|
|
00120 <span class="keywordtype">void</span> run_ea(<a class="code" href="classeo_algo.html">eoAlgo</a><eoMyStruct<double> >& _ga, <a class="code" href="classeo_pop.html">eoPop</a><eoMyStruct<double> >& _pop)
|
|
00121 {
|
|
00122 do_run(_ga, _pop);
|
|
00123 }
|
|
00124
|
|
00125 <span class="keywordtype">void</span> run_ea(<a class="code" href="classeo_algo.html">eoAlgo</a><eoMyStruct<eoMinimizingFitness> >& _ga, <a class="code" href="classeo_pop.html">eoPop</a><eoMyStruct<eoMinimizingFitness> >& _pop)
|
|
00126 {
|
|
00127 do_run(_ga, _pop);
|
|
00128 }
|
|
00129
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 05:06:41 2006 for EO by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
|
|
</body>
|
|
</html>
|