git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
90 lines
5.9 KiB
HTML
90 lines
5.9 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: eoOneMax.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_000003.html">tutorial</a> / <a class="el" href="dir_000016.html">Lesson5</a></div>
|
|
<h1>eoOneMax.h</h1><div class="fragment"><pre class="fragment">00001
|
|
00006 <span class="comment">/*</span>
|
|
00007 <span class="comment">Template for creating a new representation in EO</span>
|
|
00008 <span class="comment">================================================</span>
|
|
00009 <span class="comment">*/</span>
|
|
00010
|
|
00011 <span class="preprocessor">#ifndef _eoOneMax_h</span>
|
|
00012 <span class="preprocessor"></span><span class="preprocessor">#define _eoOneMax_h</span>
|
|
00013 <span class="preprocessor"></span>
|
|
00030 <span class="keyword">template</span>< <span class="keyword">class</span> FitT>
|
|
<a name="l00031"></a><a class="code" href="classeo_one_max.html">00031</a> <span class="keyword">class </span><a class="code" href="classeo_one_max.html">eoOneMax</a>: <span class="keyword">public</span> <a class="code" href="class_e_o.html">EO</a><FitT> {
|
|
00032 <span class="keyword">public</span>:
|
|
<a name="l00037"></a><a class="code" href="classeo_one_max.html#a0">00037</a> <a class="code" href="classeo_one_max.html#a0">eoOneMax</a>()
|
|
00038 {
|
|
00039 <span class="comment">// START Code of default Ctor of an eoOneMax object</span>
|
|
00040 <span class="comment">// END Code of default Ctor of an eoOneMax object</span>
|
|
00041 }
|
|
00042
|
|
00043 <span class="keyword">virtual</span> ~<a class="code" href="classeo_one_max.html">eoOneMax</a>()
|
|
00044 {
|
|
00045 <span class="comment">// START Code of Destructor of an eoEASEAGenome object</span>
|
|
00046 <span class="comment">// END Code of Destructor of an eoEASEAGenome object</span>
|
|
00047 }
|
|
00048
|
|
<a name="l00049"></a><a class="code" href="classeo_one_max.html#a2">00049</a> <span class="keyword">virtual</span> string <a class="code" href="classeo_one_max.html#a2">className</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="stringliteral">"eoOneMax"</span>; }
|
|
00050
|
|
<a name="l00052"></a><a class="code" href="classeo_one_max.html#a3">00052</a> <span class="keywordtype">void</span> <a class="code" href="classeo_one_max.html#a3">printOn</a>(ostream& _os)<span class="keyword"> const</span>
|
|
00053 <span class="keyword"> </span>{
|
|
00054 <span class="comment">// First write the fitness</span>
|
|
00055 <a class="code" href="class_e_o.html#z10_2">EO<FitT>::printOn</a>(_os);
|
|
00056 _os << <span class="charliteral">' '</span>;
|
|
00057 <span class="comment">// START Code of default output </span>
|
|
00058
|
|
00063 _os << b.size() << <span class="charliteral">' '</span> ;
|
|
00064 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i=0; i<b.size(); i++)
|
|
00065 _os << b[i] << <span class="charliteral">' '</span> ;
|
|
00066 <span class="comment">// END Code of default output</span>
|
|
00067 }
|
|
00068
|
|
<a name="l00072"></a><a class="code" href="classeo_one_max.html#a4">00072</a> <span class="keywordtype">void</span> <a class="code" href="classeo_one_max.html#a4">readFrom</a>(istream& _is)
|
|
00073 {
|
|
00074 <span class="comment">// of course you should read the fitness first!</span>
|
|
00075 <a class="code" href="class_e_o.html#z10_1">EO<FitT>::readFrom</a>(_is);
|
|
00076 <span class="comment">// START Code of input</span>
|
|
00077
|
|
00082 <span class="keywordtype">unsigned</span> s;
|
|
00083 _is >> s;
|
|
00084 b.resize(s);
|
|
00085 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i=0; i<s; i++)
|
|
00086 {
|
|
00087 <span class="keywordtype">bool</span> bTmp;
|
|
00088 _is >> bTmp;
|
|
00089 b[i] = bTmp;
|
|
00090 }
|
|
00091 <span class="comment">// END Code of input</span>
|
|
00092 }
|
|
00093
|
|
00094 <span class="comment">// accessing and setting values</span>
|
|
00095 <span class="keywordtype">void</span> setB(vector<bool> & _b)
|
|
00096 {
|
|
00097 b=_b;
|
|
00098 }
|
|
00099 <span class="keyword">const</span> vector<bool> & B()
|
|
00100 {
|
|
00101 <span class="keywordflow">return</span> b;
|
|
00102 }
|
|
00103
|
|
00104 <span class="keyword">private</span>: <span class="comment">// put all data here</span>
|
|
00105 <span class="comment">// START Private data of an eoOneMax object</span>
|
|
00106 std::vector<bool> b;
|
|
00107 <span class="comment">// END Private data of an eoOneMax object</span>
|
|
00108 };
|
|
00109
|
|
00110 <span class="preprocessor">#endif</span>
|
|
00111 <span class="preprocessor"></span>
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 05:06:36 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>
|