git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
120 lines
10 KiB
HTML
120 lines
10 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: make_continue_pareto.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> / <a class="el" href="dir_000025.html">do</a></div>
|
|
<h1>make_continue_pareto.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">// make_continue_pareto.h</span>
|
|
00005 <span class="comment">// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2000</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"> Marc.Schoenauer@inria.fr</span>
|
|
00023 <span class="comment"> mkeijzer@dhi.dk</span>
|
|
00024 <span class="comment"> */</span>
|
|
00025 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00026
|
|
00027 <span class="preprocessor">#ifndef _make_continue_pareto_h</span>
|
|
00028 <span class="preprocessor"></span><span class="preprocessor">#define _make_continue_pareto_h</span>
|
|
00029 <span class="preprocessor"></span>
|
|
00030 <span class="comment">/*</span>
|
|
00031 <span class="comment">Contains the templatized version of parser-based choice of stopping criterion</span>
|
|
00032 <span class="comment">for Pareto optimization (e.g. no "... without improvement" criterion</span>
|
|
00033 <span class="comment">It can then be instantiated, and compiled on its own for a given EOType</span>
|
|
00034 <span class="comment">(see e.g. in dir ga, ga.cpp)</span>
|
|
00035 <span class="comment">*/</span>
|
|
00036
|
|
00037 <span class="comment">// Continuators - all include eoContinue.h</span>
|
|
00038 <span class="preprocessor">#include <eoCombinedContinue.h></span>
|
|
00039 <span class="preprocessor">#include <eoGenContinue.h></span>
|
|
00040 <span class="preprocessor">#include <eoEvalContinue.h></span>
|
|
00041 <span class="preprocessor">#include <eoFitContinue.h></span>
|
|
00042 <span class="preprocessor">#ifndef _MSC_VER</span>
|
|
00043 <span class="preprocessor"></span><span class="preprocessor">#include <eoCtrlCContinue.h></span> <span class="comment">// CtrlC handling (using 2 global variables!)</span>
|
|
00044 <span class="preprocessor">#endif</span>
|
|
00045 <span class="preprocessor"></span>
|
|
00046 <span class="comment">// also need the parser and param includes</span>
|
|
00047 <span class="preprocessor">#include <utils/eoParser.h></span>
|
|
00048 <span class="preprocessor">#include <utils/eoState.h></span>
|
|
00049
|
|
00050
|
|
00052 <span class="keyword">template</span> <<span class="keyword">class</span> Indi>
|
|
00053 <a class="code" href="classeo_combined_continue.html">eoCombinedContinue<Indi></a> * make_combinedContinue(<a class="code" href="classeo_combined_continue.html">eoCombinedContinue<Indi></a> *_combined, <a class="code" href="classeo_continue.html">eoContinue<Indi></a> *_cont)
|
|
00054 {
|
|
00055 <span class="keywordflow">if</span> (_combined) <span class="comment">// already exists</span>
|
|
00056 _combined-><a class="code" href="classeo_combined_continue.html#a2">add</a>(*_cont);
|
|
00057 <span class="keywordflow">else</span>
|
|
00058 _combined = <span class="keyword">new</span> <a class="code" href="classeo_combined_continue.html">eoCombinedContinue<Indi></a>(*_cont);
|
|
00059 <span class="keywordflow">return</span> _combined;
|
|
00060 }
|
|
00061
|
|
00063 <span class="keyword">template</span> <<span class="keyword">class</span> Indi>
|
|
00064 <a class="code" href="classeo_continue.html">eoContinue<Indi></a> & do_make_continue_pareto(<a class="code" href="classeo_parser.html">eoParser</a>& _parser, <a class="code" href="classeo_state.html">eoState</a>& _state, <a class="code" href="classeo_eval_func_counter.html">eoEvalFuncCounter<Indi></a> & _eval)
|
|
00065 {
|
|
00067 <span class="comment">// the combined continue - to be filled</span>
|
|
00068 <a class="code" href="classeo_combined_continue.html">eoCombinedContinue<Indi></a> *continuator = NULL;
|
|
00069
|
|
00070 <span class="comment">// for each possible criterion, check if wanted, otherwise do nothing</span>
|
|
00071
|
|
00072 <span class="comment">// First the eoGenContinue - need a default value so you can run blind</span>
|
|
00073 <span class="comment">// but we also need to be able to avoid it <--> 0</span>
|
|
00074 <a class="code" href="classeo_value_param.html">eoValueParam<unsigned></a>& maxGenParam = _parser.<a class="code" href="classeo_parameter_loader.html#a3">createParam</a>(<span class="keywordtype">unsigned</span>(100), <span class="stringliteral">"maxGen"</span>, <span class="stringliteral">"Maximum number of generations () = none)"</span>,<span class="charliteral">'G'</span>,<span class="stringliteral">"Stopping criterion"</span>);
|
|
00075
|
|
00076 <span class="keywordflow">if</span> (maxGenParam.<a class="code" href="classeo_value_param.html#a2">value</a>()) <span class="comment">// positive: -> define and store</span>
|
|
00077 {
|
|
00078 <a class="code" href="classeo_gen_continue.html">eoGenContinue<Indi></a> *genCont = <span class="keyword">new</span> <a class="code" href="classeo_gen_continue.html">eoGenContinue<Indi></a>(maxGenParam.<a class="code" href="classeo_value_param.html#a2">value</a>());
|
|
00079 _state.<a class="code" href="classeo_functor_store.html#a2">storeFunctor</a>(genCont);
|
|
00080 <span class="comment">// and "add" to combined</span>
|
|
00081 continuator = make_combinedContinue<Indi>(continuator, genCont);
|
|
00082 }
|
|
00083
|
|
00084 <span class="preprocessor">#ifndef _MSC_VER</span>
|
|
00085 <span class="preprocessor"></span> <span class="comment">// the CtrlC interception (Linux only I'm afraid)</span>
|
|
00086 <a class="code" href="classeo_ctrl_c_continue.html">eoCtrlCContinue<Indi></a> *ctrlCCont;
|
|
00087 <a class="code" href="classeo_value_param.html">eoValueParam<bool></a>& ctrlCParam = _parser.<a class="code" href="classeo_parameter_loader.html#a3">createParam</a>(<span class="keyword">true</span>, <span class="stringliteral">"CtrlC"</span>, <span class="stringliteral">"Terminate current generation upon Ctrl C"</span>,<span class="charliteral">'C'</span>, <span class="stringliteral">"Stopping criterion"</span>);
|
|
00088 <span class="keywordflow">if</span> (_parser.<a class="code" href="classeo_parser.html#a8">isItThere</a>(ctrlCParam))
|
|
00089 {
|
|
00090 ctrlCCont = <span class="keyword">new</span> <a class="code" href="classeo_ctrl_c_continue.html">eoCtrlCContinue<Indi></a>;
|
|
00091 <span class="comment">// store</span>
|
|
00092 _state.<a class="code" href="classeo_functor_store.html#a2">storeFunctor</a>(ctrlCCont);
|
|
00093 <span class="comment">// add to combinedContinue</span>
|
|
00094 continuator = make_combinedContinue<Indi>(continuator, ctrlCCont);
|
|
00095 }
|
|
00096 <span class="preprocessor">#endif</span>
|
|
00097 <span class="preprocessor"></span>
|
|
00098 <span class="comment">// now check that there is at least one!</span>
|
|
00099 <span class="keywordflow">if</span> (!continuator)
|
|
00100 <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">"You MUST provide a stopping criterion"</span>);
|
|
00101 <span class="comment">// OK, it's there: store in the eoState</span>
|
|
00102 _state.<a class="code" href="classeo_functor_store.html#a2">storeFunctor</a>(continuator);
|
|
00103
|
|
00104 <span class="comment">// and return</span>
|
|
00105 <span class="keywordflow">return</span> *continuator;
|
|
00106 }
|
|
00107
|
|
00108 <span class="preprocessor">#endif</span>
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 05:06:40 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>
|