git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@683 331e1502-861f-0410-8da2-ba01fb791d7f
135 lines
11 KiB
HTML
135 lines
11 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>ParadisEO-MOEOMovingObjects: FlowShopEA.cpp Source File</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.4.7 -->
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="main.html"><span>Main Page</span></a></li>
|
|
<li><a href="classes.html"><span>Classes</span></a></li>
|
|
<li id="current"><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<form action="search.php" method="get">
|
|
<table cellspacing="0" cellpadding="0" border="0">
|
|
<tr>
|
|
<td><label> <u>S</u>earch for </label></td>
|
|
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</li>
|
|
</ul></div>
|
|
<h1>FlowShopEA.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-</span>
|
|
<a name="l00002"></a>00002
|
|
<a name="l00003"></a>00003 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
<a name="l00004"></a>00004 <span class="comment">// FlowShopEA.cpp</span>
|
|
<a name="l00005"></a>00005 <span class="comment">// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007</span>
|
|
<a name="l00006"></a>00006 <span class="comment">/*</span>
|
|
<a name="l00007"></a>00007 <span class="comment"> This library...</span>
|
|
<a name="l00008"></a>00008 <span class="comment"></span>
|
|
<a name="l00009"></a>00009 <span class="comment"> Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr</span>
|
|
<a name="l00010"></a>00010 <span class="comment"> */</span>
|
|
<a name="l00011"></a>00011 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
<a name="l00012"></a>00012
|
|
<a name="l00013"></a>00013
|
|
<a name="l00014"></a>00014 <span class="comment">// moeo general include</span>
|
|
<a name="l00015"></a>00015 <span class="preprocessor">#include <moeo></span>
|
|
<a name="l00016"></a>00016 <span class="comment">// for the creation of an evaluator</span>
|
|
<a name="l00017"></a>00017 <span class="preprocessor">#include <make_eval_FlowShop.h></span>
|
|
<a name="l00018"></a>00018 <span class="comment">// for the creation of an initializer</span>
|
|
<a name="l00019"></a>00019 <span class="preprocessor">#include <make_genotype_FlowShop.h></span>
|
|
<a name="l00020"></a>00020 <span class="comment">// for the creation of the variation operators</span>
|
|
<a name="l00021"></a>00021 <span class="preprocessor">#include <make_op_FlowShop.h></span>
|
|
<a name="l00022"></a>00022 <span class="comment">// how to initialize the population</span>
|
|
<a name="l00023"></a>00023 <span class="preprocessor">#include <do/make_pop.h></span>
|
|
<a name="l00024"></a>00024 <span class="comment">// the stopping criterion</span>
|
|
<a name="l00025"></a>00025 <span class="preprocessor">#include <do/make_continue_moeo.h></span>
|
|
<a name="l00026"></a>00026 <span class="comment">// outputs (stats, population dumps, ...)</span>
|
|
<a name="l00027"></a>00027 <span class="preprocessor">#include <do/make_checkpoint_moeo.h></span>
|
|
<a name="l00028"></a>00028 <span class="comment">// evolution engine (selection and replacement)</span>
|
|
<a name="l00029"></a>00029 <span class="preprocessor">#include <do/make_ea_moeo.h></span>
|
|
<a name="l00030"></a>00030 <span class="comment">// simple call to the algo</span>
|
|
<a name="l00031"></a>00031 <span class="preprocessor">#include <do/make_run.h></span>
|
|
<a name="l00032"></a>00032 <span class="comment">// checks for help demand, and writes the status file and make_help; in libutils</span>
|
|
<a name="l00033"></a>00033 <span class="keywordtype">void</span> make_help(<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_parser.html">eoParser</a> & _parser);
|
|
<a name="l00034"></a>00034 <span class="comment">// definition of the representation</span>
|
|
<a name="l00035"></a>00035 <span class="preprocessor">#include <FlowShop.h></span>
|
|
<a name="l00036"></a>00036
|
|
<a name="l00037"></a>00037
|
|
<a name="l00038"></a>00038 <span class="keyword">using namespace </span>std;
|
|
<a name="l00039"></a>00039
|
|
<a name="l00040"></a>00040
|
|
<a name="l00041"></a>00041 <span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[])
|
|
<a name="l00042"></a>00042 {
|
|
<a name="l00043"></a>00043 <span class="keywordflow">try</span>
|
|
<a name="l00044"></a>00044 {
|
|
<a name="l00045"></a>00045
|
|
<a name="l00046"></a>00046 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_parser.html">eoParser</a> parser(argc, argv); <span class="comment">// for user-parameter reading</span>
|
|
<a name="l00047"></a>00047 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_state.html">eoState</a> state; <span class="comment">// to keep all things allocated</span>
|
|
<a name="l00048"></a>00048
|
|
<a name="l00049"></a>00049
|
|
<a name="l00050"></a>00050 <span class="comment">/*** the representation-dependent things ***/</span>
|
|
<a name="l00051"></a>00051
|
|
<a name="l00052"></a>00052 <span class="comment">// The fitness evaluation</span>
|
|
<a name="l00053"></a>00053 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_eval_func_counter.html">eoEvalFuncCounter<FlowShop></a>& eval = do_make_eval(parser, state);
|
|
<a name="l00054"></a>00054 <span class="comment">// the genotype (through a genotype initializer)</span>
|
|
<a name="l00055"></a>00055 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_init.html">eoInit<FlowShop></a>& init = do_make_genotype(parser, state);
|
|
<a name="l00056"></a>00056 <span class="comment">// the variation operators</span>
|
|
<a name="l00057"></a>00057 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_gen_op.html">eoGenOp<FlowShop></a>& op = do_make_op(parser, state);
|
|
<a name="l00058"></a>00058
|
|
<a name="l00059"></a>00059
|
|
<a name="l00060"></a>00060 <span class="comment">/*** the representation-independent things ***/</span>
|
|
<a name="l00061"></a>00061
|
|
<a name="l00062"></a>00062 <span class="comment">// initialization of the population</span>
|
|
<a name="l00063"></a>00063 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html">eoPop<FlowShop></a>& pop = do_make_pop(parser, state, init);
|
|
<a name="l00064"></a>00064 <span class="comment">// definition of the archive</span>
|
|
<a name="l00065"></a>00065 <a class="code" href="classmoeoArchive.html">moeoArchive<FlowShop></a> arch;
|
|
<a name="l00066"></a>00066 <span class="comment">// stopping criteria</span>
|
|
<a name="l00067"></a>00067 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_continue.html">eoContinue<FlowShop></a>& term = do_make_continue_moeo(parser, state, eval);
|
|
<a name="l00068"></a>00068 <span class="comment">// output</span>
|
|
<a name="l00069"></a>00069 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_check_point.html">eoCheckPoint<FlowShop></a>& checkpoint = do_make_checkpoint_moeo(parser, state, eval, term, pop, arch);
|
|
<a name="l00070"></a>00070 <span class="comment">// algorithm</span>
|
|
<a name="l00071"></a>00071 <a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_algo.html">eoAlgo<FlowShop></a>& algo = do_make_ea_moeo(parser, state, eval, checkpoint, op, arch);
|
|
<a name="l00072"></a>00072
|
|
<a name="l00073"></a>00073
|
|
<a name="l00074"></a>00074 <span class="comment">/*** Go ! ***/</span>
|
|
<a name="l00075"></a>00075
|
|
<a name="l00076"></a>00076 <span class="comment">// help ?</span>
|
|
<a name="l00077"></a>00077 make_help(parser);
|
|
<a name="l00078"></a>00078
|
|
<a name="l00079"></a>00079 <span class="comment">// first evalution</span>
|
|
<a name="l00080"></a>00080 apply<FlowShop>(eval, pop);
|
|
<a name="l00081"></a>00081
|
|
<a name="l00082"></a>00082 <span class="comment">// printing of the initial population</span>
|
|
<a name="l00083"></a>00083 cout << <span class="stringliteral">"Initial Population\n"</span>;
|
|
<a name="l00084"></a>00084 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#b6572898562eebe5bab105c4475a9a64">sortedPrintOn</a>(cout);
|
|
<a name="l00085"></a>00085 cout << endl;
|
|
<a name="l00086"></a>00086
|
|
<a name="l00087"></a>00087 <span class="comment">// run the algo</span>
|
|
<a name="l00088"></a>00088 do_run(algo, pop);
|
|
<a name="l00089"></a>00089
|
|
<a name="l00090"></a>00090 <span class="comment">// printing of the final population</span>
|
|
<a name="l00091"></a>00091 cout << <span class="stringliteral">"Final Population\n"</span>;
|
|
<a name="l00092"></a>00092 pop.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#b6572898562eebe5bab105c4475a9a64">sortedPrintOn</a>(cout);
|
|
<a name="l00093"></a>00093 cout << endl;
|
|
<a name="l00094"></a>00094
|
|
<a name="l00095"></a>00095 <span class="comment">// printing of the final archive</span>
|
|
<a name="l00096"></a>00096 cout << <span class="stringliteral">"Final Archive\n"</span>;
|
|
<a name="l00097"></a>00097 arch.<a class="codeRef" doxygen="eo.doxytag:http://eodev.sourceforge.net/eo/doc/html/" href="http://eodev.sourceforge.net/eo/doc/html/classeo_pop.html#b6572898562eebe5bab105c4475a9a64">sortedPrintOn</a>(cout);
|
|
<a name="l00098"></a>00098 cout << endl;
|
|
<a name="l00099"></a>00099
|
|
<a name="l00100"></a>00100
|
|
<a name="l00101"></a>00101 }
|
|
<a name="l00102"></a>00102 <span class="keywordflow">catch</span> (exception& e)
|
|
<a name="l00103"></a>00103 {
|
|
<a name="l00104"></a>00104 cout << e.what() << endl;
|
|
<a name="l00105"></a>00105 }
|
|
<a name="l00106"></a>00106 <span class="keywordflow">return</span> EXIT_SUCCESS;
|
|
<a name="l00107"></a>00107 }
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Oct 8 10:35:51 2007 for ParadisEO-MOEOMovingObjects by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
|
|
</body>
|
|
</html>
|