Doc script updates API documentation module=paradiseo-peo SPY=/data/OPAC/software/paradisEO/scripts/spy-update-api-doc-7483.20080313094002.log

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1147 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
legrand 2008-03-13 08:43:20 +00:00
commit f6c7f50b3c
626 changed files with 21451 additions and 11394 deletions

View file

@ -0,0 +1,145 @@
<!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>ParadisEO-PEO-ParallelanddistributedEvolvingObjects: mainEA.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>mainEA.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">* &lt;mainEA.cpp&gt;</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008</span>
<a name="l00004"></a>00004 <span class="comment">* (C) OPAC Team, INRIA, 2008</span>
<a name="l00005"></a>00005 <span class="comment">*</span>
<a name="l00006"></a>00006 <span class="comment">* Clive Canape</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">* This software is governed by the CeCILL license under French law and</span>
<a name="l00009"></a>00009 <span class="comment">* abiding by the rules of distribution of free software. You can use,</span>
<a name="l00010"></a>00010 <span class="comment">* modify and/ or redistribute the software under the terms of the CeCILL</span>
<a name="l00011"></a>00011 <span class="comment">* license as circulated by CEA, CNRS and INRIA at the following URL</span>
<a name="l00012"></a>00012 <span class="comment">* "http://www.cecill.info".</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">* As a counterpart to the access to the source code and rights to copy,</span>
<a name="l00015"></a>00015 <span class="comment">* modify and redistribute granted by the license, users are provided only</span>
<a name="l00016"></a>00016 <span class="comment">* with a limited warranty and the software's author, the holder of the</span>
<a name="l00017"></a>00017 <span class="comment">* economic rights, and the successive licensors have only limited liability.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">* In this respect, the user's attention is drawn to the risks associated</span>
<a name="l00020"></a>00020 <span class="comment">* with loading, using, modifying and/or developing or reproducing the</span>
<a name="l00021"></a>00021 <span class="comment">* software by the user in light of its specific status of free software,</span>
<a name="l00022"></a>00022 <span class="comment">* that may mean that it is complicated to manipulate, and that also</span>
<a name="l00023"></a>00023 <span class="comment">* therefore means that it is reserved for developers and experienced</span>
<a name="l00024"></a>00024 <span class="comment">* professionals having in-depth computer knowledge. Users are therefore</span>
<a name="l00025"></a>00025 <span class="comment">* encouraged to load and test the software's suitability as regards their</span>
<a name="l00026"></a>00026 <span class="comment">* requirements in conditions enabling the security of their systems and/or</span>
<a name="l00027"></a>00027 <span class="comment">* data to be ensured and, more generally, to use and operate it in the</span>
<a name="l00028"></a>00028 <span class="comment">* same conditions as regards security.</span>
<a name="l00029"></a>00029 <span class="comment">* The fact that you are presently reading this means that you have had</span>
<a name="l00030"></a>00030 <span class="comment">* knowledge of the CeCILL license and that you accept its terms.</span>
<a name="l00031"></a>00031 <span class="comment">*</span>
<a name="l00032"></a>00032 <span class="comment">* ParadisEO WebSite : http://paradiseo.gforge.inria.fr</span>
<a name="l00033"></a>00033 <span class="comment">* Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00034"></a>00034 <span class="comment">*</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;peo&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;es.h&gt;</span>
<a name="l00039"></a>00039
<a name="l00040"></a>00040 <span class="keyword">typedef</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">eoReal&lt;double&gt;</a> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a>;
<a name="l00041"></a>00041
<a name="l00042"></a>00042 <span class="comment">//Evaluation function</span>
<a name="l00043"></a>00043 <span class="keywordtype">double</span> f (<span class="keyword">const</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a> &amp; _indi)
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045 <span class="comment">// Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2</span>
<a name="l00046"></a>00046 <span class="comment">// =&gt; optimal : f* = 0 , with x* =(1,1)</span>
<a name="l00047"></a>00047
<a name="l00048"></a>00048 <span class="keywordtype">double</span> sum;
<a name="l00049"></a>00049 sum=_indi[1]-pow(_indi[0],2);
<a name="l00050"></a>00050 sum=100*pow(sum,2);
<a name="l00051"></a>00051 sum+=pow((1-_indi[0]),2);
<a name="l00052"></a>00052 <span class="keywordflow">return</span> (-sum);
<a name="l00053"></a>00053 }
<a name="l00054"></a>00054
<a name="l00055"></a>00055 <span class="keywordtype">int</span> main (<span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span> *__argv[])
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057
<a name="l00058"></a>00058 <span class="comment">// Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself</span>
<a name="l00059"></a>00059 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00060"></a>00060
<a name="l00061"></a>00061 <span class="comment">//Parameters</span>
<a name="l00062"></a>00062 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_parser.html">eoParser</a> parser(__argc, __argv);
<a name="l00063"></a>00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> POP_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(20), <span class="stringliteral">"popSize"</span>, <span class="stringliteral">"Population size"</span>,<span class="charliteral">'P'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00064"></a>00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MAX_GEN = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(100), <span class="stringliteral">"maxGen"</span>, <span class="stringliteral">"Maximum number of generations"</span>,<span class="charliteral">'G'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00065"></a>00065 <span class="keywordtype">double</span> EPSILON = parser.createParam(0.01, <span class="stringliteral">"mutEpsilon"</span>, <span class="stringliteral">"epsilon for mutation"</span>,<span class="charliteral">'e'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00066"></a>00066 <span class="keywordtype">double</span> CROSS_RATE = parser.createParam(0.25, <span class="stringliteral">"pCross"</span>, <span class="stringliteral">"Crossover probability"</span>,<span class="charliteral">'C'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00067"></a>00067 <span class="keywordtype">double</span> MUT_RATE = parser.createParam(0.35, <span class="stringliteral">"pMut"</span>, <span class="stringliteral">"Mutation probability"</span>,<span class="charliteral">'M'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00068"></a>00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VEC_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(2), <span class="stringliteral">"vecSize"</span>, <span class="stringliteral">"Vector size"</span>,<span class="charliteral">'V'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00069"></a>00069 <span class="keywordtype">double</span> INIT_POSITION_MIN = parser.createParam(-2.0, <span class="stringliteral">"pMin"</span>, <span class="stringliteral">"Init position min"</span>,<span class="charliteral">'N'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00070"></a>00070 <span class="keywordtype">double</span> INIT_POSITION_MAX = parser.createParam(2.0, <span class="stringliteral">"pMax"</span>, <span class="stringliteral">"Init position max"</span>,<span class="charliteral">'X'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00071"></a>00071 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#2727d901e79a00930492730539e3b644">rng</a>.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_rng.html#b5919255f9fd6c10934f77b61eedfe61">reseed</a> (time(0));
<a name="l00072"></a>00072
<a name="l00073"></a>00073 <span class="comment">// Stopping</span>
<a name="l00074"></a>00074 eoGenContinue &lt; Indi &gt; genContPara (MAX_GEN);
<a name="l00075"></a>00075 eoCombinedContinue &lt;Indi&gt; continuatorPara (genContPara);
<a name="l00076"></a>00076 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt;Indi&gt;</a> checkpoint(continuatorPara);
<a name="l00077"></a>00077
<a name="l00078"></a>00078 <span class="comment">// For a parallel evaluation</span>
<a name="l00079"></a>00079 <a class="code" href="structpeoEvalFunc.html">peoEvalFunc&lt;Indi&gt;</a> plainEval(f);
<a name="l00080"></a>00080 peoPopEval &lt;Indi&gt; eval(plainEval);
<a name="l00081"></a>00081
<a name="l00082"></a>00082 <span class="comment">// Initialization</span>
<a name="l00083"></a>00083 eoUniformGenerator &lt; double &gt;uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
<a name="l00084"></a>00084 eoInitFixedLength &lt; Indi &gt; <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#ba579308def1ee61d5a17a479586053c">random</a> (VEC_SIZE, uGen);
<a name="l00085"></a>00085
<a name="l00086"></a>00086 <span class="comment">// Selection</span>
<a name="l00087"></a>00087 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt;Indi&gt;</a> selectionStrategy;
<a name="l00088"></a>00088 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt;Indi&gt;</a> select(selectionStrategy,POP_SIZE);
<a name="l00089"></a>00089
<a name="l00090"></a>00090 <span class="comment">// Transformation</span>
<a name="l00091"></a>00091 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_segment_crossover.html">eoSegmentCrossover&lt;Indi&gt;</a> crossover;
<a name="l00092"></a>00092 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_uniform_mutation.html">eoUniformMutation&lt;Indi&gt;</a> mutation(EPSILON);
<a name="l00093"></a>00093 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_s_g_a_transform.html">eoSGATransform&lt;Indi&gt;</a> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
<a name="l00094"></a>00094
<a name="l00095"></a>00095 <span class="comment">// Replacement</span>
<a name="l00096"></a>00096 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt;Indi&gt;</a> replace;
<a name="l00097"></a>00097
<a name="l00098"></a>00098 <span class="comment">// Creation of the population</span>
<a name="l00099"></a>00099 eoPop &lt; Indi &gt; pop;
<a name="l00100"></a>00100 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#f37a425b85894e44c25392ee5f6514fc">append</a> (POP_SIZE, random);
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <span class="comment">// Algorithm</span>
<a name="l00103"></a>00103 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_easy_e_a.html">eoEasyEA&lt; Indi &gt;</a> eaAlg( checkpoint, eval, select, transform, replace );
<a name="l00104"></a>00104
<a name="l00105"></a>00105 <span class="comment">//Parallel algorithm</span>
<a name="l00106"></a>00106 <a class="code" href="classpeoWrapper.html">peoWrapper</a> parallelEA( eaAlg, pop);
<a name="l00107"></a>00107 eval.setOwner(parallelEA);
<a name="l00108"></a>00108
<a name="l00109"></a>00109 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>();
<a name="l00110"></a>00110 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>();
<a name="l00111"></a>00111 <span class="keywordflow">if</span> (getNodeRank()==1)
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#cee388e2a8d68da24040a9d440a36830">sort</a>();
<a name="l00114"></a>00114 std::cout &lt;&lt; <span class="stringliteral">"Final population :\n"</span> &lt;&lt; pop &lt;&lt; std::endl;
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -0,0 +1,152 @@
<!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>ParadisEO-PEO-ParallelanddistributedEvolvingObjects: mainPSO.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>mainPSO.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">* &lt;mainPSO.cpp&gt;</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008</span>
<a name="l00004"></a>00004 <span class="comment">* (C) OPAC Team, INRIA, 2008</span>
<a name="l00005"></a>00005 <span class="comment">*</span>
<a name="l00006"></a>00006 <span class="comment">* Clive Canape</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">* This software is governed by the CeCILL license under French law and</span>
<a name="l00009"></a>00009 <span class="comment">* abiding by the rules of distribution of free software. You can use,</span>
<a name="l00010"></a>00010 <span class="comment">* modify and/ or redistribute the software under the terms of the CeCILL</span>
<a name="l00011"></a>00011 <span class="comment">* license as circulated by CEA, CNRS and INRIA at the following URL</span>
<a name="l00012"></a>00012 <span class="comment">* "http://www.cecill.info".</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">* As a counterpart to the access to the source code and rights to copy,</span>
<a name="l00015"></a>00015 <span class="comment">* modify and redistribute granted by the license, users are provided only</span>
<a name="l00016"></a>00016 <span class="comment">* with a limited warranty and the software's author, the holder of the</span>
<a name="l00017"></a>00017 <span class="comment">* economic rights, and the successive licensors have only limited liability.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">* In this respect, the user's attention is drawn to the risks associated</span>
<a name="l00020"></a>00020 <span class="comment">* with loading, using, modifying and/or developing or reproducing the</span>
<a name="l00021"></a>00021 <span class="comment">* software by the user in light of its specific status of free software,</span>
<a name="l00022"></a>00022 <span class="comment">* that may mean that it is complicated to manipulate, and that also</span>
<a name="l00023"></a>00023 <span class="comment">* therefore means that it is reserved for developers and experienced</span>
<a name="l00024"></a>00024 <span class="comment">* professionals having in-depth computer knowledge. Users are therefore</span>
<a name="l00025"></a>00025 <span class="comment">* encouraged to load and test the software's suitability as regards their</span>
<a name="l00026"></a>00026 <span class="comment">* requirements in conditions enabling the security of their systems and/or</span>
<a name="l00027"></a>00027 <span class="comment">* data to be ensured and, more generally, to use and operate it in the</span>
<a name="l00028"></a>00028 <span class="comment">* same conditions as regards security.</span>
<a name="l00029"></a>00029 <span class="comment">* The fact that you are presently reading this means that you have had</span>
<a name="l00030"></a>00030 <span class="comment">* knowledge of the CeCILL license and that you accept its terms.</span>
<a name="l00031"></a>00031 <span class="comment">*</span>
<a name="l00032"></a>00032 <span class="comment">* ParadisEO WebSite : http://paradiseo.gforge.inria.fr</span>
<a name="l00033"></a>00033 <span class="comment">* Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00034"></a>00034 <span class="comment">*</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;peo&gt;</span>
<a name="l00038"></a>00038
<a name="l00039"></a>00039 <span class="keyword">typedef</span> eoRealParticle &lt; double &gt;<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a>;
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="comment">//Evaluation function</span>
<a name="l00042"></a>00042 <span class="keywordtype">double</span> f (<span class="keyword">const</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a> &amp; _indi)
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="comment">// Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2</span>
<a name="l00045"></a>00045 <span class="comment">// =&gt; optimal : f* = 0 , with x* =(1,1)</span>
<a name="l00046"></a>00046
<a name="l00047"></a>00047 <span class="keywordtype">double</span> sum;
<a name="l00048"></a>00048 sum=_indi[1]-pow(_indi[0],2);
<a name="l00049"></a>00049 sum=100*pow(sum,2);
<a name="l00050"></a>00050 sum+=pow((1-_indi[0]),2);
<a name="l00051"></a>00051 <span class="keywordflow">return</span> (-sum);
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053
<a name="l00054"></a>00054 <span class="keywordtype">int</span> main (<span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span> *__argv[])
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056
<a name="l00057"></a>00057 <span class="comment">// Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself</span>
<a name="l00058"></a>00058 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00059"></a>00059
<a name="l00060"></a>00060 <span class="comment">//Parameters</span>
<a name="l00061"></a>00061 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_parser.html">eoParser</a> parser(__argc, __argv);
<a name="l00062"></a>00062 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> POP_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(20), <span class="stringliteral">"popSize"</span>, <span class="stringliteral">"Population size"</span>,<span class="charliteral">'P'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00063"></a>00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MAX_GEN = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(100), <span class="stringliteral">"maxGen"</span>, <span class="stringliteral">"Maximum number of generations"</span>,<span class="charliteral">'G'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00064"></a>00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VEC_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(2), <span class="stringliteral">"vecSize"</span>, <span class="stringliteral">"Vector size"</span>,<span class="charliteral">'V'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00065"></a>00065 <span class="keywordtype">double</span> INIT_POSITION_MIN = parser.createParam(-2.0, <span class="stringliteral">"pMin"</span>, <span class="stringliteral">"Init position min"</span>,<span class="charliteral">'N'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00066"></a>00066 <span class="keywordtype">double</span> INIT_POSITION_MAX = parser.createParam(2.0, <span class="stringliteral">"pMax"</span>, <span class="stringliteral">"Init position max"</span>,<span class="charliteral">'X'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00067"></a>00067 <span class="keywordtype">double</span> INIT_VELOCITY_MIN = parser.createParam(-1.0, <span class="stringliteral">"vMin"</span>, <span class="stringliteral">"Init velocity min"</span>,<span class="charliteral">'n'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00068"></a>00068 <span class="keywordtype">double</span> INIT_VELOCITY_MAX = parser.createParam(1.0, <span class="stringliteral">"vMax"</span>, <span class="stringliteral">"Init velocity max"</span>,<span class="charliteral">'x'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00069"></a>00069 <span class="keywordtype">double</span> weight = parser.createParam(1.0, <span class="stringliteral">"weight"</span>, <span class="stringliteral">"Weight"</span>,<span class="charliteral">'w'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00070"></a>00070 <span class="keywordtype">double</span> C1 = parser.createParam(0.5, <span class="stringliteral">"c1"</span>, <span class="stringliteral">"C1"</span>,<span class="charliteral">'1'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00071"></a>00071 <span class="keywordtype">double</span> C2 = parser.createParam(2.0, <span class="stringliteral">"c2t"</span>, <span class="stringliteral">"C2"</span>,<span class="charliteral">'2'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00072"></a>00072 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> NEIGHBORHOOD_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(6), <span class="stringliteral">"neighSize"</span>, <span class="stringliteral">"Neighborhood size"</span>,<span class="charliteral">'H'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00073"></a>00073 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#2727d901e79a00930492730539e3b644">rng</a>.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_rng.html#b5919255f9fd6c10934f77b61eedfe61">reseed</a> (time(0));
<a name="l00074"></a>00074
<a name="l00075"></a>00075 <span class="comment">// Stopping</span>
<a name="l00076"></a>00076 eoGenContinue &lt; Indi &gt; genContPara (MAX_GEN);
<a name="l00077"></a>00077 eoCombinedContinue &lt;Indi&gt; continuatorPara (genContPara);
<a name="l00078"></a>00078 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt;Indi&gt;</a> checkpoint(continuatorPara);
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <span class="comment">// For a parallel evaluation</span>
<a name="l00081"></a>00081 <a class="code" href="structpeoEvalFunc.html">peoEvalFunc&lt;Indi, double, const Indi&amp; &gt;</a> plainEval(f);
<a name="l00082"></a>00082 <a class="code" href="classpeoPopEval.html">peoPopEval&lt; Indi &gt;</a> eval(plainEval);
<a name="l00083"></a>00083
<a name="l00084"></a>00084 <span class="comment">// Initialization</span>
<a name="l00085"></a>00085 eoUniformGenerator &lt; double &gt;uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
<a name="l00086"></a>00086 eoInitFixedLength &lt; Indi &gt; <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#ba579308def1ee61d5a17a479586053c">random</a> (VEC_SIZE, uGen);
<a name="l00087"></a>00087
<a name="l00088"></a>00088 <span class="comment">// Velocity</span>
<a name="l00089"></a>00089 eoUniformGenerator &lt; double &gt;sGen (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX);
<a name="l00090"></a>00090 eoVelocityInitFixedLength &lt; Indi &gt; veloRandom (VEC_SIZE, sGen);
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="comment">// Initializing the best</span>
<a name="l00093"></a>00093 eoFirstIsBestInit &lt; Indi &gt; localInit;
<a name="l00094"></a>00094
<a name="l00095"></a>00095 <span class="comment">// Flight</span>
<a name="l00096"></a>00096 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real_vector_bounds.html">eoRealVectorBounds</a> bndsFlight(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
<a name="l00097"></a>00097 eoStandardFlight &lt; Indi &gt; flight(bndsFlight);
<a name="l00098"></a>00098
<a name="l00099"></a>00099 <span class="comment">// Creation of the population</span>
<a name="l00100"></a>00100 eoPop &lt; Indi &gt; pop;
<a name="l00101"></a>00101 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#f37a425b85894e44c25392ee5f6514fc">append</a> (POP_SIZE, random);
<a name="l00102"></a>00102
<a name="l00103"></a>00103 <span class="comment">// Topology</span>
<a name="l00104"></a>00104 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_linear_topology.html">eoLinearTopology&lt;Indi&gt;</a> topology(NEIGHBORHOOD_SIZE);
<a name="l00105"></a>00105 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real_vector_bounds.html">eoRealVectorBounds</a> bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
<a name="l00106"></a>00106 eoStandardVelocity &lt; Indi &gt; velocity (topology,weight,C1,C2,bnds);
<a name="l00107"></a>00107
<a name="l00108"></a>00108 <span class="comment">// Initialization</span>
<a name="l00109"></a>00109 eoInitializer &lt;Indi&gt; <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">init</a>(eval,veloRandom,localInit,topology,pop);
<a name="l00110"></a>00110
<a name="l00111"></a>00111 <span class="comment">//Parallel algorithm</span>
<a name="l00112"></a>00112 eoSyncEasyPSO &lt;Indi&gt; psa(init,checkpoint,eval, velocity, flight);
<a name="l00113"></a>00113 <a class="code" href="classpeoWrapper.html">peoWrapper</a> parallelPSO( psa, pop);
<a name="l00114"></a>00114 eval.setOwner(parallelPSO);
<a name="l00115"></a>00115
<a name="l00116"></a>00116 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>();
<a name="l00117"></a>00117 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>();
<a name="l00118"></a>00118 <span class="keywordflow">if</span> (getNodeRank()==1)
<a name="l00119"></a>00119 {
<a name="l00120"></a>00120 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#cee388e2a8d68da24040a9d440a36830">sort</a>();
<a name="l00121"></a>00121 std::cout &lt;&lt; <span class="stringliteral">"Final population :\n"</span> &lt;&lt; pop &lt;&lt; std::endl;
<a name="l00122"></a>00122 }
<a name="l00123"></a>00123 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -1,136 +0,0 @@
<!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>ParadisEO-PEOMovingObjects: main.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>main.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span>
<a name="l00002"></a>00002 <span class="comment">* &lt;main.cpp&gt;</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007</span>
<a name="l00004"></a>00004 <span class="comment">* (C) OPAC Team, LIFL, 2002-2007</span>
<a name="l00005"></a>00005 <span class="comment">*</span>
<a name="l00006"></a>00006 <span class="comment">* Sebastien Cahon, Alexandru-Adrian Tantar</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">* This software is governed by the CeCILL license under French law and</span>
<a name="l00009"></a>00009 <span class="comment">* abiding by the rules of distribution of free software. You can use,</span>
<a name="l00010"></a>00010 <span class="comment">* modify and/ or redistribute the software under the terms of the CeCILL</span>
<a name="l00011"></a>00011 <span class="comment">* license as circulated by CEA, CNRS and INRIA at the following URL</span>
<a name="l00012"></a>00012 <span class="comment">* "http://www.cecill.info".</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">* As a counterpart to the access to the source code and rights to copy,</span>
<a name="l00015"></a>00015 <span class="comment">* modify and redistribute granted by the license, users are provided only</span>
<a name="l00016"></a>00016 <span class="comment">* with a limited warranty and the software's author, the holder of the</span>
<a name="l00017"></a>00017 <span class="comment">* economic rights, and the successive licensors have only limited liability.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">* In this respect, the user's attention is drawn to the risks associated</span>
<a name="l00020"></a>00020 <span class="comment">* with loading, using, modifying and/or developing or reproducing the</span>
<a name="l00021"></a>00021 <span class="comment">* software by the user in light of its specific status of free software,</span>
<a name="l00022"></a>00022 <span class="comment">* that may mean that it is complicated to manipulate, and that also</span>
<a name="l00023"></a>00023 <span class="comment">* therefore means that it is reserved for developers and experienced</span>
<a name="l00024"></a>00024 <span class="comment">* professionals having in-depth computer knowledge. Users are therefore</span>
<a name="l00025"></a>00025 <span class="comment">* encouraged to load and test the software's suitability as regards their</span>
<a name="l00026"></a>00026 <span class="comment">* requirements in conditions enabling the security of their systems and/or</span>
<a name="l00027"></a>00027 <span class="comment">* data to be ensured and, more generally, to use and operate it in the</span>
<a name="l00028"></a>00028 <span class="comment">* same conditions as regards security.</span>
<a name="l00029"></a>00029 <span class="comment">* The fact that you are presently reading this means that you have had</span>
<a name="l00030"></a>00030 <span class="comment">* knowledge of the CeCILL license and that you accept its terms.</span>
<a name="l00031"></a>00031 <span class="comment">*</span>
<a name="l00032"></a>00032 <span class="comment">* ParadisEO WebSite : http://paradiseo.gforge.inria.fr</span>
<a name="l00033"></a>00033 <span class="comment">* Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00034"></a>00034 <span class="comment">*</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include "route.h"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "route_init.h"</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include "route_eval.h"</span>
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="preprocessor">#include "order_xover.h"</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include "city_swap.h"</span>
<a name="l00043"></a>00043
<a name="l00044"></a>00044 <span class="preprocessor">#include "param.h"</span>
<a name="l00045"></a>00045
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;peo&gt;</span>
<a name="l00047"></a>00047
<a name="l00048"></a>00048
<a name="l00049"></a>00049 <span class="preprocessor">#define POP_SIZE 10</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#define NUM_GEN 100</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define CROSS_RATE 1.0</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#define MUT_RATE 0.01</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span>
<a name="l00054"></a>00054
<a name="l00055"></a>00055 <span class="keywordtype">int</span> main( <span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span>** __argv ) {
<a name="l00056"></a>00056
<a name="l00057"></a>00057 <span class="comment">// initializing the ParadisEO-PEO environment</span>
<a name="l00058"></a>00058 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00059"></a>00059
<a name="l00060"></a>00060
<a name="l00061"></a>00061 <span class="comment">// processing the command line specified parameters</span>
<a name="l00062"></a>00062 <a class="code" href="namespacepeo.html#2b496ee9b81d9ae322ae6edb9a93dc71">loadParameters</a>( __argc, __argv );
<a name="l00063"></a>00063
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="comment">// init, eval operators, EA operators -------------------------------------------------------------------------------------------------------------</span>
<a name="l00066"></a>00066
<a name="l00067"></a>00067 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_init.html">RouteInit</a> route_init; <span class="comment">// random init object - creates random Route objects</span>
<a name="l00068"></a>00068 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> full_eval; <span class="comment">// evaluator object - offers a fitness value for a specified Route object</span>
<a name="l00069"></a>00069
<a name="l00070"></a>00070 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_order_xover.html">OrderXover</a> crossover; <span class="comment">// crossover operator - creates two offsprings out of two specified parents</span>
<a name="l00071"></a>00071 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_city_swap.html">CitySwap</a> mutation; <span class="comment">// mutation operator - randomly mutates one gene for a specified individual</span>
<a name="l00072"></a>00072 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00073"></a>00073
<a name="l00074"></a>00074
<a name="l00075"></a>00075 <span class="comment">// evolutionary algorithm components --------------------------------------------------------------------------------------------------------------</span>
<a name="l00076"></a>00076
<a name="l00077"></a>00077 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt; Route &gt;</a> population( POP_SIZE, route_init ); <span class="comment">// initial population for the algorithm having POP_SIZE individuals</span>
<a name="l00078"></a>00078 <a class="code" href="classpeoSeqPopEval.html">peoSeqPopEval&lt; Route &gt;</a> eaPopEval( full_eval ); <span class="comment">// evaluator object - to be applied at each iteration on the entire population</span>
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_gen_continue.html">eoGenContinue&lt; Route &gt;</a> eaCont( NUM_GEN ); <span class="comment">// continuation criterion - the algorithm will iterate for NUM_GEN generations</span>
<a name="l00081"></a>00081 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt; Route &gt;</a> eaCheckpointContinue( eaCont ); <span class="comment">// checkpoint object - verify at each iteration if the continuation criterion is met</span>
<a name="l00082"></a>00082
<a name="l00083"></a>00083 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt; Route &gt;</a> selectionStrategy; <span class="comment">// selection strategy - applied at each iteration for selecting parent individuals</span>
<a name="l00084"></a>00084 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt; Route &gt;</a> eaSelect( selectionStrategy, POP_SIZE ); <span class="comment">// selection object - POP_SIZE individuals are selected at each iteration</span>
<a name="l00085"></a>00085
<a name="l00086"></a>00086 <span class="comment">// transform operator - includes the crossover and the mutation operators with a specified associated rate</span>
<a name="l00087"></a>00087 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_s_g_a_transform.html">eoSGATransform&lt; Route &gt;</a> transform( crossover, CROSS_RATE, mutation, MUT_RATE );
<a name="l00088"></a>00088 <a class="code" href="classpeoSeqTransform.html">peoSeqTransform&lt; Route &gt;</a> eaTransform( transform ); <span class="comment">// ParadisEO transform operator (please remark the peo prefix) - wraps an e EO transform object</span>
<a name="l00089"></a>00089
<a name="l00090"></a>00090 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt; Route &gt;</a> eaReplace; <span class="comment">// replacement strategy - for replacing the initial population with offspring individuals</span>
<a name="l00091"></a>00091 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00092"></a>00092
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <span class="comment">// ParadisEO-PEO evolutionary algorithm -----------------------------------------------------------------------------------------------------------</span>
<a name="l00095"></a>00095
<a name="l00096"></a>00096 <a class="code" href="classpeoEA.html">peoEA&lt; Route &gt;</a> eaAlg( eaCheckpointContinue, eaPopEval, eaSelect, eaTransform, eaReplace );
<a name="l00097"></a>00097
<a name="l00098"></a>00098 eaAlg( population ); <span class="comment">// specifying the initial population for the algorithm, to be iteratively evolved</span>
<a name="l00099"></a>00099 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00100"></a>00100
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>( );
<a name="l00103"></a>00103 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>( );
<a name="l00104"></a>00104 <span class="comment">// shutting down the ParadisEO-PEO environment</span>
<a name="l00105"></a>00105
<a name="l00106"></a>00106 <span class="keywordflow">return</span> 0;
<a name="l00107"></a>00107 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Oct 8 11:16:45 2007 for ParadisEO-PEOMovingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -0,0 +1,126 @@
<!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>ParadisEO-PEO-ParallelanddistributedEvolvingObjects: mainEA.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>mainEA.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">* &lt;mainEA.cpp&gt;</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008</span>
<a name="l00004"></a>00004 <span class="comment">* (C) OPAC Team, INRIA, 2008</span>
<a name="l00005"></a>00005 <span class="comment">*</span>
<a name="l00006"></a>00006 <span class="comment">* Clive Canape</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">* This software is governed by the CeCILL license under French law and</span>
<a name="l00009"></a>00009 <span class="comment">* abiding by the rules of distribution of free software. You can use,</span>
<a name="l00010"></a>00010 <span class="comment">* modify and/ or redistribute the software under the terms of the CeCILL</span>
<a name="l00011"></a>00011 <span class="comment">* license as circulated by CEA, CNRS and INRIA at the following URL</span>
<a name="l00012"></a>00012 <span class="comment">* "http://www.cecill.info".</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">* As a counterpart to the access to the source code and rights to copy,</span>
<a name="l00015"></a>00015 <span class="comment">* modify and redistribute granted by the license, users are provided only</span>
<a name="l00016"></a>00016 <span class="comment">* with a limited warranty and the software's author, the holder of the</span>
<a name="l00017"></a>00017 <span class="comment">* economic rights, and the successive licensors have only limited liability.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">* In this respect, the user's attention is drawn to the risks associated</span>
<a name="l00020"></a>00020 <span class="comment">* with loading, using, modifying and/or developing or reproducing the</span>
<a name="l00021"></a>00021 <span class="comment">* software by the user in light of its specific status of free software,</span>
<a name="l00022"></a>00022 <span class="comment">* that may mean that it is complicated to manipulate, and that also</span>
<a name="l00023"></a>00023 <span class="comment">* therefore means that it is reserved for developers and experienced</span>
<a name="l00024"></a>00024 <span class="comment">* professionals having in-depth computer knowledge. Users are therefore</span>
<a name="l00025"></a>00025 <span class="comment">* encouraged to load and test the software's suitability as regards their</span>
<a name="l00026"></a>00026 <span class="comment">* requirements in conditions enabling the security of their systems and/or</span>
<a name="l00027"></a>00027 <span class="comment">* data to be ensured and, more generally, to use and operate it in the</span>
<a name="l00028"></a>00028 <span class="comment">* same conditions as regards security.</span>
<a name="l00029"></a>00029 <span class="comment">* The fact that you are presently reading this means that you have had</span>
<a name="l00030"></a>00030 <span class="comment">* knowledge of the CeCILL license and that you accept its terms.</span>
<a name="l00031"></a>00031 <span class="comment">*</span>
<a name="l00032"></a>00032 <span class="comment">* ParadisEO WebSite : http://paradiseo.gforge.inria.fr</span>
<a name="l00033"></a>00033 <span class="comment">* Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00034"></a>00034 <span class="comment">*</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;peo&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;es.h&gt;</span>
<a name="l00039"></a>00039
<a name="l00040"></a>00040 <span class="keyword">typedef</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">eoReal&lt;double&gt;</a> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a>;
<a name="l00041"></a>00041
<a name="l00042"></a>00042 <span class="keywordtype">double</span> f (<span class="keyword">const</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a> &amp; _indi)
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="keywordtype">double</span> sum;
<a name="l00045"></a>00045 sum=_indi[1]-pow(_indi[0],2);
<a name="l00046"></a>00046 sum=100*pow(sum,2);
<a name="l00047"></a>00047 sum+=pow((1-_indi[0]),2);
<a name="l00048"></a>00048 <span class="keywordflow">return</span> (-sum);
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050
<a name="l00051"></a>00051 <span class="keywordtype">int</span> main (<span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span> *__argv[])
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053
<a name="l00054"></a>00054 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00055"></a>00055 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_parser.html">eoParser</a> parser(__argc, __argv);
<a name="l00056"></a>00056 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> POP_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(20), <span class="stringliteral">"popSize"</span>, <span class="stringliteral">"Population size"</span>,<span class="charliteral">'P'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00057"></a>00057 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MAX_GEN = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(100), <span class="stringliteral">"maxGen"</span>, <span class="stringliteral">"Maximum number of generations"</span>,<span class="charliteral">'G'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00058"></a>00058 <span class="keywordtype">double</span> EPSILON = parser.createParam(0.01, <span class="stringliteral">"mutEpsilon"</span>, <span class="stringliteral">"epsilon for mutation"</span>,<span class="charliteral">'e'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00059"></a>00059 <span class="keywordtype">double</span> CROSS_RATE = parser.createParam(0.25, <span class="stringliteral">"pCross"</span>, <span class="stringliteral">"Crossover probability"</span>,<span class="charliteral">'C'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00060"></a>00060 <span class="keywordtype">double</span> MUT_RATE = parser.createParam(0.35, <span class="stringliteral">"pMut"</span>, <span class="stringliteral">"Mutation probability"</span>,<span class="charliteral">'M'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00061"></a>00061 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VEC_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(2), <span class="stringliteral">"vecSize"</span>, <span class="stringliteral">"Vector size"</span>,<span class="charliteral">'V'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00062"></a>00062 <span class="keywordtype">double</span> INIT_POSITION_MIN = parser.createParam(-2.0, <span class="stringliteral">"pMin"</span>, <span class="stringliteral">"Init position min"</span>,<span class="charliteral">'N'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00063"></a>00063 <span class="keywordtype">double</span> INIT_POSITION_MAX = parser.createParam(2.0, <span class="stringliteral">"pMax"</span>, <span class="stringliteral">"Init position max"</span>,<span class="charliteral">'X'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00064"></a>00064 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#2727d901e79a00930492730539e3b644">rng</a>.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_rng.html#b5919255f9fd6c10934f77b61eedfe61">reseed</a> (time(0));
<a name="l00065"></a>00065 eoGenContinue &lt; Indi &gt; genContPara (MAX_GEN);
<a name="l00066"></a>00066 eoCombinedContinue &lt;Indi&gt; continuatorPara (genContPara);
<a name="l00067"></a>00067 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt;Indi&gt;</a> checkpoint(continuatorPara);
<a name="l00068"></a>00068 <a class="code" href="structpeoEvalFunc.html">peoEvalFunc&lt;Indi&gt;</a> plainEval(f);
<a name="l00069"></a>00069 peoPopEval &lt;Indi&gt; eval(plainEval);
<a name="l00070"></a>00070 eoUniformGenerator &lt; double &gt;uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
<a name="l00071"></a>00071 eoInitFixedLength &lt; Indi &gt; <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#ba579308def1ee61d5a17a479586053c">random</a> (VEC_SIZE, uGen);
<a name="l00072"></a>00072 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt;Indi&gt;</a> selectionStrategy;
<a name="l00073"></a>00073 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt;Indi&gt;</a> select(selectionStrategy,POP_SIZE);
<a name="l00074"></a>00074 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_segment_crossover.html">eoSegmentCrossover&lt;Indi&gt;</a> crossover;
<a name="l00075"></a>00075 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_uniform_mutation.html">eoUniformMutation&lt;Indi&gt;</a> mutation(EPSILON);
<a name="l00076"></a>00076
<a name="l00077"></a>00077 <span class="comment">// Parallel transformation</span>
<a name="l00078"></a>00078 <a class="code" href="classpeoTransform.html">peoTransform&lt;Indi&gt;</a> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt;Indi&gt;</a> replace;
<a name="l00081"></a>00081 eoPop &lt; Indi &gt; pop;
<a name="l00082"></a>00082 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#f37a425b85894e44c25392ee5f6514fc">append</a> (POP_SIZE, random);
<a name="l00083"></a>00083 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_easy_e_a.html">eoEasyEA&lt; Indi &gt;</a> eaAlg( checkpoint, eval, select, transform, replace );
<a name="l00084"></a>00084 <a class="code" href="classpeoWrapper.html">peoWrapper</a> parallelEA( eaAlg, pop);
<a name="l00085"></a>00085 eval.setOwner(parallelEA);
<a name="l00086"></a>00086
<a name="l00087"></a>00087 <span class="comment">// setOwner</span>
<a name="l00088"></a>00088 transform.setOwner (parallelEA);
<a name="l00089"></a>00089
<a name="l00090"></a>00090 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>();
<a name="l00091"></a>00091 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>();
<a name="l00092"></a>00092 <span class="keywordflow">if</span> (getNodeRank()==1)
<a name="l00093"></a>00093 {
<a name="l00094"></a>00094 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#cee388e2a8d68da24040a9d440a36830">sort</a>();
<a name="l00095"></a>00095 std::cout &lt;&lt; <span class="stringliteral">"Final population :\n"</span> &lt;&lt; pop &lt;&lt; std::endl;
<a name="l00096"></a>00096 }
<a name="l00097"></a>00097 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -1,168 +0,0 @@
<!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>ParadisEO-PEOMovingObjects: main.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>main.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span>
<a name="l00002"></a>00002 <span class="comment">* &lt;main.cpp&gt;</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007</span>
<a name="l00004"></a>00004 <span class="comment">* (C) OPAC Team, LIFL, 2002-2007</span>
<a name="l00005"></a>00005 <span class="comment">*</span>
<a name="l00006"></a>00006 <span class="comment">* Sebastien Cahon, Alexandru-Adrian Tantar</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">* This software is governed by the CeCILL license under French law and</span>
<a name="l00009"></a>00009 <span class="comment">* abiding by the rules of distribution of free software. You can use,</span>
<a name="l00010"></a>00010 <span class="comment">* modify and/ or redistribute the software under the terms of the CeCILL</span>
<a name="l00011"></a>00011 <span class="comment">* license as circulated by CEA, CNRS and INRIA at the following URL</span>
<a name="l00012"></a>00012 <span class="comment">* "http://www.cecill.info".</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">* As a counterpart to the access to the source code and rights to copy,</span>
<a name="l00015"></a>00015 <span class="comment">* modify and redistribute granted by the license, users are provided only</span>
<a name="l00016"></a>00016 <span class="comment">* with a limited warranty and the software's author, the holder of the</span>
<a name="l00017"></a>00017 <span class="comment">* economic rights, and the successive licensors have only limited liability.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">* In this respect, the user's attention is drawn to the risks associated</span>
<a name="l00020"></a>00020 <span class="comment">* with loading, using, modifying and/or developing or reproducing the</span>
<a name="l00021"></a>00021 <span class="comment">* software by the user in light of its specific status of free software,</span>
<a name="l00022"></a>00022 <span class="comment">* that may mean that it is complicated to manipulate, and that also</span>
<a name="l00023"></a>00023 <span class="comment">* therefore means that it is reserved for developers and experienced</span>
<a name="l00024"></a>00024 <span class="comment">* professionals having in-depth computer knowledge. Users are therefore</span>
<a name="l00025"></a>00025 <span class="comment">* encouraged to load and test the software's suitability as regards their</span>
<a name="l00026"></a>00026 <span class="comment">* requirements in conditions enabling the security of their systems and/or</span>
<a name="l00027"></a>00027 <span class="comment">* data to be ensured and, more generally, to use and operate it in the</span>
<a name="l00028"></a>00028 <span class="comment">* same conditions as regards security.</span>
<a name="l00029"></a>00029 <span class="comment">* The fact that you are presently reading this means that you have had</span>
<a name="l00030"></a>00030 <span class="comment">* knowledge of the CeCILL license and that you accept its terms.</span>
<a name="l00031"></a>00031 <span class="comment">*</span>
<a name="l00032"></a>00032 <span class="comment">* ParadisEO WebSite : http://paradiseo.gforge.inria.fr</span>
<a name="l00033"></a>00033 <span class="comment">* Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00034"></a>00034 <span class="comment">*</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include "route.h"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "route_init.h"</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include "route_eval.h"</span>
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="preprocessor">#include "order_xover.h"</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include "city_swap.h"</span>
<a name="l00043"></a>00043
<a name="l00044"></a>00044 <span class="preprocessor">#include "param.h"</span>
<a name="l00045"></a>00045
<a name="l00046"></a>00046 <span class="preprocessor">#include "merge_route_eval.h"</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include "part_route_eval.h"</span>
<a name="l00048"></a>00048
<a name="l00049"></a>00049
<a name="l00050"></a>00050 <span class="preprocessor">#include &lt;peo&gt;</span>
<a name="l00051"></a>00051
<a name="l00052"></a>00052
<a name="l00053"></a>00053 <span class="preprocessor">#define POP_SIZE 10</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#define NUM_GEN 100</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor">#define CROSS_RATE 1.0</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor">#define MUT_RATE 0.01</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00058"></a>00058 <span class="preprocessor">#define NUM_PART_EVALS 2</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span>
<a name="l00060"></a>00060
<a name="l00061"></a>00061 <span class="comment">// by default, parallel evaluation of the population is performed;</span>
<a name="l00062"></a>00062 <span class="comment">// for parallel fitness evaluation, uncomment the following line</span>
<a name="l00063"></a>00063
<a name="l00064"></a>00064 <span class="comment">// #define PARALLEL_FIT_EVALUATION</span>
<a name="l00065"></a>00065
<a name="l00066"></a>00066
<a name="l00067"></a>00067 <span class="keywordtype">int</span> main( <span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span>** __argv ) {
<a name="l00068"></a>00068
<a name="l00069"></a>00069 <span class="comment">// initializing the ParadisEO-PEO environment</span>
<a name="l00070"></a>00070 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00071"></a>00071
<a name="l00072"></a>00072
<a name="l00073"></a>00073 <span class="comment">// processing the command line specified parameters</span>
<a name="l00074"></a>00074 <a class="code" href="namespacepeo.html#2b496ee9b81d9ae322ae6edb9a93dc71">loadParameters</a>( __argc, __argv );
<a name="l00075"></a>00075
<a name="l00076"></a>00076
<a name="l00077"></a>00077 <span class="comment">// init, eval operators, EA operators -------------------------------------------------------------------------------------------------------------</span>
<a name="l00078"></a>00078
<a name="l00079"></a>00079 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_init.html">RouteInit</a> route_init; <span class="comment">// random init object - creates random Route objects</span>
<a name="l00080"></a>00080 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> full_eval; <span class="comment">// evaluator object - offers a fitness value for a specified Route object</span>
<a name="l00081"></a>00081
<a name="l00082"></a>00082 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_order_xover.html">OrderXover</a> crossover; <span class="comment">// crossover operator - creates two offsprings out of two specified parents</span>
<a name="l00083"></a>00083 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_city_swap.html">CitySwap</a> mutation; <span class="comment">// mutation operator - randomly mutates one gene for a specified individual</span>
<a name="l00084"></a>00084 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00085"></a>00085
<a name="l00086"></a>00086
<a name="l00087"></a>00087 <span class="comment">// evolutionary algorithm components --------------------------------------------------------------------------------------------------------------</span>
<a name="l00088"></a>00088
<a name="l00089"></a>00089 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt; Route &gt;</a> population( POP_SIZE, route_init ); <span class="comment">// initial population for the algorithm having POP_SIZE individuals</span>
<a name="l00090"></a>00090
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="preprocessor"> #ifdef PARALLEL_FIT_EVALUATION</span>
<a name="l00093"></a>00093 <span class="preprocessor"></span>
<a name="l00094"></a>00094 <a class="code" href="classMergeRouteEval.html">MergeRouteEval</a> merge_eval;
<a name="l00095"></a>00095
<a name="l00096"></a>00096 std :: vector&lt; eoEvalFunc&lt; Route &gt;* &gt; part_eval;
<a name="l00097"></a>00097 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> index = 1; index &lt;= NUM_PART_EVALS; index++ )
<a name="l00098"></a>00098 part_eval.push_back( <span class="keyword">new</span> <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_part_route_eval.html">PartRouteEval</a>( ( <span class="keywordtype">float</span> )( index - 1 ) / NUM_PART_EVALS, ( <span class="keywordtype">float</span> )index / NUM_PART_EVALS ) );
<a name="l00099"></a>00099
<a name="l00100"></a>00100 <a class="code" href="classpeoParaPopEval.html">peoParaPopEval&lt; Route &gt;</a> ox_pop_eval( part_eval, merge_eval );
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <span class="preprocessor"> #else</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span>
<a name="l00104"></a>00104 <a class="code" href="classpeoParaPopEval.html">peoParaPopEval&lt; Route &gt;</a> ox_pop_eval( full_eval );
<a name="l00105"></a>00105
<a name="l00106"></a>00106 <span class="preprocessor"> #endif</span>
<a name="l00107"></a>00107 <span class="preprocessor"></span>
<a name="l00108"></a>00108
<a name="l00109"></a>00109
<a name="l00110"></a>00110 <a class="code" href="classpeoParaPopEval.html">peoParaPopEval&lt; Route &gt;</a> eaPopEval( full_eval ); <span class="comment">// evaluator object - to be applied at each iteration on the entire population</span>
<a name="l00111"></a>00111
<a name="l00112"></a>00112 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_gen_continue.html">eoGenContinue&lt; Route &gt;</a> eaCont( NUM_GEN ); <span class="comment">// continuation criterion - the algorithm will iterate for NUM_GEN generations</span>
<a name="l00113"></a>00113 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt; Route &gt;</a> eaCheckpointContinue( eaCont ); <span class="comment">// checkpoint object - verify at each iteration if the continuation criterion is met</span>
<a name="l00114"></a>00114
<a name="l00115"></a>00115 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt; Route &gt;</a> selectionStrategy; <span class="comment">// selection strategy - applied at each iteration for selecting parent individuals</span>
<a name="l00116"></a>00116 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt; Route &gt;</a> eaSelect( selectionStrategy, POP_SIZE ); <span class="comment">// selection object - POP_SIZE individuals are selected at each iteration</span>
<a name="l00117"></a>00117
<a name="l00118"></a>00118 <span class="comment">// transform operator - includes the crossover and the mutation operators with a specified associated rate</span>
<a name="l00119"></a>00119 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_s_g_a_transform.html">eoSGATransform&lt; Route &gt;</a> transform( crossover, CROSS_RATE, mutation, MUT_RATE );
<a name="l00120"></a>00120 <a class="code" href="classpeoSeqTransform.html">peoSeqTransform&lt; Route &gt;</a> eaTransform( transform ); <span class="comment">// ParadisEO transform operator (please remark the peo prefix) - wraps an e EO transform object</span>
<a name="l00121"></a>00121
<a name="l00122"></a>00122 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt; Route &gt;</a> eaReplace; <span class="comment">// replacement strategy - for replacing the initial population with offspring individuals</span>
<a name="l00123"></a>00123 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00124"></a>00124
<a name="l00125"></a>00125
<a name="l00126"></a>00126 <span class="comment">// ParadisEO-PEO evolutionary algorithm -----------------------------------------------------------------------------------------------------------</span>
<a name="l00127"></a>00127
<a name="l00128"></a>00128 <a class="code" href="classpeoEA.html">peoEA&lt; Route &gt;</a> eaAlg( eaCheckpointContinue, eaPopEval, eaSelect, eaTransform, eaReplace );
<a name="l00129"></a>00129
<a name="l00130"></a>00130 eaAlg( population ); <span class="comment">// specifying the initial population for the algorithm, to be iteratively evolved</span>
<a name="l00131"></a>00131 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00132"></a>00132
<a name="l00133"></a>00133
<a name="l00134"></a>00134 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>( );
<a name="l00135"></a>00135 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>( );
<a name="l00136"></a>00136 <span class="comment">// shutting down the ParadisEO-PEO environment</span>
<a name="l00137"></a>00137
<a name="l00138"></a>00138 <span class="keywordflow">return</span> 0;
<a name="l00139"></a>00139 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Oct 8 11:16:45 2007 for ParadisEO-PEOMovingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -0,0 +1,179 @@
<!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>ParadisEO-PEO-ParallelanddistributedEvolvingObjects: mainEA.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>mainEA.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">* &lt;mainEA.cpp&gt;</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008</span>
<a name="l00004"></a>00004 <span class="comment">* (C) OPAC Team, INRIA, 2008</span>
<a name="l00005"></a>00005 <span class="comment">*</span>
<a name="l00006"></a>00006 <span class="comment">* Clive Canape</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">* This software is governed by the CeCILL license under French law and</span>
<a name="l00009"></a>00009 <span class="comment">* abiding by the rules of distribution of free software. You can use,</span>
<a name="l00010"></a>00010 <span class="comment">* modify and/ or redistribute the software under the terms of the CeCILL</span>
<a name="l00011"></a>00011 <span class="comment">* license as circulated by CEA, CNRS and INRIA at the following URL</span>
<a name="l00012"></a>00012 <span class="comment">* "http://www.cecill.info".</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">* As a counterpart to the access to the source code and rights to copy,</span>
<a name="l00015"></a>00015 <span class="comment">* modify and redistribute granted by the license, users are provided only</span>
<a name="l00016"></a>00016 <span class="comment">* with a limited warranty and the software's author, the holder of the</span>
<a name="l00017"></a>00017 <span class="comment">* economic rights, and the successive licensors have only limited liability.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">* In this respect, the user's attention is drawn to the risks associated</span>
<a name="l00020"></a>00020 <span class="comment">* with loading, using, modifying and/syncor developing or reproducing the</span>
<a name="l00021"></a>00021 <span class="comment">* software by the user in light of its specific status of free software,</span>
<a name="l00022"></a>00022 <span class="comment">* that may mean that it is complicated to manipulate, and that also</span>
<a name="l00023"></a>00023 <span class="comment">* therefore means that it is reserved for developers and experienced</span>
<a name="l00024"></a>00024 <span class="comment">* professionals having in-depth computer knowledge. Users are therefore</span>
<a name="l00025"></a>00025 <span class="comment">* encouraged to load and test the software's suitability as regards their</span>
<a name="l00026"></a>00026 <span class="comment">* requirements in conditions enabling the security of their systems and/or</span>
<a name="l00027"></a>00027 <span class="comment">* data to be ensured and, more generally, to use and operate it in the</span>
<a name="l00028"></a>00028 <span class="comment">* same conditions as regards security.</span>
<a name="l00029"></a>00029 <span class="comment">* The fact that you are presently reading this means that you have had</span>
<a name="l00030"></a>00030 <span class="comment">* knowledge of the CeCILL license and that you accept its terms.</span>
<a name="l00031"></a>00031 <span class="comment">*</span>
<a name="l00032"></a>00032 <span class="comment">* ParadisEO WebSite : http://paradiseo.gforge.inria.fr</span>
<a name="l00033"></a>00033 <span class="comment">* Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00034"></a>00034 <span class="comment">*</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;peo&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;es.h&gt;</span>
<a name="l00039"></a>00039
<a name="l00040"></a>00040 <span class="keyword">typedef</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">eoReal&lt;double&gt;</a> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a>;
<a name="l00041"></a>00041
<a name="l00042"></a>00042 <span class="keywordtype">double</span> f (<span class="keyword">const</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a> &amp; _indi)
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="keywordtype">double</span> sum;
<a name="l00045"></a>00045 sum=_indi[1]-pow(_indi[0],2);
<a name="l00046"></a>00046 sum=100*pow(sum,2);
<a name="l00047"></a>00047 sum+=pow((1-_indi[0]),2);
<a name="l00048"></a>00048 <span class="keywordflow">return</span> (-sum);
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050
<a name="l00051"></a>00051 <span class="keywordtype">int</span> main (<span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span> *__argv[])
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053
<a name="l00054"></a>00054 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00055"></a>00055 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_parser.html">eoParser</a> parser(__argc, __argv);
<a name="l00056"></a>00056 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> POP_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(20), <span class="stringliteral">"popSize"</span>, <span class="stringliteral">"Population size"</span>,<span class="charliteral">'P'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00057"></a>00057 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MAX_GEN = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(100), <span class="stringliteral">"maxGen"</span>, <span class="stringliteral">"Maximum number of generations"</span>,<span class="charliteral">'G'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00058"></a>00058 <span class="keywordtype">double</span> EPSILON = parser.createParam(0.01, <span class="stringliteral">"mutEpsilon"</span>, <span class="stringliteral">"epsilon for mutation"</span>,<span class="charliteral">'e'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00059"></a>00059 <span class="keywordtype">double</span> CROSS_RATE = parser.createParam(0.25, <span class="stringliteral">"pCross"</span>, <span class="stringliteral">"Crossover probability"</span>,<span class="charliteral">'C'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00060"></a>00060 <span class="keywordtype">double</span> MUT_RATE = parser.createParam(0.35, <span class="stringliteral">"pMut"</span>, <span class="stringliteral">"Mutation probability"</span>,<span class="charliteral">'M'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00061"></a>00061 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VEC_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(2), <span class="stringliteral">"vecSize"</span>, <span class="stringliteral">"Vector size"</span>,<span class="charliteral">'V'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00062"></a>00062 <span class="keywordtype">double</span> INIT_POSITION_MIN = parser.createParam(-2.0, <span class="stringliteral">"pMin"</span>, <span class="stringliteral">"Init position min"</span>,<span class="charliteral">'N'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00063"></a>00063 <span class="keywordtype">double</span> INIT_POSITION_MAX = parser.createParam(2.0, <span class="stringliteral">"pMax"</span>, <span class="stringliteral">"Init position max"</span>,<span class="charliteral">'X'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00064"></a>00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MIG_FREQ = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(10), <span class="stringliteral">"migFreq"</span>, <span class="stringliteral">"Migration frequency"</span>,<span class="charliteral">'F'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00065"></a>00065 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MIG_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(5), <span class="stringliteral">"migSize"</span>, <span class="stringliteral">"Migration size"</span>,<span class="charliteral">'S'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00066"></a>00066 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#2727d901e79a00930492730539e3b644">rng</a>.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_rng.html#b5919255f9fd6c10934f77b61eedfe61">reseed</a> (time(0));
<a name="l00067"></a>00067
<a name="l00068"></a>00068 <span class="comment">// Define the topology of your island model</span>
<a name="l00069"></a>00069 <a class="code" href="classRingTopology.html">RingTopology</a> topology;
<a name="l00070"></a>00070
<a name="l00071"></a>00071 <span class="comment">// First algorithm</span>
<a name="l00072"></a>00072 <span class="comment">/*****************************************************************************************/</span>
<a name="l00073"></a>00073
<a name="l00074"></a>00074 eoGenContinue &lt; Indi &gt; genContPara (MAX_GEN);
<a name="l00075"></a>00075 eoCombinedContinue &lt;Indi&gt; continuatorPara (genContPara);
<a name="l00076"></a>00076 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt;Indi&gt;</a> checkpoint(continuatorPara);
<a name="l00077"></a>00077 <a class="code" href="structpeoEvalFunc.html">peoEvalFunc&lt;Indi&gt;</a> mainEval( f );
<a name="l00078"></a>00078 peoPopEval &lt;Indi&gt; eval(mainEval);
<a name="l00079"></a>00079 eoUniformGenerator &lt; double &gt;uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
<a name="l00080"></a>00080 eoInitFixedLength &lt; Indi &gt; <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#ba579308def1ee61d5a17a479586053c">random</a> (VEC_SIZE, uGen);
<a name="l00081"></a>00081 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt;Indi&gt;</a> selectionStrategy;
<a name="l00082"></a>00082 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt;Indi&gt;</a> select(selectionStrategy,POP_SIZE);
<a name="l00083"></a>00083 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_segment_crossover.html">eoSegmentCrossover&lt;Indi&gt;</a> crossover;
<a name="l00084"></a>00084 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_uniform_mutation.html">eoUniformMutation&lt;Indi&gt;</a> mutation(EPSILON);
<a name="l00085"></a>00085 <a class="code" href="classpeoTransform.html">peoTransform&lt;Indi&gt;</a> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
<a name="l00086"></a>00086 eoPop &lt; Indi &gt; pop;
<a name="l00087"></a>00087 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#f37a425b85894e44c25392ee5f6514fc">append</a> (POP_SIZE, random);
<a name="l00088"></a>00088
<a name="l00089"></a>00089 <span class="comment">// Define a synchronous island</span>
<a name="l00090"></a>00090
<a name="l00091"></a>00091 <span class="comment">// Seclection</span>
<a name="l00092"></a>00092 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_random_select.html">eoRandomSelect&lt;Indi&gt;</a> mig_select_one;
<a name="l00093"></a>00093 eoSelector &lt;Indi, eoPop&lt;Indi&gt; &gt; mig_select (mig_select_one,MIG_SIZE,pop);
<a name="l00094"></a>00094 <span class="comment">// Replacement</span>
<a name="l00095"></a>00095 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt;Indi&gt;</a> replace;
<a name="l00096"></a>00096 eoReplace &lt;Indi, eoPop&lt;Indi&gt; &gt; mig_replace (replace,pop);
<a name="l00097"></a>00097 <span class="comment">// Island</span>
<a name="l00098"></a>00098 <a class="code" href="classpeoSyncIslandMig.html">peoSyncIslandMig&lt;eoPop&lt;Indi&gt;</a>, <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt;Indi&gt;</a> &gt; mig(MIG_FREQ,mig_select,mig_replace,topology);
<a name="l00099"></a>00099 checkpoint.add(mig);
<a name="l00100"></a>00100
<a name="l00101"></a>00101 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_easy_e_a.html">eoEasyEA&lt; Indi &gt;</a> eaAlg( checkpoint, eval, select, transform, replace );
<a name="l00102"></a>00102 <a class="code" href="classpeoWrapper.html">peoWrapper</a> parallelEA( eaAlg, pop);
<a name="l00103"></a>00103 eval.setOwner(parallelEA);
<a name="l00104"></a>00104 transform.setOwner(parallelEA);
<a name="l00105"></a>00105 <span class="comment">// setOwner</span>
<a name="l00106"></a>00106 mig.setOwner(parallelEA);
<a name="l00107"></a>00107
<a name="l00108"></a>00108 <span class="comment">/*****************************************************************************************/</span>
<a name="l00109"></a>00109
<a name="l00110"></a>00110 <span class="comment">// Second algorithm (on the same model but with others names)</span>
<a name="l00111"></a>00111 <span class="comment">/*****************************************************************************************/</span>
<a name="l00112"></a>00112
<a name="l00113"></a>00113 eoGenContinue &lt; Indi &gt; genContPara2 (MAX_GEN);
<a name="l00114"></a>00114 eoCombinedContinue &lt;Indi&gt; continuatorPara2 (genContPara2);
<a name="l00115"></a>00115 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt;Indi&gt;</a> checkpoint2(continuatorPara2);
<a name="l00116"></a>00116 <a class="code" href="structpeoEvalFunc.html">peoEvalFunc&lt;Indi&gt;</a> mainEval2( f );
<a name="l00117"></a>00117 peoPopEval &lt;Indi&gt; eval2(mainEval2);
<a name="l00118"></a>00118 eoUniformGenerator &lt; double &gt;uGen2 (INIT_POSITION_MIN, INIT_POSITION_MAX);
<a name="l00119"></a>00119 eoInitFixedLength &lt; Indi &gt; random2 (VEC_SIZE, uGen2);
<a name="l00120"></a>00120 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt;Indi&gt;</a> selectionStrategy2;
<a name="l00121"></a>00121 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt;Indi&gt;</a> select2(selectionStrategy2,POP_SIZE);
<a name="l00122"></a>00122 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_segment_crossover.html">eoSegmentCrossover&lt;Indi&gt;</a> crossover2;
<a name="l00123"></a>00123 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_uniform_mutation.html">eoUniformMutation&lt;Indi&gt;</a> mutation2(EPSILON);
<a name="l00124"></a>00124 <a class="code" href="classpeoTransform.html">peoTransform&lt;Indi&gt;</a> transform2(crossover2,CROSS_RATE,mutation2,MUT_RATE);
<a name="l00125"></a>00125 eoPop &lt; Indi &gt; pop2;
<a name="l00126"></a>00126 pop2.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#f37a425b85894e44c25392ee5f6514fc">append</a> (POP_SIZE, random2);
<a name="l00127"></a>00127 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt;Indi&gt;</a> replace2;
<a name="l00128"></a>00128 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_random_select.html">eoRandomSelect&lt;Indi&gt;</a> mig_select_one2;
<a name="l00129"></a>00129 eoSelector &lt;Indi, eoPop&lt;Indi&gt; &gt; mig_select2 (mig_select_one2,MIG_SIZE,pop2);
<a name="l00130"></a>00130 eoReplace &lt;Indi, eoPop&lt;Indi&gt; &gt; mig_replace2 (replace2,pop2);
<a name="l00131"></a>00131 <a class="code" href="classpeoSyncIslandMig.html">peoSyncIslandMig&lt;eoPop&lt;Indi&gt;</a>, <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt;Indi&gt;</a> &gt; mig2(MIG_FREQ,mig_select2,mig_replace2,topology);
<a name="l00132"></a>00132 checkpoint2.add(mig2);
<a name="l00133"></a>00133 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_easy_e_a.html">eoEasyEA&lt; Indi &gt;</a> eaAlg2( checkpoint2, eval2, select2, transform2, replace2 );
<a name="l00134"></a>00134 <a class="code" href="classpeoWrapper.html">peoWrapper</a> parallelEA2( eaAlg2, pop2);
<a name="l00135"></a>00135 eval2.setOwner(parallelEA2);
<a name="l00136"></a>00136 transform2.setOwner(parallelEA2);
<a name="l00137"></a>00137 mig2.setOwner(parallelEA2);
<a name="l00138"></a>00138
<a name="l00139"></a>00139 <span class="comment">/*****************************************************************************************/</span>
<a name="l00140"></a>00140
<a name="l00141"></a>00141 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>();
<a name="l00142"></a>00142 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>();
<a name="l00143"></a>00143 <span class="keywordflow">if</span> (getNodeRank()==1)
<a name="l00144"></a>00144 {
<a name="l00145"></a>00145 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#cee388e2a8d68da24040a9d440a36830">sort</a>();
<a name="l00146"></a>00146 pop2.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#cee388e2a8d68da24040a9d440a36830">sort</a>();
<a name="l00147"></a>00147 std::cout &lt;&lt; <span class="stringliteral">"Final population 1 :\n"</span> &lt;&lt; pop &lt;&lt; std::endl;
<a name="l00148"></a>00148 std::cout &lt;&lt; <span class="stringliteral">"Final population 2 :\n"</span> &lt;&lt; pop2 &lt;&lt; std::endl;
<a name="l00149"></a>00149 }
<a name="l00150"></a>00150 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -0,0 +1,195 @@
<!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>ParadisEO-PEO-ParallelanddistributedEvolvingObjects: mainPSO.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>mainPSO.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">* &lt;mainPSO.cpp&gt;</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008</span>
<a name="l00004"></a>00004 <span class="comment">* (C) OPAC Team, INRIA, 2008</span>
<a name="l00005"></a>00005 <span class="comment">*</span>
<a name="l00006"></a>00006 <span class="comment">* Clive Canape</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">* This software is governed by the CeCILL license under French law and</span>
<a name="l00009"></a>00009 <span class="comment">* abiding by the rules of distribution of free software. You can use,</span>
<a name="l00010"></a>00010 <span class="comment">* modify and/ or redistribute the software under the terms of the CeCILL</span>
<a name="l00011"></a>00011 <span class="comment">* license as circulated by CEA, CNRS and INRIA at the following URL</span>
<a name="l00012"></a>00012 <span class="comment">* "http://www.cecill.info".</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">* As a counterpart to the access to the source code and rights to copy,</span>
<a name="l00015"></a>00015 <span class="comment">* modify and redistribute granted by the license, users are provided only</span>
<a name="l00016"></a>00016 <span class="comment">* with a limited warranty and the software's author, the holder of the</span>
<a name="l00017"></a>00017 <span class="comment">* economic rights, and the successive licensors have only limited liability.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">* In this respect, the user's attention is drawn to the risks associated</span>
<a name="l00020"></a>00020 <span class="comment">* with loading, using, modifying and/or developing or reproducing the</span>
<a name="l00021"></a>00021 <span class="comment">* software by the user in light of its specific status of free software,</span>
<a name="l00022"></a>00022 <span class="comment">* that may mean that it is complicated to manipulate, and that also</span>
<a name="l00023"></a>00023 <span class="comment">* therefore means that it is reserved for developers and experienced</span>
<a name="l00024"></a>00024 <span class="comment">* professionals having in-depth computer knowledge. Users are therefore</span>
<a name="l00025"></a>00025 <span class="comment">* encouraged to load and test the software's suitability as regards their</span>
<a name="l00026"></a>00026 <span class="comment">* requirements in conditions enabling the security of their systems and/or</span>
<a name="l00027"></a>00027 <span class="comment">* data to be ensured and, more generally, to use and operate it in the</span>
<a name="l00028"></a>00028 <span class="comment">* same conditions as regards security.</span>
<a name="l00029"></a>00029 <span class="comment">* The fact that you are presently reading this means that you have had</span>
<a name="l00030"></a>00030 <span class="comment">* knowledge of the CeCILL license and that you accept its terms.</span>
<a name="l00031"></a>00031 <span class="comment">*</span>
<a name="l00032"></a>00032 <span class="comment">* ParadisEO WebSite : http://paradiseo.gforge.inria.fr</span>
<a name="l00033"></a>00033 <span class="comment">* Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00034"></a>00034 <span class="comment">*</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;peo&gt;</span>
<a name="l00038"></a>00038
<a name="l00039"></a>00039 <span class="keyword">typedef</span> eoRealParticle &lt; double &gt;<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a>;
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="keywordtype">double</span> f (<span class="keyword">const</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real.html">Indi</a> &amp; _indi)
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043 <span class="keywordtype">double</span> sum;
<a name="l00044"></a>00044 sum=_indi[1]-pow(_indi[0],2);
<a name="l00045"></a>00045 sum=100*pow(sum,2);
<a name="l00046"></a>00046 sum+=pow((1-_indi[0]),2);
<a name="l00047"></a>00047 <span class="keywordflow">return</span> (-sum);
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049
<a name="l00050"></a>00050 <span class="keywordtype">int</span> main (<span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span> *__argv[])
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00053"></a>00053 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_parser.html">eoParser</a> parser(__argc, __argv);
<a name="l00054"></a>00054 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> POP_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(20), <span class="stringliteral">"popSize"</span>, <span class="stringliteral">"Population size"</span>,<span class="charliteral">'P'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00055"></a>00055 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MAX_GEN = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(100), <span class="stringliteral">"maxGen"</span>, <span class="stringliteral">"Maximum number of generations"</span>,<span class="charliteral">'G'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00056"></a>00056 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VEC_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(2), <span class="stringliteral">"vecSize"</span>, <span class="stringliteral">"Vector size"</span>,<span class="charliteral">'V'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00057"></a>00057 <span class="keywordtype">double</span> INIT_POSITION_MIN = parser.createParam(-2.0, <span class="stringliteral">"pMin"</span>, <span class="stringliteral">"Init position min"</span>,<span class="charliteral">'N'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00058"></a>00058 <span class="keywordtype">double</span> INIT_POSITION_MAX = parser.createParam(2.0, <span class="stringliteral">"pMax"</span>, <span class="stringliteral">"Init position max"</span>,<span class="charliteral">'X'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00059"></a>00059 <span class="keywordtype">double</span> INIT_VELOCITY_MIN = parser.createParam(-1.0, <span class="stringliteral">"vMin"</span>, <span class="stringliteral">"Init velocity min"</span>,<span class="charliteral">'n'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00060"></a>00060 <span class="keywordtype">double</span> INIT_VELOCITY_MAX = parser.createParam(1.0, <span class="stringliteral">"vMax"</span>, <span class="stringliteral">"Init velocity max"</span>,<span class="charliteral">'x'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00061"></a>00061 <span class="keywordtype">double</span> omega = parser.createParam(1.0, <span class="stringliteral">"weight"</span>, <span class="stringliteral">"Weight"</span>,<span class="charliteral">'w'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00062"></a>00062 <span class="keywordtype">double</span> C1 = parser.createParam(0.5, <span class="stringliteral">"c1"</span>, <span class="stringliteral">"C1"</span>,<span class="charliteral">'1'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00063"></a>00063 <span class="keywordtype">double</span> C2 = parser.createParam(2.0, <span class="stringliteral">"c2t"</span>, <span class="stringliteral">"C2"</span>,<span class="charliteral">'2'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00064"></a>00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> NEIGHBORHOOD_SIZE = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(6), <span class="stringliteral">"neighSize"</span>, <span class="stringliteral">"Neighborhood size"</span>,<span class="charliteral">'H'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00065"></a>00065 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MIG_FREQ = parser.createParam((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)(10), <span class="stringliteral">"migFreq"</span>, <span class="stringliteral">"Migration frequency"</span>,<span class="charliteral">'F'</span>,<span class="stringliteral">"Param"</span>).value();
<a name="l00066"></a>00066 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#2727d901e79a00930492730539e3b644">rng</a>.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_rng.html#b5919255f9fd6c10934f77b61eedfe61">reseed</a> (time(0));
<a name="l00067"></a>00067
<a name="l00068"></a>00068 <span class="comment">// Island model</span>
<a name="l00069"></a>00069
<a name="l00070"></a>00070 <a class="code" href="classRingTopology.html">RingTopology</a> topologyMig;
<a name="l00071"></a>00071
<a name="l00072"></a>00072 <span class="comment">// First</span>
<a name="l00073"></a>00073 eoGenContinue &lt; Indi &gt; genContPara (MAX_GEN);
<a name="l00074"></a>00074 eoCombinedContinue &lt;Indi&gt; continuatorPara (genContPara);
<a name="l00075"></a>00075 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt;Indi&gt;</a> checkpoint(continuatorPara);
<a name="l00076"></a>00076 <a class="code" href="structpeoEvalFunc.html">peoEvalFunc&lt;Indi, double, const Indi&amp; &gt;</a> plainEval(f);
<a name="l00077"></a>00077 <a class="code" href="classpeoPopEval.html">peoPopEval&lt; Indi &gt;</a> eval(plainEval);
<a name="l00078"></a>00078 eoUniformGenerator &lt; double &gt;uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
<a name="l00079"></a>00079 eoInitFixedLength &lt; Indi &gt; <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/namespaceeo.html#ba579308def1ee61d5a17a479586053c">random</a> (VEC_SIZE, uGen);
<a name="l00080"></a>00080 eoUniformGenerator &lt; double &gt;sGen (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX);
<a name="l00081"></a>00081 eoVelocityInitFixedLength &lt; Indi &gt; veloRandom (VEC_SIZE, sGen);
<a name="l00082"></a>00082 eoFirstIsBestInit &lt; Indi &gt; localInit;
<a name="l00083"></a>00083 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real_vector_bounds.html">eoRealVectorBounds</a> bndsFlight(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
<a name="l00084"></a>00084 eoStandardFlight &lt; Indi &gt; flight(bndsFlight);
<a name="l00085"></a>00085 eoPop &lt; Indi &gt; pop;
<a name="l00086"></a>00086 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#f37a425b85894e44c25392ee5f6514fc">append</a> (POP_SIZE, random);
<a name="l00087"></a>00087 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_linear_topology.html">eoLinearTopology&lt;Indi&gt;</a> topology(NEIGHBORHOOD_SIZE);
<a name="l00088"></a>00088 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real_vector_bounds.html">eoRealVectorBounds</a> bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
<a name="l00089"></a>00089 eoStandardVelocity &lt; Indi &gt; velocity (topology,omega,C1,C2,bnds);
<a name="l00090"></a>00090 eoInitializer &lt;Indi&gt; <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">init</a>(eval,veloRandom,localInit,topology,pop);
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="comment">// Island model</span>
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_periodic_continue.html">eoPeriodicContinue&lt; Indi &gt;</a> mig_cont( MIG_FREQ );
<a name="l00095"></a>00095 <a class="code" href="classpeoPSOSelect.html">peoPSOSelect&lt;Indi&gt;</a> mig_selec(topology);
<a name="l00096"></a>00096 <a class="code" href="classpeoWorstPositionReplacement.html">peoWorstPositionReplacement&lt;Indi&gt;</a> mig_replac;
<a name="l00097"></a>00097
<a name="l00098"></a>00098 <span class="comment">// Specific implementation (peoData.h)</span>
<a name="l00099"></a>00099
<a name="l00100"></a>00100 <a class="code" href="classeoContinuator.html">eoContinuator&lt;Indi&gt;</a> cont(mig_cont, pop);
<a name="l00101"></a>00101 eoSelector &lt;Indi, eoPop&lt;Indi&gt; &gt; mig_select (mig_selec,1,pop);
<a name="l00102"></a>00102 eoReplace &lt;Indi, eoPop&lt;Indi&gt; &gt; mig_replace (mig_replac,pop);
<a name="l00103"></a>00103
<a name="l00104"></a>00104
<a name="l00105"></a>00105 <span class="comment">// Second</span>
<a name="l00106"></a>00106
<a name="l00107"></a>00107 eoGenContinue &lt; Indi &gt; genContPara2 (MAX_GEN);
<a name="l00108"></a>00108 eoCombinedContinue &lt;Indi&gt; continuatorPara2 (genContPara2);
<a name="l00109"></a>00109 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt;Indi&gt;</a> checkpoint2(continuatorPara2);
<a name="l00110"></a>00110 <a class="code" href="structpeoEvalFunc.html">peoEvalFunc&lt;Indi, double, const Indi&amp; &gt;</a> plainEval2(f);
<a name="l00111"></a>00111 <a class="code" href="classpeoPopEval.html">peoPopEval&lt; Indi &gt;</a> eval2(plainEval2);
<a name="l00112"></a>00112 eoUniformGenerator &lt; double &gt;uGen2 (INIT_POSITION_MIN, INIT_POSITION_MAX);
<a name="l00113"></a>00113 eoInitFixedLength &lt; Indi &gt; random2 (VEC_SIZE, uGen2);
<a name="l00114"></a>00114 eoUniformGenerator &lt; double &gt;sGen2 (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX);
<a name="l00115"></a>00115 eoVelocityInitFixedLength &lt; Indi &gt; veloRandom2 (VEC_SIZE, sGen2);
<a name="l00116"></a>00116 eoFirstIsBestInit &lt; Indi &gt; localInit2;
<a name="l00117"></a>00117 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real_vector_bounds.html">eoRealVectorBounds</a> bndsFlight2(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
<a name="l00118"></a>00118 eoStandardFlight &lt; Indi &gt; flight2(bndsFlight2);
<a name="l00119"></a>00119 eoPop &lt; Indi &gt; pop2;
<a name="l00120"></a>00120 pop2.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#f37a425b85894e44c25392ee5f6514fc">append</a> (POP_SIZE, random2);
<a name="l00121"></a>00121 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_linear_topology.html">eoLinearTopology&lt;Indi&gt;</a> topology2(NEIGHBORHOOD_SIZE);
<a name="l00122"></a>00122 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_real_vector_bounds.html">eoRealVectorBounds</a> bnds2(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
<a name="l00123"></a>00123 eoStandardVelocity &lt; Indi &gt; velocity2 (topology2,omega,C1,C2,bnds2);
<a name="l00124"></a>00124 eoInitializer &lt;Indi&gt; init2(eval2,veloRandom2,localInit2,topology2,pop2);
<a name="l00125"></a>00125
<a name="l00126"></a>00126 <span class="comment">// Island model</span>
<a name="l00127"></a>00127
<a name="l00128"></a>00128 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_periodic_continue.html">eoPeriodicContinue&lt; Indi &gt;</a> mig_cont2( MIG_FREQ );
<a name="l00129"></a>00129 <a class="code" href="classpeoPSOSelect.html">peoPSOSelect&lt;Indi&gt;</a> mig_selec2(topology2);
<a name="l00130"></a>00130 <a class="code" href="classpeoWorstPositionReplacement.html">peoWorstPositionReplacement&lt;Indi&gt;</a> mig_replac2;
<a name="l00131"></a>00131
<a name="l00132"></a>00132 <span class="comment">// Specific implementation (peoData.h)</span>
<a name="l00133"></a>00133
<a name="l00134"></a>00134 <a class="code" href="classeoContinuator.html">eoContinuator&lt;Indi&gt;</a> cont2(mig_cont2,pop2);
<a name="l00135"></a>00135 eoSelector &lt;Indi, eoPop&lt;Indi&gt; &gt; mig_select2 (mig_selec2,1,pop2);
<a name="l00136"></a>00136 eoReplace &lt;Indi, eoPop&lt;Indi&gt; &gt; mig_replace2 (mig_replac2,pop2);
<a name="l00137"></a>00137
<a name="l00138"></a>00138
<a name="l00139"></a>00139 <span class="comment">// Asynchronous island</span>
<a name="l00140"></a>00140
<a name="l00141"></a>00141 <a class="code" href="classpeoAsyncIslandMig.html">peoAsyncIslandMig&lt; eoPop&lt;Indi&gt;</a>, <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt;Indi&gt;</a> &gt; mig(cont,mig_select, mig_replace, topologyMig);
<a name="l00142"></a>00142 checkpoint.add( mig );
<a name="l00143"></a>00143 <a class="code" href="classpeoAsyncIslandMig.html">peoAsyncIslandMig&lt; eoPop&lt;Indi&gt;</a>, <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt;Indi&gt;</a> &gt; mig2(cont2,mig_select2, mig_replace2, topologyMig);
<a name="l00144"></a>00144 checkpoint2.add( mig2 );
<a name="l00145"></a>00145
<a name="l00146"></a>00146
<a name="l00147"></a>00147 <span class="comment">// Parallel algorithm</span>
<a name="l00148"></a>00148
<a name="l00149"></a>00149 eoSyncEasyPSO &lt;Indi&gt; psa(init,checkpoint,eval, velocity, flight);
<a name="l00150"></a>00150 <a class="code" href="classpeoWrapper.html">peoWrapper</a> parallelPSO( psa, pop);
<a name="l00151"></a>00151 eval.setOwner(parallelPSO);
<a name="l00152"></a>00152 mig.setOwner(parallelPSO);
<a name="l00153"></a>00153 eoSyncEasyPSO &lt;Indi&gt; psa2(init2,checkpoint2,eval2, velocity2, flight2);
<a name="l00154"></a>00154 <a class="code" href="classpeoWrapper.html">peoWrapper</a> parallelPSO2( psa2, pop2);
<a name="l00155"></a>00155 eval2.setOwner(parallelPSO2);
<a name="l00156"></a>00156 mig2.setOwner(parallelPSO2);
<a name="l00157"></a>00157 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>();
<a name="l00158"></a>00158 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>();
<a name="l00159"></a>00159 <span class="keywordflow">if</span> (getNodeRank()==1)
<a name="l00160"></a>00160 {
<a name="l00161"></a>00161 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#cee388e2a8d68da24040a9d440a36830">sort</a>();
<a name="l00162"></a>00162 pop2.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#cee388e2a8d68da24040a9d440a36830">sort</a>();
<a name="l00163"></a>00163 std::cout &lt;&lt; <span class="stringliteral">"Final population :\n"</span> &lt;&lt; pop &lt;&lt; std::endl;
<a name="l00164"></a>00164 std::cout &lt;&lt; <span class="stringliteral">"Final population :\n"</span> &lt;&lt; pop2 &lt;&lt; std::endl;
<a name="l00165"></a>00165 }
<a name="l00166"></a>00166 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -1,217 +0,0 @@
<!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>ParadisEO-PEOMovingObjects: main.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>main.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span>
<a name="l00002"></a>00002 <span class="comment">* &lt;main.cpp&gt;</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007</span>
<a name="l00004"></a>00004 <span class="comment">* (C) OPAC Team, LIFL, 2002-2007</span>
<a name="l00005"></a>00005 <span class="comment">*</span>
<a name="l00006"></a>00006 <span class="comment">* Sebastien Cahon, Alexandru-Adrian Tantar</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">* This software is governed by the CeCILL license under French law and</span>
<a name="l00009"></a>00009 <span class="comment">* abiding by the rules of distribution of free software. You can use,</span>
<a name="l00010"></a>00010 <span class="comment">* modify and/ or redistribute the software under the terms of the CeCILL</span>
<a name="l00011"></a>00011 <span class="comment">* license as circulated by CEA, CNRS and INRIA at the following URL</span>
<a name="l00012"></a>00012 <span class="comment">* "http://www.cecill.info".</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">* As a counterpart to the access to the source code and rights to copy,</span>
<a name="l00015"></a>00015 <span class="comment">* modify and redistribute granted by the license, users are provided only</span>
<a name="l00016"></a>00016 <span class="comment">* with a limited warranty and the software's author, the holder of the</span>
<a name="l00017"></a>00017 <span class="comment">* economic rights, and the successive licensors have only limited liability.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">* In this respect, the user's attention is drawn to the risks associated</span>
<a name="l00020"></a>00020 <span class="comment">* with loading, using, modifying and/or developing or reproducing the</span>
<a name="l00021"></a>00021 <span class="comment">* software by the user in light of its specific status of free software,</span>
<a name="l00022"></a>00022 <span class="comment">* that may mean that it is complicated to manipulate, and that also</span>
<a name="l00023"></a>00023 <span class="comment">* therefore means that it is reserved for developers and experienced</span>
<a name="l00024"></a>00024 <span class="comment">* professionals having in-depth computer knowledge. Users are therefore</span>
<a name="l00025"></a>00025 <span class="comment">* encouraged to load and test the software's suitability as regards their</span>
<a name="l00026"></a>00026 <span class="comment">* requirements in conditions enabling the security of their systems and/or</span>
<a name="l00027"></a>00027 <span class="comment">* data to be ensured and, more generally, to use and operate it in the</span>
<a name="l00028"></a>00028 <span class="comment">* same conditions as regards security.</span>
<a name="l00029"></a>00029 <span class="comment">* The fact that you are presently reading this means that you have had</span>
<a name="l00030"></a>00030 <span class="comment">* knowledge of the CeCILL license and that you accept its terms.</span>
<a name="l00031"></a>00031 <span class="comment">*</span>
<a name="l00032"></a>00032 <span class="comment">* ParadisEO WebSite : http://paradiseo.gforge.inria.fr</span>
<a name="l00033"></a>00033 <span class="comment">* Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00034"></a>00034 <span class="comment">*</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include "route.h"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "route_init.h"</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include "route_eval.h"</span>
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="preprocessor">#include "order_xover.h"</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include "city_swap.h"</span>
<a name="l00043"></a>00043
<a name="l00044"></a>00044 <span class="preprocessor">#include "param.h"</span>
<a name="l00045"></a>00045
<a name="l00046"></a>00046
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;peo&gt;</span>
<a name="l00048"></a>00048
<a name="l00049"></a>00049
<a name="l00050"></a>00050 <span class="preprocessor">#define POP_SIZE 10</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#define NUM_GEN 100</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#define CROSS_RATE 1.0</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#define MUT_RATE 0.01</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>
<a name="l00055"></a>00055 <span class="preprocessor">#define MIG_FREQ 10</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor">#define MIG_SIZE 5</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00058"></a>00058
<a name="l00059"></a>00059 <span class="keywordtype">int</span> main( <span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span>** __argv ) {
<a name="l00060"></a>00060
<a name="l00061"></a>00061 <span class="comment">// initializing the ParadisEO-PEO environment</span>
<a name="l00062"></a>00062 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00063"></a>00063
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="comment">// processing the command line specified parameters</span>
<a name="l00066"></a>00066 <a class="code" href="namespacepeo.html#2b496ee9b81d9ae322ae6edb9a93dc71">loadParameters</a>( __argc, __argv );
<a name="l00067"></a>00067
<a name="l00068"></a>00068
<a name="l00069"></a>00069 <span class="comment">// init, eval operators, EA operators -------------------------------------------------------------------------------------------------------------</span>
<a name="l00070"></a>00070
<a name="l00071"></a>00071 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_init.html">RouteInit</a> route_init; <span class="comment">// random init object - creates random Route objects</span>
<a name="l00072"></a>00072 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> full_eval; <span class="comment">// evaluator object - offers a fitness value for a specified Route object</span>
<a name="l00073"></a>00073
<a name="l00074"></a>00074 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_order_xover.html">OrderXover</a> crossover; <span class="comment">// crossover operator - creates two offsprings out of two specified parents</span>
<a name="l00075"></a>00075 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_city_swap.html">CitySwap</a> mutation; <span class="comment">// mutation operator - randomly mutates one gene for a specified individual</span>
<a name="l00076"></a>00076 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00077"></a>00077
<a name="l00078"></a>00078
<a name="l00079"></a>00079 <span class="comment">// evolutionary algorithm components --------------------------------------------------------------------------------------------------------------</span>
<a name="l00080"></a>00080
<a name="l00081"></a>00081 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt; Route &gt;</a> population( POP_SIZE, route_init ); <span class="comment">// initial population for the algorithm having POP_SIZE individuals</span>
<a name="l00082"></a>00082 <a class="code" href="classpeoParaPopEval.html">peoParaPopEval&lt; Route &gt;</a> eaPopEval( full_eval ); <span class="comment">// evaluator object - to be applied at each iteration on the entire population</span>
<a name="l00083"></a>00083
<a name="l00084"></a>00084 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_gen_continue.html">eoGenContinue&lt; Route &gt;</a> eaCont( NUM_GEN ); <span class="comment">// continuation criterion - the algorithm will iterate for NUM_GEN generations</span>
<a name="l00085"></a>00085 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt; Route &gt;</a> eaCheckpointContinue( eaCont ); <span class="comment">// checkpoint object - verify at each iteration if the continuation criterion is met</span>
<a name="l00086"></a>00086
<a name="l00087"></a>00087 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt; Route &gt;</a> selectionStrategy; <span class="comment">// selection strategy - applied at each iteration for selecting parent individuals</span>
<a name="l00088"></a>00088 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt; Route &gt;</a> eaSelect( selectionStrategy, POP_SIZE ); <span class="comment">// selection object - POP_SIZE individuals are selected at each iteration</span>
<a name="l00089"></a>00089
<a name="l00090"></a>00090 <span class="comment">// transform operator - includes the crossover and the mutation operators with a specified associated rate</span>
<a name="l00091"></a>00091 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_s_g_a_transform.html">eoSGATransform&lt; Route &gt;</a> transform( crossover, CROSS_RATE, mutation, MUT_RATE );
<a name="l00092"></a>00092 <a class="code" href="classpeoSeqTransform.html">peoSeqTransform&lt; Route &gt;</a> eaTransform( transform ); <span class="comment">// ParadisEO transform operator (please remark the peo prefix) - wraps an e EO transform object</span>
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt; Route &gt;</a> eaReplace; <span class="comment">// replacement strategy - for replacing the initial population with offspring individuals</span>
<a name="l00095"></a>00095 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00096"></a>00096
<a name="l00097"></a>00097
<a name="l00098"></a>00098
<a name="l00099"></a>00099 <a class="code" href="classRingTopology.html">RingTopology</a> topology;
<a name="l00100"></a>00100
<a name="l00101"></a>00101 <span class="comment">// migration policy and components ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00102"></a>00102
<a name="l00103"></a>00103 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_periodic_continue.html">eoPeriodicContinue&lt; Route &gt;</a> mig_cont( MIG_FREQ ); <span class="comment">// migration occurs periodically</span>
<a name="l00104"></a>00104
<a name="l00105"></a>00105 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_random_select.html">eoRandomSelect&lt; Route &gt;</a> mig_select_one; <span class="comment">// emigrants are randomly selected </span>
<a name="l00106"></a>00106 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt; Route &gt;</a> mig_select( mig_select_one, MIG_SIZE );
<a name="l00107"></a>00107
<a name="l00108"></a>00108 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt; Route &gt;</a> mig_replace; <span class="comment">// immigrants replace the worse individuals</span>
<a name="l00109"></a>00109
<a name="l00110"></a>00110 <a class="code" href="classpeoSyncIslandMig.html">peoSyncIslandMig&lt; Route &gt;</a> mig( MIG_FREQ, mig_select, mig_replace, topology, population, population );
<a name="l00111"></a>00111 <span class="comment">//peoAsyncIslandMig&lt; Route &gt; mig( mig_cont, mig_select, mig_replace, topology, population, population );</span>
<a name="l00112"></a>00112
<a name="l00113"></a>00113 eaCheckpointContinue.add( mig );
<a name="l00114"></a>00114 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00115"></a>00115
<a name="l00116"></a>00116
<a name="l00117"></a>00117
<a name="l00118"></a>00118
<a name="l00119"></a>00119
<a name="l00120"></a>00120 <span class="comment">// ParadisEO-PEO evolutionary algorithm -----------------------------------------------------------------------------------------------------------</span>
<a name="l00121"></a>00121
<a name="l00122"></a>00122 <a class="code" href="classpeoEA.html">peoEA&lt; Route &gt;</a> eaAlg( eaCheckpointContinue, eaPopEval, eaSelect, eaTransform, eaReplace );
<a name="l00123"></a>00123
<a name="l00124"></a>00124 mig.setOwner( eaAlg );
<a name="l00125"></a>00125
<a name="l00126"></a>00126 eaAlg( population ); <span class="comment">// specifying the initial population for the algorithm, to be iteratively evolved</span>
<a name="l00127"></a>00127 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00128"></a>00128
<a name="l00129"></a>00129
<a name="l00130"></a>00130
<a name="l00131"></a>00131
<a name="l00132"></a>00132 <span class="comment">// evolutionary algorithm components --------------------------------------------------------------------------------------------------------------</span>
<a name="l00133"></a>00133
<a name="l00134"></a>00134 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt; Route &gt;</a> population2( POP_SIZE, route_init ); <span class="comment">// initial population for the algorithm having POP_SIZE individuals</span>
<a name="l00135"></a>00135 <a class="code" href="classpeoParaPopEval.html">peoParaPopEval&lt; Route &gt;</a> eaPopEval2( full_eval ); <span class="comment">// evaluator object - to be applied at each iteration on the entire population</span>
<a name="l00136"></a>00136
<a name="l00137"></a>00137 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_gen_continue.html">eoGenContinue&lt; Route &gt;</a> eaCont2( NUM_GEN ); <span class="comment">// continuation criterion - the algorithm will iterate for NUM_GEN generations</span>
<a name="l00138"></a>00138 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt; Route &gt;</a> eaCheckpointContinue2( eaCont2 ); <span class="comment">// checkpoint object - verify at each iteration if the continuation criterion is met</span>
<a name="l00139"></a>00139
<a name="l00140"></a>00140 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt; Route &gt;</a> selectionStrategy2; <span class="comment">// selection strategy - applied at each iteration for selecting parent individuals</span>
<a name="l00141"></a>00141 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt; Route &gt;</a> eaSelect2( selectionStrategy2, POP_SIZE ); <span class="comment">// selection object - POP_SIZE individuals are selected at each iteration</span>
<a name="l00142"></a>00142
<a name="l00143"></a>00143 <span class="comment">// transform operator - includes the crossover and the mutation operators with a specified associated rate</span>
<a name="l00144"></a>00144 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_s_g_a_transform.html">eoSGATransform&lt; Route &gt;</a> transform2( crossover, CROSS_RATE, mutation, MUT_RATE );
<a name="l00145"></a>00145 <a class="code" href="classpeoSeqTransform.html">peoSeqTransform&lt; Route &gt;</a> eaTransform2( transform2 ); <span class="comment">// ParadisEO transform operator (please remark the peo prefix) - wraps an e EO transform object</span>
<a name="l00146"></a>00146
<a name="l00147"></a>00147 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt; Route &gt;</a> eaReplace2; <span class="comment">// replacement strategy - for replacing the initial population with offspring individuals</span>
<a name="l00148"></a>00148 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00149"></a>00149
<a name="l00150"></a>00150
<a name="l00151"></a>00151
<a name="l00152"></a>00152
<a name="l00153"></a>00153 <span class="comment">// migration policy and components ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00154"></a>00154
<a name="l00155"></a>00155 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_periodic_continue.html">eoPeriodicContinue&lt; Route &gt;</a> mig_cont2( MIG_FREQ ); <span class="comment">// migration occurs periodically</span>
<a name="l00156"></a>00156
<a name="l00157"></a>00157 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_random_select.html">eoRandomSelect&lt; Route &gt;</a> mig_select_one2; <span class="comment">// emigrants are randomly selected </span>
<a name="l00158"></a>00158 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt; Route &gt;</a> mig_select2( mig_select_one2, MIG_SIZE );
<a name="l00159"></a>00159
<a name="l00160"></a>00160 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt; Route &gt;</a> mig_replace2; <span class="comment">// immigrants replace the worse individuals</span>
<a name="l00161"></a>00161
<a name="l00162"></a>00162 <a class="code" href="classpeoSyncIslandMig.html">peoSyncIslandMig&lt; Route &gt;</a> mig2( MIG_FREQ, mig_select2, mig_replace2, topology, population2, population2 );
<a name="l00163"></a>00163 <span class="comment">//peoAsyncIslandMig&lt; Route &gt; mig2( mig_cont2, mig_select2, mig_replace2, topology, population2, population2 );</span>
<a name="l00164"></a>00164
<a name="l00165"></a>00165 eaCheckpointContinue2.add( mig2 );
<a name="l00166"></a>00166 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00167"></a>00167
<a name="l00168"></a>00168
<a name="l00169"></a>00169
<a name="l00170"></a>00170
<a name="l00171"></a>00171
<a name="l00172"></a>00172 <span class="comment">// ParadisEO-PEO evolutionary algorithm -----------------------------------------------------------------------------------------------------------</span>
<a name="l00173"></a>00173
<a name="l00174"></a>00174 <a class="code" href="classpeoEA.html">peoEA&lt; Route &gt;</a> eaAlg2( eaCheckpointContinue2, eaPopEval2, eaSelect2, eaTransform2, eaReplace2 );
<a name="l00175"></a>00175
<a name="l00176"></a>00176 mig2.setOwner( eaAlg2 );
<a name="l00177"></a>00177
<a name="l00178"></a>00178 eaAlg2( population2 ); <span class="comment">// specifying the initial population for the algorithm, to be iteratively evolved</span>
<a name="l00179"></a>00179 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00180"></a>00180
<a name="l00181"></a>00181
<a name="l00182"></a>00182
<a name="l00183"></a>00183 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>( );
<a name="l00184"></a>00184 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>( );
<a name="l00185"></a>00185 <span class="comment">// shutting down the ParadisEO-PEO environment</span>
<a name="l00186"></a>00186
<a name="l00187"></a>00187 <span class="keywordflow">return</span> 0;
<a name="l00188"></a>00188 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Oct 8 11:16:45 2007 for ParadisEO-PEOMovingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -1,366 +0,0 @@
<!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>ParadisEO-PEOMovingObjects: main.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1>main.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// "main.cpp"</span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="comment">// (c) OPAC Team, LIFL, January 2006</span>
<a name="l00004"></a>00004
<a name="l00005"></a>00005 <span class="comment">/* </span>
<a name="l00006"></a>00006 <span class="comment"> Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00007"></a>00007 <span class="comment">*/</span>
<a name="l00008"></a>00008
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;eo&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;paradiseo&gt;</span>
<a name="l00011"></a>00011
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;peoParallelAlgorithmWrapper.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;peoSynchronousMultiStart.h&gt;</span>
<a name="l00014"></a>00014
<a name="l00015"></a>00015
<a name="l00016"></a>00016
<a name="l00017"></a>00017 <span class="preprocessor">#include "route.h"</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include "route_init.h"</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include "route_eval.h"</span>
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="preprocessor">#include "order_xover.h"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "city_swap.h"</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="preprocessor">#include "param.h"</span>
<a name="l00025"></a>00025
<a name="l00026"></a>00026
<a name="l00027"></a>00027
<a name="l00028"></a>00028
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;mo.h&gt;</span>
<a name="l00030"></a>00030
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;graph.h&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;route.h&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;route_eval.h&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;route_init.h&gt;</span>
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;two_opt.h&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;two_opt_init.h&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;two_opt_next.h&gt;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;two_opt_incr_eval.h&gt;</span>
<a name="l00040"></a>00040
<a name="l00041"></a>00041
<a name="l00042"></a>00042
<a name="l00043"></a>00043 <span class="preprocessor">#define RANDOM_POP_SIZE 30</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define RANDOM_ITERATIONS 10</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046
<a name="l00047"></a>00047 <span class="preprocessor">#define POP_SIZE 10</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define NUM_GEN 100</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#define CROSS_RATE 1.0</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#define MUT_RATE 0.01</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span>
<a name="l00052"></a>00052 <span class="preprocessor">#define NUMBER_OF_POPULATIONS 3</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span>
<a name="l00054"></a>00054
<a name="l00055"></a>00055
<a name="l00056"></a><a class="code" href="structRandomExplorationAlgorithm.html">00056</a> <span class="keyword">struct </span><a class="code" href="structRandomExplorationAlgorithm.html">RandomExplorationAlgorithm</a> {
<a name="l00057"></a>00057
<a name="l00058"></a><a class="code" href="structRandomExplorationAlgorithm.html#ed4847c164759fbb1168948d3620037c">00058</a> <a class="code" href="structRandomExplorationAlgorithm.html#ed4847c164759fbb1168948d3620037c">RandomExplorationAlgorithm</a>( <a class="code" href="classpeoPopEval.html">peoPopEval&lt; Route &gt;</a>&amp; __popEval, <a class="code" href="classpeoSynchronousMultiStart.html">peoSynchronousMultiStart&lt; Route &gt;</a>&amp; extParallelExecution )
<a name="l00059"></a>00059 : <a class="code" href="structRandomExplorationAlgorithm.html#e9fbab7402f290c62224cedebd9de0a4">popEval</a>( __popEval ), <a class="code" href="structRandomExplorationAlgorithm.html#e36e837e956772738773364cd71201de">parallelExecution</a>( extParallelExecution ) {
<a name="l00060"></a>00060 }
<a name="l00061"></a>00061
<a name="l00062"></a>00062
<a name="l00063"></a>00063 <span class="comment">// the sequential algorithm to be executed in parallel by the wrapper</span>
<a name="l00064"></a><a class="code" href="structRandomExplorationAlgorithm.html#3a7b3cc174726fff45985854c3d1b812">00064</a> <span class="keywordtype">void</span> <a class="code" href="structRandomExplorationAlgorithm.html#3a7b3cc174726fff45985854c3d1b812">operator()</a>() {
<a name="l00065"></a>00065
<a name="l00066"></a>00066 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_init.html">RouteInit</a> route_init; <span class="comment">// random init object - creates random Route objects</span>
<a name="l00067"></a>00067 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> route_eval;
<a name="l00068"></a>00068 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt; Route &gt;</a> population( RANDOM_POP_SIZE, route_init );
<a name="l00069"></a>00069
<a name="l00070"></a>00070 <a class="code" href="structRandomExplorationAlgorithm.html#e9fbab7402f290c62224cedebd9de0a4">popEval</a>( population );
<a name="l00071"></a>00071
<a name="l00072"></a>00072
<a name="l00073"></a>00073 <span class="comment">// executing HCs on the population in parallel</span>
<a name="l00074"></a>00074 <a class="code" href="structRandomExplorationAlgorithm.html#e36e837e956772738773364cd71201de">parallelExecution</a>( population );
<a name="l00075"></a>00075
<a name="l00076"></a>00076
<a name="l00077"></a>00077
<a name="l00078"></a>00078 <span class="comment">// just to show off :: HCs on a vector of Route objects</span>
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_vector.html">Route</a>* rVect = <span class="keyword">new</span> <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_vector.html">Route</a>[ 5 ];
<a name="l00081"></a>00081 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = 0; index &lt; 5; index++ ) {
<a name="l00082"></a>00082
<a name="l00083"></a>00083 route_init( rVect[ index ] ); route_eval( rVect[ index ] );
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085
<a name="l00086"></a>00086 <span class="comment">// applying the HCs on the vector of Route objects</span>
<a name="l00087"></a>00087 <a class="code" href="structRandomExplorationAlgorithm.html#e36e837e956772738773364cd71201de">parallelExecution</a>( rVect, rVect + 5 );
<a name="l00088"></a>00088 <span class="keyword">delete</span>[] rVect;
<a name="l00089"></a>00089 }
<a name="l00090"></a>00090
<a name="l00091"></a>00091
<a name="l00092"></a>00092
<a name="l00093"></a>00093 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_vector.html">Route</a> bestRoute = population.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#bd89eb233cb6af943eab45f2533d06cf">best_element</a>();
<a name="l00094"></a>00094
<a name="l00095"></a>00095 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = 0; index &lt; RANDOM_ITERATIONS; index++ ) {
<a name="l00096"></a>00096
<a name="l00097"></a>00097 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> routeIndex = 0; routeIndex &lt; RANDOM_POP_SIZE; routeIndex++ ) {
<a name="l00098"></a>00098
<a name="l00099"></a>00099 route_init( population[ routeIndex ] );
<a name="l00100"></a>00100 }
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <a class="code" href="structRandomExplorationAlgorithm.html#e9fbab7402f290c62224cedebd9de0a4">popEval</a>( population );
<a name="l00103"></a>00103
<a name="l00104"></a>00104 <span class="keywordflow">if</span> ( fabs( population.best_element().fitness() ) &lt; fabs( bestRoute.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/class_e_o.html#57d5610c9296eb927816a2f06bd00a08">fitness</a>() ) ) bestRoute = population.best_element();
<a name="l00105"></a>00105
<a name="l00106"></a>00106 std::cout &lt;&lt; <span class="stringliteral">"Random Iteration #"</span> &lt;&lt; index &lt;&lt; <span class="stringliteral">"... [ "</span> &lt;&lt; bestRoute.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/class_e_o.html#57d5610c9296eb927816a2f06bd00a08">fitness</a>() &lt;&lt; <span class="stringliteral">" ]"</span> &lt;&lt; std::flush &lt;&lt; std::endl;
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109
<a name="l00110"></a>00110
<a name="l00111"></a><a class="code" href="structRandomExplorationAlgorithm.html#e9fbab7402f290c62224cedebd9de0a4">00111</a> <a class="code" href="classpeoPopEval.html">peoPopEval&lt; Route &gt;</a>&amp; <a class="code" href="structRandomExplorationAlgorithm.html#e9fbab7402f290c62224cedebd9de0a4">popEval</a>;
<a name="l00112"></a><a class="code" href="structRandomExplorationAlgorithm.html#e36e837e956772738773364cd71201de">00112</a> <a class="code" href="classpeoSynchronousMultiStart.html">peoSynchronousMultiStart&lt; Route &gt;</a>&amp; <a class="code" href="structRandomExplorationAlgorithm.html#e36e837e956772738773364cd71201de">parallelExecution</a>;
<a name="l00113"></a>00113 };
<a name="l00114"></a>00114
<a name="l00115"></a>00115
<a name="l00116"></a>00116
<a name="l00117"></a>00117
<a name="l00118"></a>00118 <span class="keywordtype">int</span> main( <span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span>** __argv ) {
<a name="l00119"></a>00119
<a name="l00120"></a>00120 srand( time(NULL) );
<a name="l00121"></a>00121
<a name="l00122"></a>00122
<a name="l00123"></a>00123
<a name="l00124"></a>00124 <span class="comment">// initializing the ParadisEO-PEO environment</span>
<a name="l00125"></a>00125 <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">peo :: init</a>( __argc, __argv );
<a name="l00126"></a>00126
<a name="l00127"></a>00127
<a name="l00128"></a>00128 <span class="comment">// processing the command line specified parameters</span>
<a name="l00129"></a>00129 loadParameters( __argc, __argv );
<a name="l00130"></a>00130
<a name="l00131"></a>00131
<a name="l00132"></a>00132
<a name="l00133"></a>00133 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00134"></a>00134 <span class="comment">// #1 An EO evolutionary algorithm to be executed in parallel with other algorithms (no parallel evaluation, no etc.).</span>
<a name="l00135"></a>00135
<a name="l00136"></a>00136 <span class="comment">// init, eval operators, EA operators -------------------------------------------------------------------------------------------------------------</span>
<a name="l00137"></a>00137 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_init.html">RouteInit</a> route_init; <span class="comment">// random init object - creates random Route objects</span>
<a name="l00138"></a>00138 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> full_eval; <span class="comment">// evaluator object - offers a fitness value for a specified Route object</span>
<a name="l00139"></a>00139
<a name="l00140"></a>00140 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_order_xover.html">OrderXover</a> crossover; <span class="comment">// crossover operator - creates two offsprings out of two specified parents</span>
<a name="l00141"></a>00141 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_city_swap.html">CitySwap</a> mutation; <span class="comment">// mutation operator - randomly mutates one gene for a specified individual</span>
<a name="l00142"></a>00142 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00143"></a>00143
<a name="l00144"></a>00144
<a name="l00145"></a>00145 <span class="comment">// evolutionary algorithm components --------------------------------------------------------------------------------------------------------------</span>
<a name="l00146"></a>00146
<a name="l00147"></a>00147 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt; Route &gt;</a> population( POP_SIZE, route_init ); <span class="comment">// initial population for the algorithm having POP_SIZE individuals</span>
<a name="l00148"></a>00148
<a name="l00149"></a>00149 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_gen_continue.html">eoGenContinue&lt; Route &gt;</a> eaCont( NUM_GEN ); <span class="comment">// continuation criterion - the algorithm will iterate for NUM_GEN generations</span>
<a name="l00150"></a>00150 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint&lt; Route &gt;</a> eaCheckpointContinue( eaCont ); <span class="comment">// checkpoint object - verify at each iteration if the continuation criterion is met</span>
<a name="l00151"></a>00151
<a name="l00152"></a>00152 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_ranking_select.html">eoRankingSelect&lt; Route &gt;</a> selectionStrategy; <span class="comment">// selection strategy - applied at each iteration for selecting parent individuals</span>
<a name="l00153"></a>00153 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_select_number.html">eoSelectNumber&lt; Route &gt;</a> eaSelect( selectionStrategy, POP_SIZE ); <span class="comment">// selection object - POP_SIZE individuals are selected at each iteration</span>
<a name="l00154"></a>00154
<a name="l00155"></a>00155 <span class="comment">// transform operator - includes the crossover and the mutation operators with a specified associated rate</span>
<a name="l00156"></a>00156 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_s_g_a_transform.html">eoSGATransform&lt; Route &gt;</a> transform( crossover, CROSS_RATE, mutation, MUT_RATE );
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_plus_replacement.html">eoPlusReplacement&lt; Route &gt;</a> eaReplace; <span class="comment">// replacement strategy - for replacing the initial population with offspring individuals</span>
<a name="l00159"></a>00159 <span class="comment">// ------------------------------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00160"></a>00160
<a name="l00161"></a>00161
<a name="l00162"></a>00162
<a name="l00163"></a>00163 <span class="comment">// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00164"></a>00164 <span class="comment">// SEQENTIAL ALGORITHM DEFINITION -----------------------------------------------------------------------------------------------------------------</span>
<a name="l00165"></a>00165 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_easy_e_a.html">eoEasyEA&lt; Route &gt;</a> eaAlg( eaCheckpointContinue, full_eval, eaSelect, transform, eaReplace );
<a name="l00166"></a>00166 <span class="comment">// SEQENTIAL ALGORITHM DEFINITION -----------------------------------------------------------------------------------------------------------------</span>
<a name="l00167"></a>00167
<a name="l00168"></a>00168 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00169"></a>00169 <a class="code" href="classpeoParallelAlgorithmWrapper.html">peoParallelAlgorithmWrapper</a> parallelEAAlg( eaAlg, population ); <span class="comment">// specifying the embedded algorithm and the algorithm input data</span>
<a name="l00170"></a>00170 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00171"></a>00171 <span class="comment">// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00172"></a>00172 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00173"></a>00173
<a name="l00174"></a>00174
<a name="l00175"></a>00175
<a name="l00176"></a>00176
<a name="l00177"></a>00177
<a name="l00178"></a>00178 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00179"></a>00179 <span class="comment">// #2 A MO hill climbing to be executed in parallel with other algorithms (no parallel evaluation, no etc.).</span>
<a name="l00180"></a>00180
<a name="l00181"></a>00181 <span class="keywordflow">if</span> ( getNodeRank() == 1 ) {
<a name="l00182"></a>00182
<a name="l00183"></a>00183 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/namespace_graph.html#95f0bc08fa93f8f4abf1801674488b30">Graph::load</a>( __argv [ 1 ] );
<a name="l00184"></a>00184 }
<a name="l00185"></a>00185
<a name="l00186"></a>00186 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_vector.html">Route</a> route;
<a name="l00187"></a>00187 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_init.html">RouteInit</a> <a class="code" href="namespacepeo.html#8184c3b1f7eecc68f69bb8e8b872a7d3">init</a>; init( route );
<a name="l00188"></a>00188 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> full_evalHC; full_evalHC( route );
<a name="l00189"></a>00189
<a name="l00190"></a>00190 <span class="keywordflow">if</span> ( getNodeRank() == 1 ) {
<a name="l00191"></a>00191
<a name="l00192"></a>00192 std :: cout &lt;&lt; <span class="stringliteral">"[From] "</span> &lt;&lt; route &lt;&lt; std :: endl;
<a name="l00193"></a>00193 }
<a name="l00194"></a>00194
<a name="l00195"></a>00195
<a name="l00196"></a>00196 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_two_opt_init.html">TwoOptInit</a> two_opt_init;
<a name="l00197"></a>00197 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_two_opt_next.html">TwoOptNext</a> two_opt_next;
<a name="l00198"></a>00198 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_two_opt_incr_eval.html">TwoOptIncrEval</a> two_opt_incr_eval;
<a name="l00199"></a>00199
<a name="l00200"></a>00200 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/classmo_best_impr_select.html">moBestImprSelect&lt; TwoOpt &gt;</a> two_opt_select;
<a name="l00201"></a>00201
<a name="l00202"></a>00202
<a name="l00203"></a>00203
<a name="l00204"></a>00204 <span class="comment">// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00205"></a>00205 <span class="comment">// SEQENTIAL ALGORITHM DEFINITION -----------------------------------------------------------------------------------------------------------------</span>
<a name="l00206"></a>00206 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/classmo_h_c.html">moHC&lt; TwoOpt &gt;</a> hill_climbing( two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_select, full_evalHC );
<a name="l00207"></a>00207 <span class="comment">// SEQENTIAL ALGORITHM DEFINITION -----------------------------------------------------------------------------------------------------------------</span>
<a name="l00208"></a>00208
<a name="l00209"></a>00209 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00210"></a>00210 <a class="code" href="classpeoParallelAlgorithmWrapper.html">peoParallelAlgorithmWrapper</a> parallelHillClimbing( hill_climbing, route ); <span class="comment">// specifying the embedded algorithm and the algorithm input data</span>
<a name="l00211"></a>00211 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00212"></a>00212 <span class="comment">// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00213"></a>00213 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00214"></a>00214
<a name="l00215"></a>00215
<a name="l00216"></a>00216
<a name="l00217"></a>00217
<a name="l00218"></a>00218
<a name="l00219"></a>00219
<a name="l00220"></a>00220 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00221"></a>00221 <span class="comment">// #3 A user defined algorithm to be executed in parallel with other algorithms - parallel evaluation and synchronous </span>
<a name="l00222"></a>00222 <span class="comment">// multi-start of several hill-climbing algorithms (inside the user defined algorithm)!!.</span>
<a name="l00223"></a>00223
<a name="l00224"></a>00224 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> full_evalRandom;
<a name="l00225"></a>00225 <a class="code" href="classpeoParaPopEval.html">peoParaPopEval&lt; Route &gt;</a> randomParaEval( full_evalRandom );
<a name="l00226"></a>00226
<a name="l00227"></a>00227
<a name="l00228"></a>00228 <a class="code" href="classpeoSynchronousMultiStart.html">peoSynchronousMultiStart&lt; Route &gt;</a> parallelExecution( hill_climbing );
<a name="l00229"></a>00229
<a name="l00230"></a>00230 <a class="code" href="structRandomExplorationAlgorithm.html">RandomExplorationAlgorithm</a> randomExplorationAlgorithm( randomParaEval, parallelExecution );
<a name="l00231"></a>00231
<a name="l00232"></a>00232
<a name="l00233"></a>00233 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00234"></a>00234 <a class="code" href="classpeoParallelAlgorithmWrapper.html">peoParallelAlgorithmWrapper</a> parallelRandExp( randomExplorationAlgorithm ); <span class="comment">// specifying the embedded algorithm - no input data in this case</span>
<a name="l00235"></a>00235
<a name="l00236"></a>00236 randomParaEval.setOwner( parallelRandExp );
<a name="l00237"></a>00237 parallelExecution.setOwner( parallelRandExp );
<a name="l00238"></a>00238 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00239"></a>00239 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00240"></a>00240
<a name="l00241"></a>00241
<a name="l00242"></a>00242
<a name="l00243"></a>00243
<a name="l00244"></a>00244 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00245"></a>00245 <span class="comment">// #4 Synchronous Multi-Start: several hill-climbing algorithms launched in parallel on different initial solutions</span>
<a name="l00246"></a>00246
<a name="l00247"></a>00247 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_init.html">RouteInit</a> ex_hc_route_init; <span class="comment">// random init object - creates random Route objects</span>
<a name="l00248"></a>00248 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> ex_hc_full_eval; <span class="comment">// evaluator object - offers a fitness value for a specified Route object</span>
<a name="l00249"></a>00249
<a name="l00250"></a>00250 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop&lt; Route &gt;</a> ex_hc_population( POP_SIZE, ex_hc_route_init );
<a name="l00251"></a>00251
<a name="l00252"></a>00252 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = 0; index &lt; POP_SIZE; index++ ) {
<a name="l00253"></a>00253
<a name="l00254"></a>00254 ex_hc_full_eval( ex_hc_population[ index ] );
<a name="l00255"></a>00255 }
<a name="l00256"></a>00256
<a name="l00257"></a>00257
<a name="l00258"></a>00258 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00259"></a>00259 <a class="code" href="classpeoSynchronousMultiStart.html">peoSynchronousMultiStart&lt; Route &gt;</a> ex_hc_parallelExecution( hill_climbing );
<a name="l00260"></a>00260 <a class="code" href="classpeoParallelAlgorithmWrapper.html">peoParallelAlgorithmWrapper</a> ex_hc_parallel( ex_hc_parallelExecution, ex_hc_population ); <span class="comment">// specifying the embedded algorithm - no input data in this case</span>
<a name="l00261"></a>00261
<a name="l00262"></a>00262 ex_hc_parallelExecution.setOwner( ex_hc_parallel );
<a name="l00263"></a>00263 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00264"></a>00264 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00265"></a>00265
<a name="l00266"></a>00266
<a name="l00267"></a>00267
<a name="l00268"></a>00268
<a name="l00269"></a>00269
<a name="l00270"></a>00270 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00271"></a>00271 <span class="comment">// #5 Synchronous Multi-Start: Multiple EO evolutionary algorithms to be executed in parallel</span>
<a name="l00272"></a>00272 <span class="comment">// (inside different processes, on different populations; no parallel evaluation, no etc.).</span>
<a name="l00273"></a>00273
<a name="l00274"></a>00274 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_init.html">RouteInit</a> ex_route_init; <span class="comment">// random init object - creates random Route objects</span>
<a name="l00275"></a>00275 <a class="codeRef" doxygen="mo.doxytag:/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/" href="/data/OPAC/software/paradisEO/repository/paradiseo/trunk/paradiseo-peo/build/../../paradiseo-mo/build/doc/html/class_route_eval.html">RouteEval</a> ex_full_eval; <span class="comment">// evaluator object - offers a fitness value for a specified Route object</span>
<a name="l00276"></a>00276
<a name="l00277"></a>00277 std::vector&lt; eoPop&lt; Route &gt; &gt; ex_population;
<a name="l00278"></a>00278 ex_population.resize( NUMBER_OF_POPULATIONS );
<a name="l00279"></a>00279
<a name="l00280"></a>00280 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> indexPop = 0; indexPop &lt; NUMBER_OF_POPULATIONS; indexPop++ ) {
<a name="l00281"></a>00281
<a name="l00282"></a>00282 ex_population[ indexPop ].resize( POP_SIZE );
<a name="l00283"></a>00283
<a name="l00284"></a>00284 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = 0; index &lt; POP_SIZE; index++ ) {
<a name="l00285"></a>00285
<a name="l00286"></a>00286 ex_route_init( ex_population[ indexPop ][ index ] );
<a name="l00287"></a>00287 ex_full_eval( ex_population[ indexPop ][ index ] );
<a name="l00288"></a>00288 }
<a name="l00289"></a>00289 }
<a name="l00290"></a>00290
<a name="l00291"></a>00291
<a name="l00292"></a>00292 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00293"></a>00293 <a class="code" href="classpeoSynchronousMultiStart.html">peoSynchronousMultiStart&lt; eoPop&lt; Route &gt;</a> &gt; ex_parallelExecution( eaAlg );
<a name="l00294"></a>00294 <a class="code" href="classpeoParallelAlgorithmWrapper.html">peoParallelAlgorithmWrapper</a> ex_parallel( ex_parallelExecution, ex_population ); <span class="comment">// specifying the embedded algorithm - no input data in this case</span>
<a name="l00295"></a>00295
<a name="l00296"></a>00296 ex_parallelExecution.setOwner( ex_parallel );
<a name="l00297"></a>00297 <span class="comment">// SETTING UP THE PARALLEL WRAPPER ----------------------------------------------------------------------------------------------------------------</span>
<a name="l00298"></a>00298 <span class="comment">// &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span>
<a name="l00299"></a>00299
<a name="l00300"></a>00300
<a name="l00301"></a>00301
<a name="l00302"></a>00302
<a name="l00303"></a>00303
<a name="l00304"></a>00304
<a name="l00305"></a>00305 <a class="code" href="namespacepeo.html#10819b2d60b37477c6a89b60c595c67c">peo :: run</a>( );
<a name="l00306"></a>00306 <a class="code" href="namespacepeo.html#f90478489cc92d1e6abb222179163a30">peo :: finalize</a>( );
<a name="l00307"></a>00307 <span class="comment">// shutting down the ParadisEO-PEO environment</span>
<a name="l00308"></a>00308
<a name="l00309"></a>00309
<a name="l00310"></a>00310
<a name="l00311"></a>00311 <span class="comment">// the algorithm is executed in the #1 rank process</span>
<a name="l00312"></a>00312 <span class="keywordflow">if</span> ( getNodeRank() == 1 ) {
<a name="l00313"></a>00313
<a name="l00314"></a>00314 std :: cout &lt;&lt; <span class="stringliteral">"[To] "</span> &lt;&lt; route &lt;&lt; std :: endl &lt;&lt; std::endl;
<a name="l00315"></a>00315
<a name="l00316"></a>00316
<a name="l00317"></a>00317 std :: cout &lt;&lt; <span class="stringliteral">"Synchronous Multi-Start HCs:"</span> &lt;&lt; std :: endl ;
<a name="l00318"></a>00318 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = 0; index &lt; POP_SIZE; index++ ) {
<a name="l00319"></a>00319
<a name="l00320"></a>00320 std::cout &lt;&lt; ex_hc_population[ index ] &lt;&lt; std::endl;
<a name="l00321"></a>00321 }
<a name="l00322"></a>00322 std::cout &lt;&lt; std::endl &lt;&lt; std::endl;
<a name="l00323"></a>00323
<a name="l00324"></a>00324
<a name="l00325"></a>00325 std :: cout &lt;&lt; <span class="stringliteral">"Synchronous Multi-Start EAs:"</span> &lt;&lt; std :: endl ;
<a name="l00326"></a>00326 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = 0; index &lt; NUMBER_OF_POPULATIONS; index++ ) {
<a name="l00327"></a>00327
<a name="l00328"></a>00328 std::cout &lt;&lt; ex_population[ index ] &lt;&lt; std::endl;
<a name="l00329"></a>00329 }
<a name="l00330"></a>00330 std::cout &lt;&lt; std::endl &lt;&lt; std::flush;
<a name="l00331"></a>00331
<a name="l00332"></a>00332 }
<a name="l00333"></a>00333
<a name="l00334"></a>00334
<a name="l00335"></a>00335
<a name="l00336"></a>00336 <span class="keywordflow">return</span> 0;
<a name="l00337"></a>00337 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Oct 8 11:16:45 2007 for ParadisEO-PEOMovingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -98,7 +98,7 @@
<a name="l00074"></a>00074 ===================================================================
<a name="l00075"></a>00075
<a name="l00076"></a>00076 Mailing list : paradiseo-help@lists.gforge.inria.fr
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:28:20 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>

View file

@ -95,7 +95,7 @@
<tr><td class="indexkey"><a class="el" href="classTwoOptRand.html">TwoOptRand</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><a class="el" href="classWorker.html">Worker</a></td><td class="indexvalue"></td></tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:28:20 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>

View file

@ -72,7 +72,7 @@
<a name="l00048"></a>00048
<a name="l00049"></a>00049 <span class="keywordflow">return</span> true ;
<a name="l00050"></a>00050 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:28:20 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>

View file

@ -75,7 +75,7 @@
<a name="l00053"></a>00053 } ;
<a name="l00054"></a>00054
<a name="l00055"></a>00055 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:28:20 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:10 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>

View file

@ -0,0 +1,49 @@
<!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>ParadisEO-PEO-ParallelanddistributedEvolvingObjects: Member List</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li id="current"><a href="classes.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul></div>
<h1>CitySwap Member List</h1>This is the complete list of members for <a class="el" href="classCitySwap.html">CitySwap</a>, including all inherited members.<p><table>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_mon_op.html#0dc1d253f0bd267f27ba8db63beea7f6">className</a>() const </td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_mon_op.html">eoMonOp&lt; EOType &gt;</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_mon_op.html#8dce578ea839d0ea6f2b0e4585b58c86">eoMonOp</a>()</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_mon_op.html">eoMonOp&lt; EOType &gt;</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html#5b9ae9bfcd36ab9cfbc2940039190bdc">eoOp</a>(OpType _type)</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html">eoOp&lt; EOType &gt;</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html#66db208d9e3c9f7920aafa198af07e79">eoOp</a>(const eoOp &amp;_eop)</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html">eoOp&lt; EOType &gt;</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_u_f.html#cbcdc56d1ffcab42c6dbd8b449b5f4c8">functor_category</a>()</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_u_f.html">eoUF&lt; EOType &amp;, bool &gt;</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html#f58534db7113ec9919ecdb69b661eb60">getType</a>() const </td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html">eoOp&lt; EOType &gt;</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classCitySwap.html#7e6958b62048c89604cbf046b86bdf2d">operator()</a>(Route &amp;__route)</td><td><a class="el" href="classCitySwap.html">CitySwap</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_u_f.html#786e028409366dc273e19104f17ba68a">eoMonOp::operator()</a>(EOType &amp;)=0</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_u_f.html">eoUF&lt; EOType &amp;, bool &gt;</a></td><td><code> [pure virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html#04aa988c26acbc7e41e96cae0bd415cc">OpType</a> enum name</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html">eoOp&lt; EOType &gt;</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_functor_base.html#8c8feaced1598f8445a94c22d69dbd31">~eoFunctorBase</a>()</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_functor_base.html">eoFunctorBase</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html#4d42fee3eb192bc52b184cd098f91850">~eoOp</a>()</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html">eoOp&lt; EOType &gt;</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_u_f.html#ed542967512c7a8f2ba6472a0c5c128d">~eoUF</a>()</td><td><a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_u_f.html">eoUF&lt; EOType &amp;, bool &gt;</a></td><td><code> [virtual]</code></td></tr>
</table><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:11 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

View file

@ -0,0 +1,63 @@
<!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>ParadisEO-PEO-ParallelanddistributedEvolvingObjects: CitySwap Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li id="current"><a href="classes.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul></div>
<h1>CitySwap Class Reference</h1><!-- doxytag: class="CitySwap" --><!-- doxytag: inherits="eoMonOp" -->Its swaps two vertices randomly choosen.
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="city__swap_8h-source.html">city_swap.h</a>&gt;</code>
<p>
<p>Inheritance diagram for CitySwap:
<p><center><img src="classCitySwap.png" usemap="#CitySwap_map" border="0" alt=""></center>
<map name="CitySwap_map">
<area doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_mon_op.html" alt="eoMonOp< EOType >" shape="rect" coords="84,112,243,136">
<area doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_op.html" alt="eoOp< EOType >" shape="rect" coords="0,56,159,80">
<area doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_u_f.html" alt="eoUF< EOType &, bool >" shape="rect" coords="169,56,328,80">
<area doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_functor_base.html" alt="eoFunctorBase" shape="rect" coords="169,0,328,24">
</map>
<a href="classCitySwap-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7e6958b62048c89604cbf046b86bdf2d"></a><!-- doxytag: member="CitySwap::operator()" ref="7e6958b62048c89604cbf046b86bdf2d" args="(Route &amp;__route)" -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCitySwap.html#7e6958b62048c89604cbf046b86bdf2d">operator()</a> (<a class="elRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_vector.html">Route</a> &amp;__route)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Its swaps two vertices randomly choosen.
<p>
<p>
Definition at line <a class="el" href="city__swap_8h-source.html#l00046">46</a> of file <a class="el" href="city__swap_8h-source.html">city_swap.h</a>.<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="city__swap_8h-source.html">city_swap.h</a><li><a class="el" href="city__swap_8cpp-source.html">city_swap.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:11 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -41,7 +41,7 @@
<tr class="memlist"><td><a class="el" href="classCommunicable.html#cb53e6534b947bc889aa181d9dbbd13b">stop</a>()</td><td><a class="el" href="classCommunicable.html">Communicable</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classCommunicable.html#caa814847192e71f434fbf9479ede862">unlock</a>()</td><td><a class="el" href="classCommunicable.html">Communicable</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classCommunicable.html#2280b0dfa0d3a515fccf62c2a9fd5f41">~Communicable</a>()</td><td><a class="el" href="classCommunicable.html">Communicable</a></td><td><code> [virtual]</code></td></tr>
</table><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:28:20 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
</table><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:11 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>

View file

@ -89,7 +89,7 @@ sem_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="cla
<p>
Definition at line <a class="el" href="communicable_8h-source.html#l00045">45</a> of file <a class="el" href="communicable_8h-source.html">communicable.h</a>.<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="communicable_8h-source.html">communicable.h</a><li><a class="el" href="communicable_8cpp-source.html">communicable.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:28:20 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:11 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>

View file

@ -39,7 +39,7 @@
<tr class="memlist"><td><a class="el" href="classThread.html#95c703fb8f2f27cb64f475a8c940864a">Thread</a>()</td><td><a class="el" href="classThread.html">Thread</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classReactiveThread.html#a724a54575de10f09cc03ab7aa4e59ce">wakeUp</a>()</td><td><a class="el" href="classReactiveThread.html">ReactiveThread</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classThread.html#37d9edd3a1a776cbc27dedff949c9726">~Thread</a>()</td><td><a class="el" href="classThread.html">Thread</a></td><td><code> [virtual]</code></td></tr>
</table><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:28:21 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
</table><hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:11 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>

View file

@ -52,7 +52,7 @@ void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="clas
<p>
Definition at line <a class="el" href="comm_8h-source.html#l00043">43</a> of file <a class="el" href="comm_8h-source.html">comm.h</a>.<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="comm_8h-source.html">comm.h</a><li><a class="el" href="comm_8cpp-source.html">comm.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:28:21 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 13 09:43:11 2008 for ParadisEO-PEO-ParallelanddistributedEvolvingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>

Some files were not shown because too many files have changed in this diff Show more