git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
99 lines
7.8 KiB
HTML
99 lines
7.8 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: eoGeneralBreeder.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>eoGeneralBreeder.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-</span>
|
|
00002
|
|
00003 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00004 <span class="comment">// eoGeneralBreeder.h </span>
|
|
00005 <span class="comment">// (c) Maarten Keijzer and Marc Schoenauer, 2001</span>
|
|
00006 <span class="comment">/* </span>
|
|
00007 <span class="comment"> This library is free software; you can redistribute it and/or</span>
|
|
00008 <span class="comment"> modify it under the terms of the GNU Lesser General Public</span>
|
|
00009 <span class="comment"> License as published by the Free Software Foundation; either</span>
|
|
00010 <span class="comment"> version 2 of the License, or (at your option) any later version.</span>
|
|
00011 <span class="comment"></span>
|
|
00012 <span class="comment"> This library is distributed in the hope that it will be useful,</span>
|
|
00013 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
|
00014 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
|
|
00015 <span class="comment"> Lesser General Public License for more details.</span>
|
|
00016 <span class="comment"></span>
|
|
00017 <span class="comment"> You should have received a copy of the GNU Lesser General Public</span>
|
|
00018 <span class="comment"> License along with this library; if not, write to the Free Software</span>
|
|
00019 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
|
|
00020 <span class="comment"></span>
|
|
00021 <span class="comment"> Contact: mkeijzer@dhi.dk</span>
|
|
00022 <span class="comment"> Marc.Schoenauer@polytechnique.fr</span>
|
|
00023 <span class="comment"> */</span>
|
|
00024 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00025
|
|
00026 <span class="preprocessor">#ifndef eoGeneralBreeder_h</span>
|
|
00027 <span class="preprocessor"></span><span class="preprocessor">#define eoGeneralBreeder_h</span>
|
|
00028 <span class="preprocessor"></span>
|
|
00029 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00030
|
|
00031 <span class="comment">/*****************************************************************************</span>
|
|
00032 <span class="comment"> * eoGeneralBreeder: transforms a population using the generalOp construct.</span>
|
|
00033 <span class="comment"> *****************************************************************************/</span>
|
|
00034
|
|
00035 <span class="preprocessor">#include <eoOp.h></span>
|
|
00036 <span class="preprocessor">#include <eoGenOp.h></span>
|
|
00037 <span class="preprocessor">#include <eoPopulator.h></span>
|
|
00038 <span class="preprocessor">#include <eoSelectOne.h></span>
|
|
00039 <span class="preprocessor">#include <eoBreed.h></span>
|
|
00040 <span class="preprocessor">#include <utils/eoHowMany.h></span>
|
|
00041
|
|
00045 <span class="keyword">template</span><<span class="keyword">class</span> EOT>
|
|
<a name="l00046"></a><a class="code" href="classeo_general_breeder.html">00046</a> <span class="keyword">class </span><a class="code" href="classeo_general_breeder.html">eoGeneralBreeder</a>: <span class="keyword">public</span> <a class="code" href="classeo_breed.html">eoBreed</a><EOT>
|
|
00047 {
|
|
00048 <span class="keyword">public</span>:
|
|
<a name="l00056"></a><a class="code" href="classeo_general_breeder.html#a0">00056</a> <a class="code" href="classeo_general_breeder.html#a0">eoGeneralBreeder</a>(
|
|
00057 <a class="code" href="classeo_select_one.html">eoSelectOne<EOT></a>& _select,
|
|
00058 <a class="code" href="classeo_gen_op.html">eoGenOp<EOT></a>& _op,
|
|
00059 <span class="keywordtype">double</span> _rate=1.0,
|
|
00060 <span class="keywordtype">bool</span> _interpret_as_rate = <span class="keyword">true</span>) :
|
|
00061 select( _select ), op(_op), howMany(_rate, _interpret_as_rate) {}
|
|
00062
|
|
<a name="l00069"></a><a class="code" href="classeo_general_breeder.html#a1">00069</a> <a class="code" href="classeo_general_breeder.html#a0">eoGeneralBreeder</a>(
|
|
00070 <a class="code" href="classeo_select_one.html">eoSelectOne<EOT></a>& _select,
|
|
00071 <a class="code" href="classeo_gen_op.html">eoGenOp<EOT></a>& _op,
|
|
00072 <a class="code" href="classeo_how_many.html">eoHowMany</a> _howMany ) :
|
|
00073 select( _select ), op(_op), howMany(_howMany) {}
|
|
00074
|
|
<a name="l00080"></a><a class="code" href="classeo_general_breeder.html#a2">00080</a> <span class="keywordtype">void</span> <a class="code" href="classeo_general_breeder.html#a2">operator()</a>(<span class="keyword">const</span> <a class="code" href="classeo_pop.html">eoPop<EOT></a>& _parents, <a class="code" href="classeo_pop.html">eoPop<EOT></a>& _offspring)
|
|
00081 {
|
|
00082 <span class="keywordtype">unsigned</span> target = howMany(_parents.size());
|
|
00083
|
|
00084 _offspring.clear();
|
|
00085 <a class="code" href="classeo_selective_populator.html">eoSelectivePopulator<EOT></a> it(_parents, _offspring, select);
|
|
00086
|
|
00087 <span class="keywordflow">while</span> (_offspring.size() < target)
|
|
00088 {
|
|
00089 op(it);
|
|
00090 ++it;
|
|
00091 }
|
|
00092
|
|
00093 _offspring.resize(target); <span class="comment">// you might have generated a few more</span>
|
|
00094 }
|
|
00095
|
|
<a name="l00097"></a><a class="code" href="classeo_general_breeder.html#a3">00097</a> <span class="keyword">virtual</span> std::string <a class="code" href="classeo_general_breeder.html#a3">className</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="stringliteral">"eoGeneralBreeder"</span>; }
|
|
00098
|
|
00099 <span class="keyword">private</span>:
|
|
00100 <a class="code" href="classeo_select_one.html">eoSelectOne<EOT></a>& select;
|
|
00101 <a class="code" href="classeo_gen_op.html">eoGenOp<EOT></a>& op;
|
|
00102 <a class="code" href="classeo_how_many.html">eoHowMany</a> howMany;
|
|
00103 };
|
|
00104
|
|
00105 <span class="preprocessor">#endif</span>
|
|
00106 <span class="preprocessor"></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>
|