git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
69 lines
5.7 KiB
HTML
69 lines
5.7 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>EO: eoG3Replacement.h Source File</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.3.9.1 -->
|
|
<div class="qindex"> <form class="search" action="search.php" method="get">
|
|
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
|
|
<div class="nav">
|
|
<a class="el" href="dir_000000.html">src</a></div>
|
|
<h1>eoG3Replacement.h</h1><div class="fragment"><pre class="fragment">00001
|
|
00024 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00025
|
|
00026 <span class="preprocessor">#ifndef _eoG3Replacement_h</span>
|
|
00027 <span class="preprocessor"></span><span class="preprocessor">#define _eoG3Replacement_h</span>
|
|
00028 <span class="preprocessor"></span>
|
|
00029
|
|
00030 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00031 <span class="preprocessor">#include <eoPop.h></span>
|
|
00032 <span class="preprocessor">#include <eoFunctor.h></span>
|
|
00033 <span class="preprocessor">#include <eoMerge.h></span>
|
|
00034 <span class="preprocessor">#include <eoReduce.h></span>
|
|
00035 <span class="preprocessor">#include <utils/eoHowMany.h></span>
|
|
00036 <span class="preprocessor">#include <eoReduceSplit.h></span>
|
|
00037 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00038
|
|
00049 <span class="keyword">template</span> <<span class="keyword">class</span> EOT>
|
|
<a name="l00050"></a><a class="code" href="classeo_g3_replacement.html">00050</a> <span class="keyword">class </span><a class="code" href="classeo_g3_replacement.html">eoG3Replacement</a> : <span class="keyword">public</span> <a class="code" href="classeo_replacement.html">eoReplacement</a><EOT>
|
|
00051 {
|
|
00052 <span class="keyword">public</span>:
|
|
00053 <a class="code" href="classeo_g3_replacement.html">eoG3Replacement</a>(<a class="code" href="classeo_how_many.html">eoHowMany</a> _howManyEliminatedParents = <a class="code" href="classeo_how_many.html">eoHowMany</a>(2, <span class="keyword">false</span>)) :
|
|
00054 <span class="comment">// split truncates the parents and returns eliminated parents</span>
|
|
00055 split(_howManyEliminatedParents, <span class="keyword">true</span>),
|
|
00056 <span class="comment">// reduce truncates the offpsring and does not return eliminated guys</span>
|
|
00057 reduce(-_howManyEliminatedParents, <span class="keyword">false</span>)
|
|
00058 {}
|
|
00059
|
|
<a name="l00060"></a><a class="code" href="classeo_g3_replacement.html#a1">00060</a> <span class="keywordtype">void</span> <a class="code" href="classeo_g3_replacement.html#a1">operator()</a>(<a class="code" href="classeo_pop.html">eoPop<EOT></a> & _parents, <a class="code" href="classeo_pop.html">eoPop<EOT></a> & _offspring)
|
|
00061 {
|
|
00062 <a class="code" href="classeo_pop.html">eoPop<EOT></a> temp;
|
|
00063 split(_parents, temp);
|
|
00064 <span class="keywordtype">unsigned</span> toKeep = temp.size(); <span class="comment">// how many to keep from merged populations</span>
|
|
00065 <span class="comment">// merge temp into offspring</span>
|
|
00066 plus(temp, _offspring); <span class="comment">// add temp to _offspring (a little inconsistent!)</span>
|
|
00067
|
|
00068 <span class="comment">// reduce merged</span>
|
|
00069 reduce(_offspring, temp); <span class="comment">// temp dummy arg. will not be modified</span>
|
|
00070 <span class="comment">// minimla check:</span>
|
|
00071 <span class="keywordflow">if</span> (_offspring.size() != toKeep)
|
|
00072 {
|
|
00073 std::cerr << <span class="stringliteral">"Les tailles "</span> << _offspring.size() << <span class="stringliteral">" "</span> << toKeep << std::endl;
|
|
00074 <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">"eoG3Replacement: wrong number of remaining offspring"</span>);
|
|
00075 }
|
|
00076 <span class="comment">// and put back into _parents</span>
|
|
00077 plus(_offspring, _parents);
|
|
00078 }
|
|
00079
|
|
00080 <span class="keyword">private</span>:
|
|
00081 <a class="code" href="classeo_linear_truncate_split.html">eoLinearTruncateSplit<EOT></a> split; <span class="comment">// few parents to truncate -> linear </span>
|
|
00082 <a class="code" href="classeo_truncate_split.html">eoTruncateSplit<EOT></a> reduce; <span class="comment">// supposedly many offspring to truncate</span>
|
|
00083 <a class="code" href="classeo_plus.html">eoPlus<EOT></a> plus;
|
|
00084 };
|
|
00085
|
|
00086 <span class="preprocessor">#endif</span>
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 05:06:35 2006 for EO by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
|
|
</body>
|
|
</html>
|