diff --git a/smp/src/CMakeLists.txt b/smp/src/CMakeLists.txt index 0e8d1bc0d..176e333e3 100644 --- a/smp/src/CMakeLists.txt +++ b/smp/src/CMakeLists.txt @@ -45,7 +45,7 @@ install(FILES ${HDRS} DESTINATION include${INSTALL_SUB_DIR}/smp COMPONENT header ### 4) Install directories ###################################################################################### -install(DIRECTORY MWAlgo +install(DIRECTORY MWAlgo topology DESTINATION include${INSTALL_SUB_DIR}/smp COMPONENT headers FILES_MATCHING PATTERN "*.h" diff --git a/smp/src/bimap.h b/smp/src/bimap.h index 8d85bc102..231435ed8 100644 --- a/smp/src/bimap.h +++ b/smp/src/bimap.h @@ -28,7 +28,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr */ #ifndef BIMAP_MODEL_H_ -#define BIMAP_H_ +#define BIMAP_MODEL_H_ #include #include diff --git a/smp/test/t-smpMI_Homogeneous.cpp b/smp/test/t-smpMI_Homogeneous.cpp index f67a3fc4b..ebe647460 100644 --- a/smp/test/t-smpMI_Homogeneous.cpp +++ b/smp/test/t-smpMI_Homogeneous.cpp @@ -6,6 +6,19 @@ using namespace paradiseo::smp; using namespace std; +void changeTopo(IslandModel& _model, AbstractTopology& _topo) +{ + static bool first = false; + // Change topology after 1s of computation + std::chrono::milliseconds dura(1000); + std::this_thread::sleep_for( dura ); + if(!first) + { + _model.setTopology(_topo); + first = !first; + } +} + int main(void) { // Defining parameters @@ -35,6 +48,11 @@ int main(void) eoSGATransform transform(Xover, param.pCross, mutationSwap, param.pMut); eoPlusReplacement replace; + // MODEL + // Topologies + Topology topo; + IslandModel model(topo); + // ISLAND 1 // // Algorithm part eoGenContinue genCont(param.maxGen+100); @@ -45,6 +63,10 @@ int main(void) eoDetTournamentSelect selectOne1(20); eoSelectNumber who(selectOne1, 3); + Topology topo2; + //std::function task = std::bind(changeTopo, model, topo2); + //Notifier topoChanger(task); + MigPolicy migPolicy; migPolicy.push_back(PolicyElement(who, criteria)); @@ -92,24 +114,14 @@ int main(void) try { - // Topologies - Topology topo; - Topology topo2; - IslandModel model(topo); + + model.add(test); model.add(test2); model.add(test3); - std::thread t = std::thread(&IslandModel::operator(), &model); - - // Change topology after 1s of computation - std::chrono::milliseconds dura(1000); - std::this_thread::sleep_for( dura ); - - model.setTopology(topo2); - - t.join(); + model(); cout << test.getPop() << endl; cout << test2.getPop() << endl;