added generic island mig tests (DEV)

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@890 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
legrand 2008-01-17 08:43:35 +00:00
commit 5859f77d9f
4 changed files with 86 additions and 61 deletions

View file

@ -54,20 +54,21 @@ ENDIF(WIN32 AND NOT CYGWIN)
### 3) Define your target(s): just an executable here
######################################################################################
ADD_EXECUTABLE(example1 main1.cpp)
ADD_DEPENDENCIES(example1 peo rmc_mpi)
ADD_EXECUTABLE(example2 main2.cpp)
ADD_DEPENDENCIES(example2 peo rmc_mpi)
ADD_EXECUTABLE(example3 main3.cpp)
ADD_DEPENDENCIES(example3 peo rmc_mpi)
#ADD_EXECUTABLE(example1 main1.cpp)
#ADD_DEPENDENCIES(example1 peo rmc_mpi)
#ADD_EXECUTABLE(example2 main2.cpp)
#ADD_DEPENDENCIES(example2 peo rmc_mpi)
#ADD_EXECUTABLE(example3 main3.cpp)
#ADD_DEPENDENCIES(example3 peo rmc_mpi)
ADD_EXECUTABLE(example4 main4.cpp)
ADD_DEPENDENCIES(example4 peo rmc_mpi)
ADD_EXECUTABLE(example5 main5.cpp)
ADD_DEPENDENCIES(example5 tsp peo rmc_mpi)
ADD_EXECUTABLE(example6 main6.cpp)
ADD_DEPENDENCIES(example6 tsp peo rmc_mpi)
ADD_EXECUTABLE(example7 main7.cpp)
ADD_DEPENDENCIES(example7 peo rmc_mpi)
#ADD_EXECUTABLE(example5 main5.cpp)
#ADD_DEPENDENCIES(example5 tsp peo rmc_mpi)
#ADD_EXECUTABLE(example6 main6.cpp)
#ADD_DEPENDENCIES(example6 tsp peo rmc_mpi)
#ADD_EXECUTABLE(example7 main7.cpp)
#ADD_DEPENDENCIES(example7 peo rmc_mpi)
######################################################################################
@ -84,12 +85,12 @@ ADD_DEPENDENCIES(example7 peo rmc_mpi)
### 5) Link the librairies
######################################################################################
TARGET_LINK_LIBRARIES(example1 ${XML2_LIBS} peo rmc_mpi eo eoutils)
TARGET_LINK_LIBRARIES(example2 ${XML2_LIBS} peo rmc_mpi eo eoutils)
TARGET_LINK_LIBRARIES(example3 ${XML2_LIBS} peo rmc_mpi eo eoutils)
#TARGET_LINK_LIBRARIES(example1 ${XML2_LIBS} peo rmc_mpi eo eoutils)
#TARGET_LINK_LIBRARIES(example2 ${XML2_LIBS} peo rmc_mpi eo eoutils)
#TARGET_LINK_LIBRARIES(example3 ${XML2_LIBS} peo rmc_mpi eo eoutils)
TARGET_LINK_LIBRARIES(example4 ${XML2_LIBS} peo rmc_mpi eo eoutils)
TARGET_LINK_LIBRARIES(example5 ${XML2_LIBS} tsp peo rmc_mpi eo eoutils)
TARGET_LINK_LIBRARIES(example6 ${XML2_LIBS} tsp peo rmc_mpi eo eoutils)
TARGET_LINK_LIBRARIES(example7 ${XML2_LIBS} tsp peo rmc_mpi eo eoutils)
#TARGET_LINK_LIBRARIES(example5 ${XML2_LIBS} tsp peo rmc_mpi eo eoutils)
#TARGET_LINK_LIBRARIES(example6 ${XML2_LIBS} tsp peo rmc_mpi eo eoutils)
#TARGET_LINK_LIBRARIES(example7 ${XML2_LIBS} tsp peo rmc_mpi eo eoutils)
######################################################################################

View file

@ -1,6 +1,8 @@
#include <peo>
#include <es.h>
#include <peoPop.h>
typedef eoRealParticle < double >Indi;
double f (const Indi & _indi)
@ -47,7 +49,7 @@ int main( int __argc, char** __argv )
eoFirstIsBestInit < Indi > localInit;
eoRealVectorBounds bndsFlight(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
eoStandardFlight < Indi > flight(bndsFlight);
eoPop < Indi > pop;
peoPop < Indi > pop;
pop.append (POP_SIZE, random);
eoLinearTopology<Indi> topology(NEIGHBORHOOD_SIZE);
eoRealVectorBounds bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
@ -76,7 +78,7 @@ int main( int __argc, char** __argv )
eoFirstIsBestInit < Indi > localInit2;
eoRealVectorBounds bndsFlight2(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
eoStandardFlight < Indi > flight2(bndsFlight2);
eoPop < Indi > pop2;
peoPop < Indi > pop2;
pop2.append (POP_SIZE, random2);
eoLinearTopology<Indi> topology2(NEIGHBORHOOD_SIZE);
eoRealVectorBounds bnds2(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
@ -85,6 +87,7 @@ int main( int __argc, char** __argv )
// Island model
eoPeriodicContinue< Indi > mig_cont2( MIG_FREQ );
peoPSOSelect<Indi> mig_selec2(topology2);
eoSelectNumber< Indi > mig_select2(mig_selec2);
@ -93,10 +96,11 @@ int main( int __argc, char** __argv )
// Island model
peoAsyncIslandMig< Indi > mig( mig_cont, mig_select, mig_replace, topologyMig, pop, pop);
peoAsyncIslandMig< Indi, peoPop<Indi> > mig(mig_select, mig_replace, topologyMig, pop, pop);
checkpoint.add( mig );
peoAsyncIslandMig< Indi > mig2( mig_cont2, mig_select2, mig_replace2, topologyMig, pop2, pop2);
peoAsyncIslandMig< Indi, peoPop<Indi> > mig2(mig_select2, mig_replace2, topologyMig, pop2, pop2);
checkpoint2.add( mig2 );
@ -117,4 +121,5 @@ int main( int __argc, char** __argv )
std::cout << "Final population :\n" << pop << std::endl;
std::cout << "Final population :\n" << pop2 << std::endl;
}
}