paradiseo/trunk/paradiseo-mo/doc/html/iterated__local__search_8cpp-source.html
jboisson b1520dda65 moILS has been added, berlin52.tsp too, moComparator, moFitComparator, ...
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@606 331e1502-861f-0410-8da2-ba01fb791d7f
2007-09-20 09:42:11 +00:00

125 lines
8.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ParadisEO-MOMovingObjects: iterated_local_search.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.5.2 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li class="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>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul>
</div>
<h1>iterated_local_search.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">// "iterated_local_search.cpp"</span>
<a name="l00004"></a>00004
<a name="l00005"></a>00005 <span class="comment">// (c) OPAC Team, LIFL, 2003-2007</span>
<a name="l00006"></a>00006
<a name="l00007"></a>00007 <span class="comment">/* LICENCE TEXT</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</span>
<a name="l00010"></a>00010 <span class="comment">*/</span>
<a name="l00011"></a>00011
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;mo.h&gt;</span>
<a name="l00013"></a>00013
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;graph.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;route.h&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;route_eval.h&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;route_init.h&gt;</span>
<a name="l00018"></a>00018
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;two_opt.h&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;two_opt_init.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;two_opt_next.h&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;two_opt_incr_eval.h&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;two_opt_tabu_list.h&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;two_opt_rand.h&gt;</span>
<a name="l00025"></a>00025
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;city_swap.h&gt;</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="keywordtype">int</span>
<a name="l00029"></a>00029 main (<span class="keywordtype">int</span> __argc, <span class="keywordtype">char</span> * __argv [])
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031 <span class="keywordflow">if</span> (__argc != 2)
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 std :: cerr &lt;&lt; <span class="stringliteral">"Usage : ./iterated_local_search [instance]"</span> &lt;&lt; std :: endl ;
<a name="l00034"></a>00034 <span class="keywordflow">return</span> 1 ;
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <a class="code" href="namespace_graph.html#95f0bc08fa93f8f4abf1801674488b30">Graph :: load</a> (__argv [1]) ; <span class="comment">// Instance</span>
<a name="l00038"></a>00038
<a name="l00039"></a>00039 Route route ; <span class="comment">// Solution</span>
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <a class="code" href="class_route_init.html">RouteInit</a> init ; <span class="comment">// Sol. Random Init.</span>
<a name="l00042"></a>00042 init (route) ;
<a name="l00043"></a>00043
<a name="l00044"></a>00044 <a class="code" href="class_route_eval.html" title="Route Evaluator.">RouteEval</a> full_eval ; <span class="comment">// Full. Eval.</span>
<a name="l00045"></a>00045 full_eval (route) ;
<a name="l00046"></a>00046
<a name="l00047"></a>00047 std :: cout &lt;&lt; <span class="stringliteral">"[From] "</span> &lt;&lt; route &lt;&lt; std :: endl ;
<a name="l00048"></a>00048
<a name="l00049"></a>00049 <span class="comment">/* Tools for an efficient (? :-))</span>
<a name="l00050"></a>00050 <span class="comment"> local search ! */</span>
<a name="l00051"></a>00051
<a name="l00052"></a>00052 <a class="code" href="class_two_opt_init.html" title="It sets the first couple of edges.">TwoOptInit</a> two_opt_init ; <span class="comment">// Init.</span>
<a name="l00053"></a>00053
<a name="l00054"></a>00054 <a class="code" href="class_two_opt_next.html" title="It updates a couple of edges.">TwoOptNext</a> two_opt_next ; <span class="comment">// Explorer.</span>
<a name="l00055"></a>00055
<a name="l00056"></a>00056 <a class="code" href="class_two_opt_incr_eval.html">TwoOptIncrEval</a> two_opt_incr_eval ; <span class="comment">// Eff. eval.</span>
<a name="l00057"></a>00057
<a name="l00058"></a>00058 moBestImprSelect &lt;TwoOpt&gt; two_opt_select ;
<a name="l00059"></a>00059
<a name="l00060"></a>00060 <span class="comment">//moHC&lt;TwoOpt&gt; hill_climbing (two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_select, full_eval) ;</span>
<a name="l00061"></a>00061
<a name="l00062"></a>00062 moGenSolContinue &lt;Route&gt; cont (1000) ;
<a name="l00063"></a>00063
<a name="l00064"></a>00064 <a class="code" href="classmo_fit_comparator.html" title="Comparison according to the fitness.">moFitComparator&lt;Route&gt;</a> comparator;
<a name="l00065"></a>00065
<a name="l00066"></a>00066 <a class="code" href="class_city_swap.html" title="Its swaps two vertices randomly choosen.">CitySwap</a> perturbation;
<a name="l00067"></a>00067
<a name="l00068"></a>00068 <span class="comment">//moILS&lt;TwoOpt&gt; iterated_local_search (hill_climbing, cont, comparator, perturbation, full_eval) ;</span>
<a name="l00069"></a>00069 <span class="comment">//moILS&lt;TwoOpt&gt; iterated_local_search (two_opt_init, two_opt_next, two_opt_incr_eval, </span>
<a name="l00070"></a>00070 <span class="comment">// two_opt_select, cont, comparator, perturbation, full_eval) ;</span>
<a name="l00071"></a>00071
<a name="l00072"></a>00072 moGenSolContinue &lt;Route&gt; ts_cont (100) ;
<a name="l00073"></a>00073
<a name="l00074"></a>00074 <a class="code" href="class_two_opt_tabu_list.html" title="The table of tabu movements, i.e.">TwoOptTabuList</a> tabu_list ; <span class="comment">// Tabu List</span>
<a name="l00075"></a>00075 moNoAspirCrit &lt;TwoOpt&gt; aspir_crit ; <span class="comment">// Aspiration Criterion</span>
<a name="l00076"></a>00076
<a name="l00077"></a>00077 <span class="comment">//moILS&lt;TwoOpt&gt; iterated_local_search (two_opt_init, two_opt_next, two_opt_incr_eval, tabu_list, aspir_crit, ts_cont, </span>
<a name="l00078"></a>00078 <span class="comment">// cont, comparator, perturbation, full_eval) ;</span>
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <a class="code" href="class_two_opt_rand.html">TwoOptRand</a> two_opt_rand ; <span class="comment">// Route Random. Gen.</span>
<a name="l00081"></a>00081
<a name="l00082"></a>00082 <a class="code" href="classmo_exponential_cooling_schedule.html" title="One of the possible moCoolingSchedule.">moExponentialCoolingSchedule</a> cool_sched (0.1, 0.98) ; <span class="comment">// Exponential Cooling Schedule </span>
<a name="l00083"></a>00083
<a name="l00084"></a>00084 moGenSolContinue &lt;Route&gt; sa_cont (100) ;
<a name="l00085"></a>00085
<a name="l00086"></a>00086 <a class="code" href="classmo_i_l_s.html" title="Iterated Local Search (ILS).">moILS&lt;TwoOpt&gt;</a> iterated_local_search (two_opt_rand, two_opt_incr_eval, sa_cont, 100, cool_sched,
<a name="l00087"></a>00087 cont, comparator, perturbation, full_eval) ;
<a name="l00088"></a>00088
<a name="l00089"></a>00089 iterated_local_search(route) ;
<a name="l00090"></a>00090
<a name="l00091"></a>00091 std :: cout &lt;&lt; <span class="stringliteral">"[To] "</span> &lt;&lt; route &lt;&lt; std :: endl ;
<a name="l00092"></a>00092
<a name="l00093"></a>00093 <span class="keywordflow">return</span> 0 ;
<a name="l00094"></a>00094 }
<a name="l00095"></a>00095
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Sep 20 11:30:28 2007 for ParadisEO-MOMovingObjects by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address>
</body>
</html>