diff --git a/smp/src/intPolicy.cpp b/smp/src/intPolicy.cpp deleted file mode 100644 index ca4664403..000000000 --- a/smp/src/intPolicy.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012 - -Alexandre Quemy, Thibault Lasnier - INSA Rouen - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms. - -ParadisEO WebSite : http://paradiseo.gforge.inria.fr -Contact: paradiseo-help@lists.gforge.inria.fr -*/ - -template -paradiseo::smp::IntPolicy::IntPolicy(eoEvalFunc& _eval, eoReplacement& _replace) : - eval(_eval), - replace(_replace) -{} - diff --git a/smp/src/intPolicy.h b/smp/src/intPolicy.h index 038b5f6e3..39b43e5f1 100644 --- a/smp/src/intPolicy.h +++ b/smp/src/intPolicy.h @@ -45,21 +45,7 @@ The island model will check its policy to know how to integrate population sent */ template -class IntPolicy -{ -public: - /** - * Constructor - * @param _eval Method to evaluate the population to integrate. - * @param _replace Method to replace elements in the island. - */ - IntPolicy(eoEvalFunc& _eval, eoReplacement& _replace); - - eoEvalFunc& eval; - eoReplacement& replace; -}; - -#include +using IntPolicy = eoReplacement; } diff --git a/smp/src/island.cpp b/smp/src/island.cpp index 56e7bf7e4..14b154e74 100644 --- a/smp/src/island.cpp +++ b/smp/src/island.cpp @@ -38,6 +38,8 @@ paradiseo::smp::Island::Island(unsigned _popSize, eoInit& _chro ContWrapper(Loop().template findValue>(args...), this), // We inject the wrapped continuator by tag dispatching method during the algorithm construction. algo(EOAlgo(wrap_pp>(this->ck,args)...)), + // With the PPE we look for the eval function in order to evaluate EOT to integrate + eval(Loop().template findValue>(args...)), pop(_popSize, _chromInit), intPolicy(_intPolicy), migPolicy(_migPolicy), @@ -120,9 +122,12 @@ void paradiseo::smp::Island::receive(void) while (!listImigrants.empty()) { eoPop offspring = *(listImigrants.front()); - for(auto indi : offspring) - intPolicy.replace(pop, offspring); + // Evaluate objects to integrate + for(auto& indi : offspring) + eval(indi); + + intPolicy(pop, offspring); listImigrants.pop(); } diff --git a/smp/src/island.h b/smp/src/island.h index 55ec1bde2..7b9fbf656 100644 --- a/smp/src/island.h +++ b/smp/src/island.h @@ -117,7 +117,8 @@ protected: */ virtual void receive(void); - IslandModel* model; + IslandModel* model; + eoEvalFunc& eval; eoPop pop; EOAlgo algo; std::queue*> listImigrants; @@ -125,6 +126,7 @@ protected: MigPolicy& migPolicy; std::atomic stopped; std::vector sentMessages; + }; #include diff --git a/smp/test/t-smpIsland.cpp b/smp/test/t-smpIsland.cpp index 555650367..82f92825a 100644 --- a/smp/test/t-smpIsland.cpp +++ b/smp/test/t-smpIsland.cpp @@ -61,8 +61,7 @@ int main(void) migPolicy.push_back(PolicyElement(who, criteria)); // // Integration policy - eoPlusReplacement replace_1; - IntPolicy intPolicy(plainEval,replace_1); + eoPlusReplacement intPolicy; Island test(param.popSize, chromInit, intPolicy, migPolicy, genCont, plainEval, select, transform, replace); @@ -77,8 +76,7 @@ int main(void) migPolicy_2.push_back(PolicyElement(who_2, criteria_2)); // // Integration policy - eoPlusReplacement replace_2; - IntPolicy intPolicy_2(plainEval,replace_2); + eoPlusReplacement intPolicy_2; Island test2(param.popSize, chromInit, intPolicy_2, migPolicy_2, genCont_2, plainEval, select, transform, replace);