Adding the Lesson5 - how to create your own genotype
This commit is contained in:
parent
b407bf5e81
commit
c5e225551a
14 changed files with 2476 additions and 72 deletions
168
eo/tutorial/html/eoOneMaxMutation.html
Normal file
168
eo/tutorial/html/eoOneMaxMutation.html
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<!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>eoOneMaxMutation.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">Tutorial
|
||||
main page </a>- <a href="eoTopDown.html">Top-Down page</a> - <a href="eoBottomUp.html">Bottom-up
|
||||
page</a> - <a href="eoProgramming.html">Programming hints</a> - <font face="Arial,Helvetica"><a href="doc/html/index.html">EO
|
||||
documentation</a></font>
|
||||
<br>
|
||||
<hr WIDTH="100%"><!-- -------------- End of header ------------------ --><!-- ----------------------------------------------- -->
|
||||
<center>
|
||||
<h1>
|
||||
<font color="#FF0000">eoOneMaxMutation.h</font></h1></center>
|
||||
The places where you have to put some code are on pink background.
|
||||
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>/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-</b><br>
|
||||
<b>The above line is useful in Emacs-like editors</b><br>
|
||||
<b> */</b><br>
|
||||
<b>/*</b><br>
|
||||
<b>Template for simple mutation operators</b><br>
|
||||
<b>======================================</b><br>
|
||||
<b>*/</b><br>
|
||||
<b>#ifndef eoOneMaxMutation_H</b><br>
|
||||
<b>#define eoOneMaxMutation_H</b><br>
|
||||
<b>#include <eoOp.h></b><br>
|
||||
<b>/** </b><br>
|
||||
<b> * Always write a comment in this format before class definition</b><br>
|
||||
<b> * if you want the class to be documented by Doxygen</b><br>
|
||||
<b> *</b><br>
|
||||
<b> * THere is NO ASSUMPTION on the class GenoypeT.</b><br>
|
||||
<b> * In particular, it does not need to derive from EO</b><br>
|
||||
<b> */</b><br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a NAME="mutation"></a><table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE >
|
||||
<tr>
|
||||
<td>
|
||||
<tt><font color="#993399">
|
||||
<b>template<class GenotypeT> </b><br>
|
||||
<b>class eoOneMaxMutation: public eoMonOp<GenotypeT></b><br>
|
||||
<b>{</b><br>
|
||||
<b>public:</b><br>
|
||||
<b> /**</b><br>
|
||||
<b> * Ctor - no requirement</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="#993399">
|
||||
// START eventually add or modify the anyVariable argument<br>
|
||||
<b> eoOneMaxMutation()</b><br>
|
||||
<b> </b>// eoOneMaxMutation( varType _anyVariable) : anyVariable(_anyVariable) <br>
|
||||
// END eventually add or modify the anyVariable argument<br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE >
|
||||
<tr>
|
||||
<td>
|
||||
<tt><font color="#993399">
|
||||
<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="#993399">
|
||||
<b> </b>// START Code of Ctor of an eoOneMaxEvalFunc object<br>
|
||||
<b> </b>// END Code of Ctor of an eoOneMaxEvalFunc object<br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE >
|
||||
<tr>
|
||||
<td>
|
||||
<tt><font color="#993399">
|
||||
<b> }</b><br>
|
||||
<b> </b>/// The class name. Used to display statistics<br>
|
||||
<b> string className() const { return "eoOneMaxMutation"; }</b><br>
|
||||
<b> /**</b><br>
|
||||
<b> * modifies the parent</b><br>
|
||||
<b> * @param _genotype The parent genotype (will be modified)</b><br>
|
||||
<b> */</b><br>
|
||||
<b> bool operator()(GenotypeT & _genotype) </b><br>
|
||||
<b> {</b><br>
|
||||
<b> bool isModified;</b><br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="FFCCCC" NOSAVE >
|
||||
<tr>
|
||||
<td>
|
||||
<tt><font color="#993399">
|
||||
<b> </b>// START code for mutation of the _genotype object<br>
|
||||
<b> /** Requirement</b><br>
|
||||
<b>* if (_genotype has been modified)</b><br>
|
||||
<b>* isModified = true;</b><br>
|
||||
<b>* else</b><br>
|
||||
<b>* isModified = false;</b><br>
|
||||
<b>*/</b><br>
|
||||
<b> return isModified;</b><br>
|
||||
<b> </b>// END code for mutation of the _genotype object<br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE >
|
||||
<tr>
|
||||
<td>
|
||||
<tt><font color="#993399">
|
||||
<b> }</b><br>
|
||||
<b>private:</b><br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="FFCCCC" NOSAVE >
|
||||
<tr>
|
||||
<td>
|
||||
<tt><font color="#993399">
|
||||
// START Private data of an eoOneMaxMutation object<br>
|
||||
<b> </b>// varType anyVariable; // for example ...<br>
|
||||
// END Private data of an eoOneMaxMutation object<br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE >
|
||||
<tr>
|
||||
<td>
|
||||
<tt><font color="#993399">
|
||||
<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">Tutorial
|
||||
main page </a>- <a href="eoTopDown.html">Top-Down page</a> - <a href="eoBottomUp.html">Bottom-up
|
||||
page</a> - <a href="eoProgramming.html">Programming hints</a> - <font face="Arial,Helvetica"><a href="doc/html/index.html">EO
|
||||
documentation</a></font>
|
||||
<hr>
|
||||
<address>
|
||||
<a href="mailto:marc.schoenauer@inria.fr">Marc Schoenauer</a></address>
|
||||
<br><!-- Created: Nov 2000 --><!-- hhmts start -->Last
|
||||
modified: Wed May 1 07:18:00 2002
|
||||
<!-- hhmts end -->
|
||||
</body>
|
||||
</html>
|
||||
Reference in a new issue