paradiseo/trunk/docs/html/mo_best_impr_select_8h-source.html

99 lines
7.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>PARADISEO-MO: moBestImprSelect.h 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.1 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;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>&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>moBestImprSelect.h</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">// "moBestImprSelect.h"</span>
<a name="l00004"></a>00004
<a name="l00005"></a>00005 <span class="comment">// (c) OPAC Team, LIFL, 2003-2006</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">#ifndef __moBestImprSelect_h</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#define __moBestImprSelect_h</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span>
<a name="l00015"></a>00015 <span class="preprocessor">#include "moMoveSelect.h"</span>
<a name="l00016"></a>00016
<a name="l00018"></a>00018
<a name="l00022"></a><a class="code" href="classmo_best_impr_select.html">00022</a> <span class="keyword">template</span> &lt; <span class="keyword">class</span> M &gt; <span class="keyword">class </span><a class="code" href="classmo_best_impr_select.html">moBestImprSelect</a>:<span class="keyword">public</span> <a class="code" href="classmo_move_select.html">moMoveSelect</a> &lt; M &gt;
<a name="l00023"></a>00023 {
<a name="l00024"></a>00024
<a name="l00025"></a>00025 <span class="keyword">public</span>:
<a name="l00026"></a>00026
<a name="l00028"></a><a class="code" href="classmo_best_impr_select.html#c4ae17435221fb0a8e8acd285210cfcb">00028</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> M::EOType::Fitness <a class="code" href="classmo_best_impr_select.html#c4ae17435221fb0a8e8acd285210cfcb">Fitness</a>;
<a name="l00029"></a>00029
<a name="l00031"></a><a class="code" href="classmo_best_impr_select.html#2d2abf9aa17dc77cbb4f41810ab7b956">00031</a> <span class="keywordtype">void</span> <a class="code" href="classmo_best_impr_select.html#2d2abf9aa17dc77cbb4f41810ab7b956">init</a> (<span class="keyword">const</span> <a class="code" href="classmo_best_impr_select.html#c4ae17435221fb0a8e8acd285210cfcb">Fitness</a> &amp; __fit)
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033
<a name="l00034"></a>00034 <a class="code" href="classmo_best_impr_select.html#352b14d206b0772eb9f40efb7beb0f13">first_time</a> = <span class="keyword">true</span>;
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036
<a name="l00037"></a>00037
<a name="l00039"></a>00039
<a name="l00047"></a><a class="code" href="classmo_best_impr_select.html#d10e3e6f8a0277731e95ef506d064d6d">00047</a> <span class="keywordtype">bool</span> <a class="code" href="classmo_best_impr_select.html#d10e3e6f8a0277731e95ef506d064d6d">update</a> (<span class="keyword">const</span> M &amp; __move, <span class="keyword">const</span> <a class="code" href="classmo_best_impr_select.html#c4ae17435221fb0a8e8acd285210cfcb">Fitness</a> &amp; __fit)
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049
<a name="l00050"></a>00050 <span class="keywordflow">if</span> (<a class="code" href="classmo_best_impr_select.html#352b14d206b0772eb9f40efb7beb0f13">first_time</a> || __fit &gt; <a class="code" href="classmo_best_impr_select.html#dcac897424b5805f146bb1dbb429f2fe">best_fit</a>)
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052
<a name="l00053"></a>00053 <a class="code" href="classmo_best_impr_select.html#dcac897424b5805f146bb1dbb429f2fe">best_fit</a> = __fit;
<a name="l00054"></a>00054 <a class="code" href="classmo_best_impr_select.html#bd86f70519f954c07ff0d8a2a3a8ff6a">best_move</a> = __move;
<a name="l00055"></a>00055
<a name="l00056"></a>00056 <a class="code" href="classmo_best_impr_select.html#352b14d206b0772eb9f40efb7beb0f13">first_time</a> = <span class="keyword">false</span>;
<a name="l00057"></a>00057 }
<a name="l00058"></a>00058
<a name="l00059"></a>00059 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00060"></a>00060 }
<a name="l00061"></a>00061
<a name="l00063"></a>00063
<a name="l00068"></a><a class="code" href="classmo_best_impr_select.html#169773d4d127acd782cf379f758222da">00068</a> <span class="keywordtype">void</span> <a class="code" href="classmo_best_impr_select.html#169773d4d127acd782cf379f758222da">operator () </a>(M &amp; __move, <a class="code" href="classmo_best_impr_select.html#c4ae17435221fb0a8e8acd285210cfcb">Fitness</a> &amp; __fit) <span class="keywordflow">throw</span> (<a class="code" href="class_empty_selection.html">EmptySelection</a>)
<a name="l00069"></a>00069 {
<a name="l00070"></a>00070
<a name="l00071"></a>00071 <span class="keywordflow">if</span> (!<a class="code" href="classmo_best_impr_select.html#352b14d206b0772eb9f40efb7beb0f13">first_time</a>)
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073 __move = <a class="code" href="classmo_best_impr_select.html#bd86f70519f954c07ff0d8a2a3a8ff6a">best_move</a>;
<a name="l00074"></a>00074 __fit = <a class="code" href="classmo_best_impr_select.html#dcac897424b5805f146bb1dbb429f2fe">best_fit</a>;
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 <span class="keywordflow">else</span>
<a name="l00077"></a>00077 <span class="keywordflow">throw</span> <a class="code" href="class_empty_selection.html">EmptySelection</a> ();
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <span class="keyword">private</span>:
<a name="l00081"></a>00081
<a name="l00083"></a><a class="code" href="classmo_best_impr_select.html#352b14d206b0772eb9f40efb7beb0f13">00083</a> <span class="keywordtype">bool</span> <a class="code" href="classmo_best_impr_select.html#352b14d206b0772eb9f40efb7beb0f13">first_time</a>;
<a name="l00084"></a>00084
<a name="l00086"></a><a class="code" href="classmo_best_impr_select.html#bd86f70519f954c07ff0d8a2a3a8ff6a">00086</a> M <a class="code" href="classmo_best_impr_select.html#bd86f70519f954c07ff0d8a2a3a8ff6a">best_move</a>;
<a name="l00087"></a>00087
<a name="l00089"></a><a class="code" href="classmo_best_impr_select.html#dcac897424b5805f146bb1dbb429f2fe">00089</a> <a class="code" href="classmo_best_impr_select.html#c4ae17435221fb0a8e8acd285210cfcb">Fitness</a> <a class="code" href="classmo_best_impr_select.html#dcac897424b5805f146bb1dbb429f2fe">best_fit</a>;
<a name="l00090"></a>00090
<a name="l00091"></a>00091 };
<a name="l00092"></a>00092
<a name="l00093"></a>00093 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Dec 12 14:28:36 2006 for PARADISEO-MO by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>