From ec22cf9d347ef617bee5403a4d270f4fa39893c7 Mon Sep 17 00:00:00 2001 From: atantar Date: Mon, 2 Jul 2007 10:55:25 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@485 331e1502-861f-0410-8da2-ba01fb791d7f --- trunk/paradiseo-peo/tutorial/CMakeLists.txt | 2 +- .../tutorial/Walkthrough/CMakeLists.txt | 16 ++ .../tutorial/Walkthrough/build/lessonA.param | 11 + .../tutorial/Walkthrough/build/lessonB.param | 11 + .../tutorial/Walkthrough/build/lessonC.param | 11 + .../tutorial/Walkthrough/build/lessonD.param | 11 + .../tutorial/Walkthrough/build/schemaA.xml | 10 + .../tutorial/Walkthrough/build/schemaB.xml | 10 + .../tutorial/Walkthrough/build/schemaC.xml | 17 ++ .../tutorial/Walkthrough/build/schemaD.xml | 16 ++ .../tutorial/Walkthrough/src/CMakeLists.txt | 110 ++++++++ .../tutorial/Walkthrough/src/exampleA.cpp | 74 ++++++ .../tutorial/Walkthrough/src/exampleB.cpp | 85 ++++++ .../tutorial/Walkthrough/src/exampleC.cpp | 120 +++++++++ .../tutorial/Walkthrough/src/exampleD.cpp | 70 +++++ .../src/paradiseo-peo-lsn.doxyfile | 241 ++++++++++++++++++ 16 files changed, 814 insertions(+), 1 deletion(-) create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/CMakeLists.txt create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonA.param create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonB.param create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonC.param create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonD.param create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaA.xml create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaB.xml create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaC.xml create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaD.xml create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/src/CMakeLists.txt create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleA.cpp create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleB.cpp create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleC.cpp create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleD.cpp create mode 100644 trunk/paradiseo-peo/tutorial/Walkthrough/src/paradiseo-peo-lsn.doxyfile diff --git a/trunk/paradiseo-peo/tutorial/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/CMakeLists.txt index dc4c1ec6e..9feca2dc5 100644 --- a/trunk/paradiseo-peo/tutorial/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/CMakeLists.txt @@ -11,6 +11,6 @@ SET(TSP_EXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples/tsp CACHE PATH "TSP exa ### 2) Where must cmake go now ? ###################################################################################### -SUBDIRS(examples Lesson1 Lesson2 Lesson3) +SUBDIRS(examples Lesson1 Lesson2 Lesson3 Walkthrough) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Walkthrough/CMakeLists.txt new file mode 100644 index 000000000..99d4f1182 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/CMakeLists.txt @@ -0,0 +1,16 @@ + +###################################################################################### +### 0) Need walkthrough directory +###################################################################################### + +SET(TUTORIAL_WALKTHROUGH_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +###################################################################################### + +###################################################################################### +### 1) Where must cmake go now ? +###################################################################################### + +SUBDIRS(src) + +###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonA.param b/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonA.param new file mode 100644 index 000000000..7834acc95 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonA.param @@ -0,0 +1,11 @@ +## miscallenous parameters + +--debug=false + +## deployment schema + +--schema=schemaA.xml + +## parameters + +--inst=../../examples/tsp/benchs/eil101.tsp diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonB.param b/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonB.param new file mode 100644 index 000000000..7f3afded5 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonB.param @@ -0,0 +1,11 @@ +## miscallenous parameters + +--debug=false + +## deployment schema + +--schema=schemaB.xml + +## parameters + +--inst=../../examples/tsp/benchs/eil101.tsp diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonC.param b/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonC.param new file mode 100644 index 000000000..164d3d82b --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonC.param @@ -0,0 +1,11 @@ +## miscallenous parameters + +--debug=false + +## deployment schema + +--schema=schemaC.xml + +## parameters + +--inst=../../examples/tsp/benchs/eil101.tsp diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonD.param b/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonD.param new file mode 100644 index 000000000..834fbe9e9 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/build/lessonD.param @@ -0,0 +1,11 @@ +## miscallenous parameters + +--debug=false + +## deployment schema + +--schema=schemaD.xml + +## parameters + +--inst=../../examples/tsp/benchs/eil101.tsp diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaA.xml b/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaA.xml new file mode 100644 index 000000000..47b198b4c --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaA.xml @@ -0,0 +1,10 @@ + + + + + + 1 + + + + diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaB.xml b/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaB.xml new file mode 100644 index 000000000..47b198b4c --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaB.xml @@ -0,0 +1,10 @@ + + + + + + 1 + + + + diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaC.xml b/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaC.xml new file mode 100644 index 000000000..ec4663176 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaC.xml @@ -0,0 +1,17 @@ + + + + + + + + 1 + 2 + + + + + + + + diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaD.xml b/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaD.xml new file mode 100644 index 000000000..b352f8b19 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/build/schemaD.xml @@ -0,0 +1,16 @@ + + + + + + + + 1 + + + + + + + + diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/src/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Walkthrough/src/CMakeLists.txt new file mode 100644 index 000000000..d69162fb0 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/src/CMakeLists.txt @@ -0,0 +1,110 @@ + +###################################################################################### +### 0) Set the compiler +###################################################################################### + +SET (CMAKE_CXX_COMPILER mpicxx) + +###################################################################################### + + +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}) +INCLUDE_DIRECTORIES(${MO_SRC_DIR}) +INCLUDE_DIRECTORIES(${PEO_SRC_DIR}) +INCLUDE_DIRECTORIES(${TSP_EXAMPLE_DIR}/src) + +###################################################################################### + + +###################################################################################### +### 2) Specify where CMake can find the libraries (mandatory: before 3) ) +###################################################################################### + +LINK_DIRECTORIES( ${EO_SRC_DIR} + ${EO_SRC_DIR}/utils + ${PEO_DIR}/build + ${TSP_EXAMPLE_DIR}/build) + +###################################################################################### + + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +# no matter what is the OS, hopefully +ADD_EXECUTABLE(exampleA exampleA.cpp) +ADD_EXECUTABLE(exampleB exampleB.cpp) +ADD_EXECUTABLE(exampleC exampleC.cpp) +ADD_EXECUTABLE(exampleD exampleD.cpp) + +ADD_DEPENDENCIES(exampleA tsp) +ADD_DEPENDENCIES(exampleB tsp) +ADD_DEPENDENCIES(exampleC tsp) +ADD_DEPENDENCIES(exampleD tsp) + +ADD_DEPENDENCIES(exampleA peo) +ADD_DEPENDENCIES(exampleB peo) +ADD_DEPENDENCIES(exampleC peo) +ADD_DEPENDENCIES(exampleD peo) + +ADD_DEPENDENCIES(exampleA rmc_mpi) +ADD_DEPENDENCIES(exampleB rmc_mpi) +ADD_DEPENDENCIES(exampleC rmc_mpi) +ADD_DEPENDENCIES(exampleD rmc_mpi) + +SET(EXECUTABLE_OUTPUT_PATH ${TUTORIAL_WALKTHROUGH_DIR}/build) +###################################################################################### + + +###################################################################################### +### 4) Optionnal: define your target(s)'s version: no effect for windows +###################################################################################### + +SET(WALKTHROUGH_VERSION "1.0.beta") +SET_TARGET_PROPERTIES(exampleA PROPERTIES VERSION "${WALKTHROUGH_VERSION}") +SET_TARGET_PROPERTIES(exampleB PROPERTIES VERSION "${WALKTHROUGH_VERSION}") +SET_TARGET_PROPERTIES(exampleC PROPERTIES VERSION "${WALKTHROUGH_VERSION}") +SET_TARGET_PROPERTIES(exampleD PROPERTIES VERSION "${WALKTHROUGH_VERSION}") +###################################################################################### + + +###################################################################################### +### 5) Link the librairies +###################################################################################### + +TARGET_LINK_LIBRARIES(exampleA ${XML2_LIBS}) # define in CMakeLists.txt at PEO root dir +TARGET_LINK_LIBRARIES(exampleB ${XML2_LIBS}) # define in CMakeLists.txt at PEO root dir +TARGET_LINK_LIBRARIES(exampleC ${XML2_LIBS}) # define in CMakeLists.txt at PEO root dir +TARGET_LINK_LIBRARIES(exampleD ${XML2_LIBS}) # define in CMakeLists.txt at PEO root dir + +TARGET_LINK_LIBRARIES(exampleA tsp) +TARGET_LINK_LIBRARIES(exampleB tsp) +TARGET_LINK_LIBRARIES(exampleC tsp) +TARGET_LINK_LIBRARIES(exampleD tsp) + +TARGET_LINK_LIBRARIES(exampleA peo) +TARGET_LINK_LIBRARIES(exampleB peo) +TARGET_LINK_LIBRARIES(exampleC peo) +TARGET_LINK_LIBRARIES(exampleD peo) + +TARGET_LINK_LIBRARIES(exampleA rmc_mpi) +TARGET_LINK_LIBRARIES(exampleB rmc_mpi) +TARGET_LINK_LIBRARIES(exampleC rmc_mpi) +TARGET_LINK_LIBRARIES(exampleD rmc_mpi) + +TARGET_LINK_LIBRARIES(exampleA eo) +TARGET_LINK_LIBRARIES(exampleB eo) +TARGET_LINK_LIBRARIES(exampleC eo) +TARGET_LINK_LIBRARIES(exampleD eo) + +TARGET_LINK_LIBRARIES(exampleA eoutils) +TARGET_LINK_LIBRARIES(exampleB eoutils) +TARGET_LINK_LIBRARIES(exampleC eoutils) +TARGET_LINK_LIBRARIES(exampleD eoutils) + +###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleA.cpp b/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleA.cpp new file mode 100644 index 000000000..4f9577320 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleA.cpp @@ -0,0 +1,74 @@ +// (c) OPAC Team, LIFL, July 2007 +// +// Contact: paradiseo-help@lists.gforge.inria.fr + +#include "param.h" +#include "route_init.h" +#include "route_eval.h" + +#include "order_xover.h" +#include "edge_xover.h" +#include "partial_mapped_xover.h" +#include "city_swap.h" +#include "part_route_eval.h" +#include "merge_route_eval.h" +#include "two_opt_init.h" +#include "two_opt_next.h" +#include "two_opt_incr_eval.h" + +#include + +#define POP_SIZE 10 +#define NUM_GEN 10 +#define CROSS_RATE 1.0 +#define MUT_RATE 0.01 + + +int main (int __argc, char * * __argv) { + + peo :: init (__argc, __argv); + + + loadParameters (__argc, __argv); /* Processing some parameters relative to the tackled + problem (TSP) */ + + RouteInit route_init; /* Its builds random routes */ + RouteEval full_eval; /* Full route evaluator */ + + + OrderXover order_cross; /* Recombination */ + PartialMappedXover pm_cross; + EdgeXover edge_cross; + CitySwap city_swap_mut; /* Mutation */ + + + /** Local Search */ + TwoOptInit pmx_two_opt_init; + TwoOptNext pmx_two_opt_next; + TwoOptIncrEval pmx_two_opt_incr_eval; + moBestImprSelect pmx_two_opt_move_select; + moHC hc (pmx_two_opt_init, pmx_two_opt_next, pmx_two_opt_incr_eval, pmx_two_opt_move_select, full_eval); + + /** The EA */ + eoPop ox_pop (POP_SIZE, route_init); /* Population */ + + eoGenContinue ox_cont (NUM_GEN); /* A fixed number of iterations */ + eoCheckPoint ox_checkpoint (ox_cont); /* Checkpoint */ + peoSeqPopEval ox_pop_eval (full_eval); + eoStochTournamentSelect ox_select_one; + eoSelectNumber ox_select (ox_select_one, POP_SIZE); + eoSGATransform ox_transform (order_cross, CROSS_RATE, city_swap_mut, MUT_RATE); + peoSeqTransform ox_para_transform (ox_transform); + eoEPReplacement ox_replace (2); + + peoEA ox_ea (ox_checkpoint, ox_pop_eval, ox_select, ox_para_transform, ox_replace); + + ox_ea (ox_pop); /* Application to the given population */ + + + peo :: run (); + peo :: finalize (); /* Termination */ + + + return 0; +} diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleB.cpp b/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleB.cpp new file mode 100644 index 000000000..a1066a2b8 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleB.cpp @@ -0,0 +1,85 @@ +// (c) OPAC Team, LIFL, July 2007 +// +// Contact: paradiseo-help@lists.gforge.inria.fr + +#include "param.h" +#include "route_init.h" +#include "route_eval.h" + +#include "order_xover.h" +#include "edge_xover.h" +#include "partial_mapped_xover.h" +#include "city_swap.h" +#include "part_route_eval.h" +#include "merge_route_eval.h" +#include "two_opt_init.h" +#include "two_opt_next.h" +#include "two_opt_incr_eval.h" + +#include + +#define POP_SIZE 10 +#define NUM_GEN 10 +#define CROSS_RATE 1.0 +#define MUT_RATE 0.01 + + +int main (int __argc, char * * __argv) { + + peo :: init (__argc, __argv); + + + loadParameters (__argc, __argv); /* Processing some parameters relative to the tackled + problem (TSP) */ + + RouteInit route_init; /* Its builds random routes */ + RouteEval full_eval; /* Full route evaluator */ + + + OrderXover order_cross; /* Recombination */ + PartialMappedXover pm_cross; + EdgeXover edge_cross; + CitySwap city_swap_mut; /* Mutation */ + + + /** Local Search */ + TwoOptInit pmx_two_opt_init; + TwoOptNext pmx_two_opt_next; + TwoOptIncrEval pmx_two_opt_incr_eval; + moBestImprSelect pmx_two_opt_move_select; + moHC hc (pmx_two_opt_init, pmx_two_opt_next, pmx_two_opt_incr_eval, pmx_two_opt_move_select, full_eval); + + /** The EA */ + eoPop ox_pop (POP_SIZE, route_init); /* Population */ + + eoGenContinue ox_cont (NUM_GEN); /* A fixed number of iterations */ + eoCheckPoint ox_checkpoint (ox_cont); /* Checkpoint */ + peoSeqPopEval ox_pop_eval (full_eval); + eoStochTournamentSelect ox_select_one; + eoSelectNumber ox_select (ox_select_one, POP_SIZE); + eoSGATransform ox_transform (order_cross, CROSS_RATE, city_swap_mut, MUT_RATE); + peoSeqTransform ox_para_transform (ox_transform); + eoEPReplacement ox_replace (2); + + peoEA ox_ea (ox_checkpoint, ox_pop_eval, ox_select, ox_para_transform, ox_replace); + + ox_ea (ox_pop); /* Application to the given population */ + + + peo :: run (); + peo :: finalize (); /* Termination */ + + + hc( ox_pop[ 0 ] ); + + + for ( unsigned long index = 1; index < ox_pop.size(); index++ ) { + + std :: cout << ox_pop[ index ].fitness(); + hc( ox_pop[ index ] ); + std :: cout << " -> " << ox_pop[ index ].fitness() << std :: endl; + } + + + return 0; +} diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleC.cpp b/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleC.cpp new file mode 100644 index 000000000..f74c89aa7 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleC.cpp @@ -0,0 +1,120 @@ +// (c) OPAC Team, LIFL, July 2007 +// +// Contact: paradiseo-help@lists.gforge.inria.fr + +#include "param.h" +#include "route_init.h" +#include "route_eval.h" + +#include "order_xover.h" +#include "edge_xover.h" +#include "partial_mapped_xover.h" +#include "city_swap.h" +#include "part_route_eval.h" +#include "merge_route_eval.h" +#include "two_opt_init.h" +#include "two_opt_next.h" +#include "two_opt_incr_eval.h" + +#include + +#define POP_SIZE 10 +#define NUM_GEN 10 +#define CROSS_RATE 1.0 +#define MUT_RATE 0.01 + +#define MIG_FREQ 2 +#define MIG_SIZE 5 + + +int main (int __argc, char * * __argv) { + + peo :: init (__argc, __argv); + + + loadParameters (__argc, __argv); /* Processing some parameters relative to the tackled + problem (TSP) */ + + RouteInit route_init; /* Its builds random routes */ + RouteEval full_eval; /* Full route evaluator */ + + + OrderXover order_cross; /* Recombination */ + CitySwap city_swap_mut; /* Mutation */ + + + /* Migration topology */ + RingTopology topo; + + + + // The First EA ------------------------------------------------------------------------------------- + eoPop ox_pop (POP_SIZE, route_init); /* Population */ + + eoGenContinue ox_cont (NUM_GEN); /* A fixed number of iterations */ + eoCheckPoint ox_checkpoint (ox_cont); /* Checkpoint */ + peoSeqPopEval ox_pop_eval (full_eval); + eoStochTournamentSelect ox_select_one; + eoSelectNumber ox_select (ox_select_one, POP_SIZE); + eoSGATransform ox_transform (order_cross, CROSS_RATE, city_swap_mut, MUT_RATE); + peoSeqTransform ox_para_transform (ox_transform); + eoEPReplacement ox_replace (2); + + + /* The migration policy */ + eoPeriodicContinue ox_mig_cont (MIG_FREQ); /* Migration occurs periodically */ + eoRandomSelect ox_mig_select_one; /* Emigrants are randomly selected */ + eoSelectNumber ox_mig_select (ox_mig_select_one, MIG_SIZE); + eoPlusReplacement ox_mig_replace; /* Immigrants replace the worse individuals */ + + peoAsyncIslandMig ox_mig (ox_mig_cont, ox_mig_select, ox_mig_replace, topo, ox_pop, ox_pop); + ox_checkpoint.add (ox_mig); + + peoEA ox_ea (ox_checkpoint, ox_pop_eval, ox_select, ox_para_transform, ox_replace); + ox_mig.setOwner (ox_ea); + + ox_ea (ox_pop); /* Application to the given population */ + // -------------------------------------------------------------------------------------------------- + + + + + // The Second EA ------------------------------------------------------------------------------------ + eoPop ox_pop2 (POP_SIZE, route_init); /* Population */ + + eoGenContinue ox_cont2 (NUM_GEN); /* A fixed number of iterations */ + eoCheckPoint ox_checkpoint2 (ox_cont2); /* Checkpoint */ + peoSeqPopEval ox_pop_eval2 (full_eval); + eoStochTournamentSelect ox_select_one2; + eoSelectNumber ox_select2 (ox_select_one2, POP_SIZE); + eoSGATransform ox_transform2 (order_cross, CROSS_RATE, city_swap_mut, MUT_RATE); + peoSeqTransform ox_para_transform2 (ox_transform2); + eoEPReplacement ox_replace2 (2); + + + /* The migration policy */ + eoPeriodicContinue ox_mig_cont2 (MIG_FREQ); /* Migration occurs periodically */ + eoRandomSelect ox_mig_select_one2; /* Emigrants are randomly selected */ + eoSelectNumber ox_mig_select2 (ox_mig_select_one2, MIG_SIZE); + eoPlusReplacement ox_mig_replace2; /* Immigrants replace the worse individuals */ + + peoAsyncIslandMig ox_mig2 (ox_mig_cont2, ox_mig_select2, ox_mig_replace2, topo, ox_pop2, ox_pop2); + ox_checkpoint2.add (ox_mig2); + + peoEA ox_ea2 (ox_checkpoint2, ox_pop_eval2, ox_select2, ox_para_transform2, ox_replace2); + ox_mig2.setOwner (ox_ea2); + + ox_ea2 (ox_pop2); /* Application to the given population */ + // -------------------------------------------------------------------------------------------------- + + + + peo :: run (); + peo :: finalize (); /* Termination */ + + + std::cout << ox_pop[ 0 ].fitness() << std::endl; + + + return 0; +} diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleD.cpp b/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleD.cpp new file mode 100644 index 000000000..92a4b25f4 --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/src/exampleD.cpp @@ -0,0 +1,70 @@ +// (c) OPAC Team, LIFL, July 2007 +// +// Contact: paradiseo-help@lists.gforge.inria.fr + +#include "param.h" +#include "route_init.h" +#include "route_eval.h" + +#include "order_xover.h" +#include "edge_xover.h" +#include "partial_mapped_xover.h" +#include "city_swap.h" +#include "part_route_eval.h" +#include "merge_route_eval.h" +#include "two_opt_init.h" +#include "two_opt_next.h" +#include "two_opt_incr_eval.h" + +#include + +#define POP_SIZE 10 +#define NUM_GEN 10 +#define CROSS_RATE 1.0 +#define MUT_RATE 0.01 + + + +int main (int __argc, char * * __argv) { + + peo :: init (__argc, __argv); + + + loadParameters (__argc, __argv); /* Processing some parameters relative to the tackled + problem (TSP) */ + + RouteInit route_init; /* Its builds random routes */ + RouteEval full_eval; /* Full route evaluator */ + + + OrderXover order_cross; /* Recombination */ + CitySwap city_swap_mut; /* Mutation */ + + + /** The EA */ + eoPop ox_pop (POP_SIZE, route_init); /* Population */ + + eoGenContinue ox_cont (NUM_GEN); /* A fixed number of iterations */ + eoCheckPoint ox_checkpoint (ox_cont); /* Checkpoint */ + peoParaPopEval ox_pop_eval (full_eval); + eoStochTournamentSelect ox_select_one; + eoSelectNumber ox_select (ox_select_one, POP_SIZE); + eoSGATransform ox_transform (order_cross, CROSS_RATE, city_swap_mut, MUT_RATE); + peoSeqTransform ox_para_transform (ox_transform); + eoEPReplacement ox_replace (2); + + + peoEA ox_ea (ox_checkpoint, ox_pop_eval, ox_select, ox_para_transform, ox_replace); + + + ox_ea (ox_pop); /* Application to the given population */ + + peo :: run (); + peo :: finalize (); /* Termination */ + + + std::cout << ox_pop[ 0 ].fitness() << std::endl; + + + return 0; +} diff --git a/trunk/paradiseo-peo/tutorial/Walkthrough/src/paradiseo-peo-lsn.doxyfile b/trunk/paradiseo-peo/tutorial/Walkthrough/src/paradiseo-peo-lsn.doxyfile new file mode 100644 index 000000000..9f9d15d8f --- /dev/null +++ b/trunk/paradiseo-peo/tutorial/Walkthrough/src/paradiseo-peo-lsn.doxyfile @@ -0,0 +1,241 @@ +# Doxyfile 1.4.7 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "ParadisEO-PEO Lesson1" +PROJECT_NUMBER = 0.1 +OUTPUT_DIRECTORY = ../../docs/html/lesson1 +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = NO +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = YES +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = . +FILE_PATTERNS = *.cpp \ + *.h \ + NEWS \ + README +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = ../../docs/images +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 3 +IGNORE_PREFIX = peo +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = YES +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = ../../../paradiseo-mo/docs/eo.doxytag=../../../../../paradiseo-mo/docs/html \ + ../../../paradiseo-mo/docs/mo.doxytag=../../../../../paradiseo-mo/docs/html \ + ../../docs/paradiseo-peo.doxytag=../../ \ + ../shared/paradiseo-peo-lsn-shared.doxytag=../../lsnshared/html +GENERATE_TAGFILE = ../../docs/paradiseo-peo-lsn.doxytag +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = YES