Paradiseo-eo sources added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
bc1f453978
commit
c3aec878e5
3609 changed files with 342772 additions and 0 deletions
125
trunk/paradiseo-eo/doc/html/_e_o_8h-source.html
Normal file
125
trunk/paradiseo-eo/doc/html/_e_o_8h-source.html
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
<!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: EO.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>EO.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">// EO.h</span>
|
||||
00005 <span class="comment">// (c) GeNeura Team 1998</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: todos@geneura.ugr.es, http://geneura.ugr.es</span>
|
||||
00022 <span class="comment"> */</span>
|
||||
00023 <span class="comment">//-----------------------------------------------------------------------------</span>
|
||||
00024
|
||||
00025 <span class="preprocessor">#ifndef EO_H</span>
|
||||
00026 <span class="preprocessor"></span><span class="preprocessor">#define EO_H</span>
|
||||
00027 <span class="preprocessor"></span>
|
||||
00028 <span class="comment">//-----------------------------------------------------------------------------</span>
|
||||
00029
|
||||
00030 <span class="preprocessor">#include <stdexcept></span> <span class="comment">// std::runtime_error</span>
|
||||
00031 <span class="preprocessor">#include <eoObject.h></span> <span class="comment">// eoObject</span>
|
||||
00032 <span class="preprocessor">#include <eoPersistent.h></span> <span class="comment">// eoPersistent</span>
|
||||
00033
|
||||
00034 <span class="comment">//-----------------------------------------------------------------------------</span>
|
||||
<a name="l00044"></a><a class="code" href="class_e_o.html">00044</a> <span class="comment"></span><span class="keyword">template</span><<span class="keyword">class</span> F> <span class="keyword">class </span><a class="code" href="class_e_o.html">EO</a>: <span class="keyword">public</span> <a class="code" href="classeo_object.html">eoObject</a>, <span class="keyword">public</span> <a class="code" href="classeo_persistent.html">eoPersistent</a>
|
||||
00045 {
|
||||
00046 <span class="keyword">public</span>:
|
||||
00047 <span class="keyword">typedef</span> F Fitness;
|
||||
00048
|
||||
<a name="l00054"></a><a class="code" href="class_e_o.html#a0">00054</a> <a class="code" href="class_e_o.html#a0">EO</a>(): repFitness(Fitness()), invalidFitness(true) {}
|
||||
00055
|
||||
<a name="l00057"></a><a class="code" href="class_e_o.html#a1">00057</a> <span class="keyword">virtual</span> <a class="code" href="class_e_o.html#a1">~EO</a>() {};
|
||||
00058
|
||||
<a name="l00060"></a><a class="code" href="class_e_o.html#a2">00060</a> Fitness <a class="code" href="class_e_o.html#a2">fitness</a>()<span class="keyword"> const </span>{
|
||||
00061 <span class="keywordflow">if</span> (<a class="code" href="class_e_o.html#a5">invalid</a>())
|
||||
00062 <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">"invalid fitness"</span>);
|
||||
00063 <span class="keywordflow">return</span> repFitness;
|
||||
00064 }
|
||||
00065
|
||||
00066 <span class="comment">// Set fitness as invalid.</span>
|
||||
00067 <span class="keywordtype">void</span> invalidate() { invalidFitness = <span class="keyword">true</span>; }
|
||||
00068
|
||||
<a name="l00072"></a><a class="code" href="class_e_o.html#a4">00072</a> <span class="keywordtype">void</span> <a class="code" href="class_e_o.html#a2">fitness</a>(<span class="keyword">const</span> Fitness& _fitness)
|
||||
00073 {
|
||||
00074 repFitness = _fitness;
|
||||
00075 invalidFitness = <span class="keyword">false</span>;
|
||||
00076 }
|
||||
00077
|
||||
<a name="l00081"></a><a class="code" href="class_e_o.html#a5">00081</a> <span class="keywordtype">bool</span> <a class="code" href="class_e_o.html#a5">invalid</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> invalidFitness; }
|
||||
00082
|
||||
<a name="l00086"></a><a class="code" href="class_e_o.html#a6">00086</a> <span class="keywordtype">bool</span> <a class="code" href="class_e_o.html#a6">operator<</a>(<span class="keyword">const</span> <a class="code" href="class_e_o.html">EO</a>& _eo2)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_e_o.html#a2">fitness</a>() < _eo2.<a class="code" href="class_e_o.html#a2">fitness</a>(); }
|
||||
00087 <span class="keywordtype">bool</span> operator>(<span class="keyword">const</span> <a class="code" href="class_e_o.html">EO</a>& _eo2)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> !(<a class="code" href="class_e_o.html#a2">fitness</a>() <= _eo2.<a class="code" href="class_e_o.html#a2">fitness</a>()); }
|
||||
00088
|
||||
00090
|
||||
00091
|
||||
<a name="l00095"></a><a class="code" href="class_e_o.html#z10_0">00095</a> <span class="keyword">virtual</span> std::string <a class="code" href="class_e_o.html#z10_0">className</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="stringliteral">"EO"</span>; }
|
||||
00096
|
||||
<a name="l00105"></a><a class="code" href="class_e_o.html#z10_1">00105</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_e_o.html#z10_1">readFrom</a>(std::istream& _is) {
|
||||
00106
|
||||
00107 <span class="comment">// the new version of the reafFrom function.</span>
|
||||
00108 <span class="comment">// It can distinguish between valid and invalid fitness values. </span>
|
||||
00109 std::string fitness_str;
|
||||
00110 <span class="keywordtype">int</span> pos = _is.tellg();
|
||||
00111 _is >> fitness_str;
|
||||
00112
|
||||
00113 <span class="keywordflow">if</span> (fitness_str == <span class="stringliteral">"INVALID"</span>)
|
||||
00114 {
|
||||
00115 invalidFitness = <span class="keyword">true</span>;
|
||||
00116 }
|
||||
00117 <span class="keywordflow">else</span>
|
||||
00118 {
|
||||
00119 invalidFitness = <span class="keyword">false</span>;
|
||||
00120 _is.seekg(pos); <span class="comment">// rewind</span>
|
||||
00121 _is >> repFitness;
|
||||
00122 }
|
||||
00123 }
|
||||
00124
|
||||
<a name="l00129"></a><a class="code" href="class_e_o.html#z10_2">00129</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_e_o.html#z10_2">printOn</a>(std::ostream& _os)<span class="keyword"> const </span>{
|
||||
00130
|
||||
00131
|
||||
00132 <span class="comment">// the latest version of the code. Very similar to the old code</span>
|
||||
00133 <span class="keywordflow">if</span> (<a class="code" href="class_e_o.html#a5">invalid</a>()) {
|
||||
00134 _os << <span class="stringliteral">"INVALID "</span>;
|
||||
00135 }
|
||||
00136 <span class="keywordflow">else</span>
|
||||
00137 {
|
||||
00138 _os << repFitness << <span class="charliteral">' '</span>;
|
||||
00139 }
|
||||
00140
|
||||
00141 }
|
||||
00142
|
||||
00144
|
||||
00145 <span class="keyword">private</span>:
|
||||
00146 Fitness repFitness; <span class="comment">// value of fitness for this chromosome</span>
|
||||
00147 <span class="keywordtype">bool</span> invalidFitness; <span class="comment">// true if the value of fitness is invalid</span>
|
||||
00148 };
|
||||
00149
|
||||
00150 <span class="comment">//-----------------------------------------------------------------------------</span>
|
||||
00151
|
||||
00152 <span class="preprocessor">#endif</span>
|
||||
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 05:06:34 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue