paradiseo/trunk/paradiseo-peo/docs/html/peoSyncMultiStart_8h-source.html

196 lines
19 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-PEO: peoSyncMultiStart.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.4.7 -->
<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 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>peoSyncMultiStart.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">// "peoSyncMultiStart.h"</span>
<a name="l00004"></a>00004
<a name="l00005"></a>00005 <span class="comment">// (c) OPAC Team, LIFL, August 2005</span>
<a name="l00006"></a>00006
<a name="l00007"></a>00007 <span class="comment">/* This library is free software; you can redistribute it and/or</span>
<a name="l00008"></a>00008 <span class="comment"> modify it under the terms of the GNU Lesser General Public</span>
<a name="l00009"></a>00009 <span class="comment"> License as published by the Free Software Foundation; either</span>
<a name="l00010"></a>00010 <span class="comment"> version 2 of the License, or (at your option) any later version.</span>
<a name="l00011"></a>00011 <span class="comment"> </span>
<a name="l00012"></a>00012 <span class="comment"> This library is distributed in the hope that it will be useful,</span>
<a name="l00013"></a>00013 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00014"></a>00014 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
<a name="l00015"></a>00015 <span class="comment"> Lesser General Public License for more details.</span>
<a name="l00016"></a>00016 <span class="comment"> </span>
<a name="l00017"></a>00017 <span class="comment"> You should have received a copy of the GNU Lesser General Public</span>
<a name="l00018"></a>00018 <span class="comment"> License along with this library; if not, write to the Free Software</span>
<a name="l00019"></a>00019 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
<a name="l00020"></a>00020 <span class="comment"> </span>
<a name="l00021"></a>00021 <span class="comment"> Contact: paradiseo-help@lists.gforge.inria.fr</span>
<a name="l00022"></a>00022 <span class="comment">*/</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="preprocessor">#ifndef __peoSyncMultiStart_h</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define __peoSyncMultiStart_h</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;utils/eoUpdater.h&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;moAlgo.h&gt;</span>
<a name="l00029"></a>00029
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;eoSelect.h&gt;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;eoReplacement.h&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;eoContinue.h&gt;</span>
<a name="l00033"></a>00033
<a name="l00034"></a>00034 <span class="preprocessor">#include "core/service.h"</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include "core/messaging.h"</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include "core/peo_debug.h"</span>
<a name="l00037"></a>00037
<a name="l00038"></a>00038
<a name="l00039"></a>00039 <span class="keyword">extern</span> <span class="keywordtype">int</span> getNodeRank();
<a name="l00040"></a>00040
<a name="l00041"></a>00041
<a name="l00043"></a>00043
<a name="l00051"></a><a class="code" href="classpeoSyncMultiStart.html">00051</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keyword">class </span><a class="code" href="classpeoSyncMultiStart.html">peoSyncMultiStart</a> : <span class="keyword">public</span> <a class="code" href="classService.html">Service</a>, <span class="keyword">public</span> eoUpdater {
<a name="l00052"></a>00052
<a name="l00053"></a>00053 <span class="keyword">public</span>:
<a name="l00054"></a>00054
<a name="l00062"></a>00062 <a class="code" href="classpeoSyncMultiStart.html#d29f94aad3c1f443bfffc8b6aee0704c">peoSyncMultiStart</a>(
<a name="l00063"></a>00063
<a name="l00064"></a>00064 eoContinue&lt; EOT &gt;&amp; __cont,
<a name="l00065"></a>00065 eoSelect&lt; EOT &gt;&amp; __select,
<a name="l00066"></a>00066 eoReplacement&lt; EOT &gt;&amp; __replace,
<a name="l00067"></a>00067 moAlgo&lt; EOT &gt;&amp; __ls,
<a name="l00068"></a>00068 eoPop&lt; EOT &gt;&amp; __pop
<a name="l00069"></a>00069 );
<a name="l00070"></a>00070
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#76385b33fe514f91cb83f0fbecbeb3c2">operator()</a>();
<a name="l00074"></a>00074
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#8becfab1922b64708dca5a53e2932a5a">packData</a>();
<a name="l00078"></a>00078
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#2903a441b77cded266b5fb651e17a5b5">unpackData</a>();
<a name="l00082"></a>00082
<a name="l00085"></a>00085 <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#a4d1c2943c290de540800087b54dc49b">execute</a>();
<a name="l00086"></a>00086
<a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#6c48eb0dae741cff7203b65e226f9616">packResult</a>();
<a name="l00090"></a>00090
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#c3cbd1f10a89d1915c5ccf82a2c34a1d">unpackResult</a>();
<a name="l00094"></a>00094
<a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#32ec0d01d3fd8a9932abd68f4781fc94">notifySendingData</a>();
<a name="l00098"></a>00098
<a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#fc90282cc4e93cdea8f82fd52dd78fb0">notifySendingAllResourceRequests</a>();
<a name="l00102"></a>00102
<a name="l00103"></a>00103 <span class="keyword">private</span>:
<a name="l00104"></a>00104
<a name="l00105"></a><a class="code" href="classpeoSyncMultiStart.html#43f4fa9b125baef6fc8b968dfd16f437">00105</a> eoContinue&lt; EOT &gt;&amp; <a class="code" href="classpeoSyncMultiStart.html#43f4fa9b125baef6fc8b968dfd16f437">cont</a>;
<a name="l00106"></a><a class="code" href="classpeoSyncMultiStart.html#8fc9a3d046023ddd077defec3c23ab3b">00106</a> eoSelect&lt; EOT &gt;&amp; <a class="code" href="classpeoSyncMultiStart.html#8fc9a3d046023ddd077defec3c23ab3b">select</a>;
<a name="l00107"></a><a class="code" href="classpeoSyncMultiStart.html#a375ccea98e9bf2a0854dac27df4522f">00107</a> eoReplacement&lt; EOT &gt;&amp; <a class="code" href="classpeoSyncMultiStart.html#a375ccea98e9bf2a0854dac27df4522f">replace</a>;
<a name="l00108"></a>00108
<a name="l00109"></a><a class="code" href="classpeoSyncMultiStart.html#4d317966de767dcc87eee0286ea7f95d">00109</a> moAlgo&lt; EOT &gt;&amp; <a class="code" href="classpeoSyncMultiStart.html#4d317966de767dcc87eee0286ea7f95d">ls</a>;
<a name="l00110"></a>00110
<a name="l00111"></a><a class="code" href="classpeoSyncMultiStart.html#391178bd6b8a97a08ab4e345f070e967">00111</a> eoPop&lt; EOT &gt;&amp; <a class="code" href="classpeoSyncMultiStart.html#391178bd6b8a97a08ab4e345f070e967">pop</a>;
<a name="l00112"></a><a class="code" href="classpeoSyncMultiStart.html#dbcc1a069ec72ecd8d40c392640d84b3">00112</a> eoPop&lt; EOT &gt; <a class="code" href="classpeoSyncMultiStart.html#dbcc1a069ec72ecd8d40c392640d84b3">sel</a>;
<a name="l00113"></a><a class="code" href="classpeoSyncMultiStart.html#ca10f6d258105e3c4f0d1660db5b7679">00113</a> eoPop&lt; EOT &gt; <a class="code" href="classpeoSyncMultiStart.html#ca10f6d258105e3c4f0d1660db5b7679">impr_sel</a>;
<a name="l00114"></a>00114
<a name="l00115"></a><a class="code" href="classpeoSyncMultiStart.html#2c2ebe46470d1425f0409897deab435b">00115</a> EOT <a class="code" href="classpeoSyncMultiStart.html#2c2ebe46470d1425f0409897deab435b">sol</a>;
<a name="l00116"></a><a class="code" href="classpeoSyncMultiStart.html#64191ef79b7b589964ac9c3e23ae6718">00116</a> <span class="keywordtype">unsigned</span> <a class="code" href="classpeoSyncMultiStart.html#64191ef79b7b589964ac9c3e23ae6718">idx</a>;
<a name="l00117"></a><a class="code" href="classpeoSyncMultiStart.html#773eb9097550d9444f25ca8f48997a30">00117</a> <span class="keywordtype">unsigned</span> <a class="code" href="classpeoSyncMultiStart.html#773eb9097550d9444f25ca8f48997a30">num_term</a>;
<a name="l00118"></a>00118 };
<a name="l00119"></a>00119
<a name="l00120"></a>00120
<a name="l00121"></a><a class="code" href="classpeoSyncMultiStart.html#d29f94aad3c1f443bfffc8b6aee0704c">00121</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <a class="code" href="classpeoSyncMultiStart.html#d29f94aad3c1f443bfffc8b6aee0704c">peoSyncMultiStart&lt; EOT &gt; :: peoSyncMultiStart</a>(
<a name="l00122"></a>00122
<a name="l00123"></a>00123 eoContinue &lt; EOT &gt;&amp; __cont,
<a name="l00124"></a>00124 eoSelect&lt; EOT &gt;&amp; __select,
<a name="l00125"></a>00125 eoReplacement&lt; EOT &gt;&amp; __replace,
<a name="l00126"></a>00126 moAlgo &lt; EOT &gt;&amp; __ls,
<a name="l00127"></a>00127 eoPop&lt; EOT &gt;&amp; __pop
<a name="l00128"></a>00128
<a name="l00129"></a>00129 ) : cont( __cont ), select( __select ), replace( __replace ), ls( __ls ), pop( __pop )
<a name="l00130"></a>00130 {
<a name="l00131"></a>00131
<a name="l00132"></a>00132 }
<a name="l00133"></a>00133
<a name="l00134"></a>00134
<a name="l00135"></a><a class="code" href="classpeoSyncMultiStart.html#8becfab1922b64708dca5a53e2932a5a">00135</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#8becfab1922b64708dca5a53e2932a5a">peoSyncMultiStart&lt; EOT &gt; :: packData</a>() {
<a name="l00136"></a>00136
<a name="l00137"></a>00137 :: pack( <a class="code" href="classpeoSyncMultiStart.html#dbcc1a069ec72ecd8d40c392640d84b3">sel</a>[ <a class="code" href="classpeoSyncMultiStart.html#64191ef79b7b589964ac9c3e23ae6718">idx</a>++ ] );
<a name="l00138"></a>00138 }
<a name="l00139"></a>00139
<a name="l00140"></a>00140
<a name="l00141"></a><a class="code" href="classpeoSyncMultiStart.html#2903a441b77cded266b5fb651e17a5b5">00141</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#2903a441b77cded266b5fb651e17a5b5">peoSyncMultiStart&lt; EOT &gt; :: unpackData</a>() {
<a name="l00142"></a>00142
<a name="l00143"></a>00143 unpack( <a class="code" href="classpeoSyncMultiStart.html#2c2ebe46470d1425f0409897deab435b">sol</a> );
<a name="l00144"></a>00144 }
<a name="l00145"></a>00145
<a name="l00146"></a>00146
<a name="l00147"></a><a class="code" href="classpeoSyncMultiStart.html#a4d1c2943c290de540800087b54dc49b">00147</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#a4d1c2943c290de540800087b54dc49b">peoSyncMultiStart&lt; EOT &gt; :: execute</a>() {
<a name="l00148"></a>00148
<a name="l00149"></a>00149 <a class="code" href="classpeoSyncMultiStart.html#4d317966de767dcc87eee0286ea7f95d">ls</a>( <a class="code" href="classpeoSyncMultiStart.html#2c2ebe46470d1425f0409897deab435b">sol</a> );
<a name="l00150"></a>00150 }
<a name="l00151"></a>00151
<a name="l00152"></a>00152
<a name="l00153"></a><a class="code" href="classpeoSyncMultiStart.html#6c48eb0dae741cff7203b65e226f9616">00153</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#6c48eb0dae741cff7203b65e226f9616">peoSyncMultiStart&lt; EOT &gt; :: packResult</a>() {
<a name="l00154"></a>00154
<a name="l00155"></a>00155 pack( <a class="code" href="classpeoSyncMultiStart.html#2c2ebe46470d1425f0409897deab435b">sol</a> );
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157
<a name="l00158"></a>00158
<a name="l00159"></a><a class="code" href="classpeoSyncMultiStart.html#c3cbd1f10a89d1915c5ccf82a2c34a1d">00159</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#c3cbd1f10a89d1915c5ccf82a2c34a1d">peoSyncMultiStart&lt; EOT &gt; :: unpackResult</a>() {
<a name="l00160"></a>00160
<a name="l00161"></a>00161 unpack( <a class="code" href="classpeoSyncMultiStart.html#2c2ebe46470d1425f0409897deab435b">sol</a> );
<a name="l00162"></a>00162 <a class="code" href="classpeoSyncMultiStart.html#ca10f6d258105e3c4f0d1660db5b7679">impr_sel</a>.push_back( <a class="code" href="classpeoSyncMultiStart.html#2c2ebe46470d1425f0409897deab435b">sol</a> );
<a name="l00163"></a>00163 <a class="code" href="classpeoSyncMultiStart.html#773eb9097550d9444f25ca8f48997a30">num_term</a>++;
<a name="l00164"></a>00164
<a name="l00165"></a>00165 <span class="keywordflow">if</span> ( <a class="code" href="classpeoSyncMultiStart.html#773eb9097550d9444f25ca8f48997a30">num_term</a> == <a class="code" href="classpeoSyncMultiStart.html#dbcc1a069ec72ecd8d40c392640d84b3">sel</a>.size() ) {
<a name="l00166"></a>00166
<a name="l00167"></a>00167 <a class="code" href="classService.html#0dae00309c51a7b7069788142aed799f">getOwner</a>()-&gt;<a class="code" href="classThread.html#e197c46f8f62ecce6d2a7fe95bdc5b38">setActive</a>();
<a name="l00168"></a>00168 <a class="code" href="classpeoSyncMultiStart.html#a375ccea98e9bf2a0854dac27df4522f">replace</a>( <a class="code" href="classpeoSyncMultiStart.html#391178bd6b8a97a08ab4e345f070e967">pop</a>, <a class="code" href="classpeoSyncMultiStart.html#ca10f6d258105e3c4f0d1660db5b7679">impr_sel</a> );
<a name="l00169"></a>00169
<a name="l00170"></a>00170 printDebugMessage( <span class="stringliteral">"replacing the improved individuals in the population."</span> );
<a name="l00171"></a>00171 <a class="code" href="classCommunicable.html#3306a9adb11a0ab5af342c0db9f7bb2a">resume</a>();
<a name="l00172"></a>00172 }
<a name="l00173"></a>00173 }
<a name="l00174"></a>00174
<a name="l00175"></a>00175
<a name="l00176"></a><a class="code" href="classpeoSyncMultiStart.html#76385b33fe514f91cb83f0fbecbeb3c2">00176</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#76385b33fe514f91cb83f0fbecbeb3c2">peoSyncMultiStart&lt; EOT &gt; :: operator()</a>() {
<a name="l00177"></a>00177
<a name="l00178"></a>00178 printDebugMessage( <span class="stringliteral">"performing the parallel multi-start hybridization."</span> );
<a name="l00179"></a>00179 <a class="code" href="classpeoSyncMultiStart.html#8fc9a3d046023ddd077defec3c23ab3b">select</a>( <a class="code" href="classpeoSyncMultiStart.html#391178bd6b8a97a08ab4e345f070e967">pop</a>, <a class="code" href="classpeoSyncMultiStart.html#dbcc1a069ec72ecd8d40c392640d84b3">sel</a> );
<a name="l00180"></a>00180 <a class="code" href="classpeoSyncMultiStart.html#ca10f6d258105e3c4f0d1660db5b7679">impr_sel</a>.clear();
<a name="l00181"></a>00181 <a class="code" href="classpeoSyncMultiStart.html#64191ef79b7b589964ac9c3e23ae6718">idx</a> = <a class="code" href="classpeoSyncMultiStart.html#773eb9097550d9444f25ca8f48997a30">num_term</a> = 0;
<a name="l00182"></a>00182 <a class="code" href="classService.html#7e2ae35a9070a05dcd46488df649896d">requestResourceRequest</a>( <a class="code" href="classpeoSyncMultiStart.html#dbcc1a069ec72ecd8d40c392640d84b3">sel</a>.size() );
<a name="l00183"></a>00183 <a class="code" href="classCommunicable.html#cb53e6534b947bc889aa181d9dbbd13b">stop</a>();
<a name="l00184"></a>00184 }
<a name="l00185"></a>00185
<a name="l00186"></a>00186
<a name="l00187"></a><a class="code" href="classpeoSyncMultiStart.html#32ec0d01d3fd8a9932abd68f4781fc94">00187</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#32ec0d01d3fd8a9932abd68f4781fc94">peoSyncMultiStart&lt; EOT &gt; :: notifySendingData</a>() {
<a name="l00188"></a>00188
<a name="l00189"></a>00189 }
<a name="l00190"></a>00190
<a name="l00191"></a>00191
<a name="l00192"></a><a class="code" href="classpeoSyncMultiStart.html#fc90282cc4e93cdea8f82fd52dd78fb0">00192</a> <span class="keyword">template</span>&lt; <span class="keyword">class</span> EOT &gt; <span class="keywordtype">void</span> <a class="code" href="classpeoSyncMultiStart.html#fc90282cc4e93cdea8f82fd52dd78fb0">peoSyncMultiStart&lt; EOT &gt; :: notifySendingAllResourceRequests</a>() {
<a name="l00193"></a>00193
<a name="l00194"></a>00194 <a class="code" href="classService.html#0dae00309c51a7b7069788142aed799f">getOwner</a>()-&gt;<a class="code" href="classThread.html#20632ffe9ddfa2a478afb0c84dc1096b">setPassive</a>();
<a name="l00195"></a>00195 }
<a name="l00196"></a>00196
<a name="l00197"></a>00197
<a name="l00198"></a>00198 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sat Dec 30 14:55:29 2006 for ParadisEO-PEO by&nbsp;
<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>