📄 make_genotype_onemax.html
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="cpp2html Marc Schoenauer"> <title>Templates/make_genotype_OneMax.h</title></head><body text="#000000" bgcolor="#C3C2B4" link="#0000EE" vlink="#551A8B" alink="#FF0000"><a href="eoLesson5.html">Back to Lesson 5</a> - <a href="eoTutorial.html">Tutorialmain page </a>- <a href="eoTopDown.html">Top-Down page</a> - <a href="eoBottomUp.html">Bottom-uppage</a> - <a href="eoProgramming.html">Programming hints</a> - <font face="Arial,Helvetica"><a href="doc/html/index.html">EOdocumentation</a></font><br><hr WIDTH="100%"><!-- -------------- End of header ------------------ --><!-- ----------------------------------------------- --><center><h1><font color="#FF0000">Templates/make_genotype_OneMax.h</font></h1></center>The places where you have to put some code are on <b><font color="#FF6666">pinkbackground</font></b>..Only the the <a href="eoTutorial.html#colors">character colors have the usual meaning</a>.<br> <A NAME="start"></a><table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE ><tr NOSAVE><td NOSAVE><tt><font color="#993300"><b></b>// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-<br><b></b>//-----------------------------------------------------------------------------<br><b></b>// make_genotype.h<br><b></b>// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001<br><b></b>/* <br> This library is free software; you can redistribute it and/or<br> modify it under the terms of the GNU Lesser General Public<br> License as published by the Free Software Foundation; either<br> version 2 of the License, or (at your option) any later version.<br> This library is distributed in the hope that it will be useful,<br> but WITHOUT ANY WARRANTY; without even the implied warranty of<br> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br> Lesser General Public License for more details.<br> You should have received a copy of the GNU Lesser General Public<br> License along with this library; if not, write to the Free Software<br> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA<br> Contact: todos@geneura.ugr.es, http://geneura.ugr.es<br> Marc.Schoenauer@inria.fr<br> mkeijzer@dhi.dk<br> */<br><b></b>//-----------------------------------------------------------------------------<br><b>#ifndef _make_genotype_h</b><br><b>#define _make_genotype_h</b><br><b>#include <eoOneMax.h></b><br><b>#include <eoOneMaxInit.h></b><br><b> </b>// also need the parser and param includes<br><b>#include <utils/eoParser.h></b><br><b>#include <utils/eoState.h></b><br><b></b>/*<br> * This fuction does the create an eoInit<eoOneMax><br> *<br> * It could be here tempatized only on the fitness, as it can be used <br> * to evolve structures with any fitness.<br> * However, for consistency reasons, it was finally chosen, as in <br> * the rest of EO, to templatize by the full EOT, as this eventually <br> * allows to choose the type of genotype at run time (see in es dir)<br> *<br> * It returns an eoInit<EOT> that can later be used to initialize <br> * the population (see make_pop.h).<br> *<br> * It uses a parser (to get user parameters) and a state (to store the memory)<br> * the last argument is to disambiguate the call upon different instanciations.<br> *<br> * WARNING: that last argument will generally be the result of calling <br> * the default ctor of EOT, resulting in most cases in an EOT <br> * that is ***not properly initialized***<br>*/<br></font></tt></td></tr></table><a NAME="representation"></a><table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE ><tr><td><tt><font color="#999900"><b>template <class EOT></b><br><b>eoInit<EOT> & do_make_genotype(eoParser& _parser, eoState& _state, EOT)</b><br><b>{</b><br></font></tt></td></tr></table><table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="FFCCCC" NOSAVE ><tr><td><tt><font color="#999900"><b> </b>// read any useful parameter here from the parser <br><b> </b>// the param itself will belong to the parser (as far as memory is concerned)<br><b> </b>// paramType & param = _parser.createParam(deafultValue, "Keyword", "Comment to appear in help and status", 'c',"Section of status file").value();<br></font></tt></td></tr></table><table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE ><tr><td><tt><font color="#999900"><b> </b>// Then built the initializer - a pointer, stored in the eoState<br><b> eoInit<EOT>* init = new eoOneMaxInit<EOT> </b>/* ( param ) */ ;<b> ;</b><br></font></tt></td></tr></table><table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="FFCCCC" NOSAVE ><tr><td><tt><font color="#999900"><b> </b>// Eventually by passing the parameters you need<br><b> // eoInit<EOT>* init = new eoOneMaxInit<EOT> </b>/* ( param ) */ ;<b> ;</b><br></font></tt></td></tr></table><table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE ><tr><td><tt><font color="#999900"><b> </b>// store in state<br><b> _state.storeFunctor(init);</b><br><b> </b>// and return a reference<br><b> return *init;</b><br><b>}</b><br><b>#endif</b><br></font></font></font></td></tr></table><hr WIDTH="100%"><a href="eoLesson5.html">Back to Lesson 5</a> - <a href="eoTutorial.html">Tutorialmain page </a>- <a href="eoTopDown.html">Top-Down page</a> - <a href="eoBottomUp.html">Bottom-uppage</a> - <a href="eoProgramming.html">Programming hints</a> - <font face="Arial,Helvetica"><a href="doc/html/index.html">EOdocumentation</a></font><hr><address><a href="mailto:marc.schoenauer@inria.fr">Marc Schoenauer</a></address><br><!-- Created: Nov 2000 --><!-- hhmts start -->Lastmodified: Fri May 3 07:10:52 2002<!-- hhmts end --></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -