diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2mainEA_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2mainEA_8cpp-source.html new file mode 100644 index 000000000..52af70bdb --- /dev/null +++ b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2mainEA_8cpp-source.html @@ -0,0 +1,145 @@ + +
+00001 /* +00002 * <mainEA.cpp> +00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 +00004 * (C) OPAC Team, INRIA, 2008 +00005 * +00006 * Clive Canape +00007 * +00008 * This software is governed by the CeCILL license under French law and +00009 * abiding by the rules of distribution of free software. You can use, +00010 * modify and/ or redistribute the software under the terms of the CeCILL +00011 * license as circulated by CEA, CNRS and INRIA at the following URL +00012 * "http://www.cecill.info". +00013 * +00014 * As a counterpart to the access to the source code and rights to copy, +00015 * modify and redistribute granted by the license, users are provided only +00016 * with a limited warranty and the software's author, the holder of the +00017 * economic rights, and the successive licensors have only limited liability. +00018 * +00019 * In this respect, the user's attention is drawn to the risks associated +00020 * with loading, using, modifying and/or developing or reproducing the +00021 * software by the user in light of its specific status of free software, +00022 * that may mean that it is complicated to manipulate, and that also +00023 * therefore means that it is reserved for developers and experienced +00024 * professionals having in-depth computer knowledge. Users are therefore +00025 * encouraged to load and test the software's suitability as regards their +00026 * requirements in conditions enabling the security of their systems and/or +00027 * data to be ensured and, more generally, to use and operate it in the +00028 * same conditions as regards security. +00029 * The fact that you are presently reading this means that you have had +00030 * knowledge of the CeCILL license and that you accept its terms. +00031 * +00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr +00033 * Contact: paradiseo-help@lists.gforge.inria.fr +00034 * +00035 */ +00036 +00037 #include <peo> +00038 #include <es.h> +00039 +00040 typedef eoReal<double> Indi; +00041 +00042 //Evaluation function +00043 double f (const Indi & _indi) +00044 { +00045 // Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2 +00046 // => optimal : f* = 0 , with x* =(1,1) +00047 +00048 double sum; +00049 sum=_indi[1]-pow(_indi[0],2); +00050 sum=100*pow(sum,2); +00051 sum+=pow((1-_indi[0]),2); +00052 return (-sum); +00053 } +00054 +00055 int main (int __argc, char *__argv[]) +00056 { +00057 +00058 // Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself +00059 peo :: init( __argc, __argv ); +00060 +00061 //Parameters +00062 eoParser parser(__argc, __argv); +00063 unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value(); +00064 unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value(); +00065 double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value(); +00066 double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value(); +00067 double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value(); +00068 unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); +00069 double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); +00070 double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); +00071 rng.reseed (time(0)); +00072 +00073 // Stopping +00074 eoGenContinue < Indi > genContPara (MAX_GEN); +00075 eoCombinedContinue <Indi> continuatorPara (genContPara); +00076 eoCheckPoint<Indi> checkpoint(continuatorPara); +00077 +00078 // For a parallel evaluation +00079 peoEvalFunc<Indi> plainEval(f); +00080 peoPopEval <Indi> eval(plainEval); +00081 +00082 // Initialization +00083 eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX); +00084 eoInitFixedLength < Indi > random (VEC_SIZE, uGen); +00085 +00086 // Selection +00087 eoRankingSelect<Indi> selectionStrategy; +00088 eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE); +00089 +00090 // Transformation +00091 eoSegmentCrossover<Indi> crossover; +00092 eoUniformMutation<Indi> mutation(EPSILON); +00093 eoSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE); +00094 +00095 // Replacement +00096 eoPlusReplacement<Indi> replace; +00097 +00098 // Creation of the population +00099 eoPop < Indi > pop; +00100 pop.append (POP_SIZE, random); +00101 +00102 // Algorithm +00103 eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace ); +00104 +00105 //Parallel algorithm +00106 peoWrapper parallelEA( eaAlg, pop); +00107 eval.setOwner(parallelEA); +00108 +00109 peo :: run(); +00110 peo :: finalize(); +00111 if (getNodeRank()==1) +00112 { +00113 pop.sort(); +00114 std::cout << "Final population :\n" << pop << std::endl; +00115 } +00116 } +
1.4.7
+
+
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2mainPSO_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2mainPSO_8cpp-source.html
new file mode 100644
index 000000000..717359779
--- /dev/null
+++ b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2mainPSO_8cpp-source.html
@@ -0,0 +1,152 @@
+
+
+00001 /* +00002 * <mainPSO.cpp> +00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 +00004 * (C) OPAC Team, INRIA, 2008 +00005 * +00006 * Clive Canape +00007 * +00008 * This software is governed by the CeCILL license under French law and +00009 * abiding by the rules of distribution of free software. You can use, +00010 * modify and/ or redistribute the software under the terms of the CeCILL +00011 * license as circulated by CEA, CNRS and INRIA at the following URL +00012 * "http://www.cecill.info". +00013 * +00014 * As a counterpart to the access to the source code and rights to copy, +00015 * modify and redistribute granted by the license, users are provided only +00016 * with a limited warranty and the software's author, the holder of the +00017 * economic rights, and the successive licensors have only limited liability. +00018 * +00019 * In this respect, the user's attention is drawn to the risks associated +00020 * with loading, using, modifying and/or developing or reproducing the +00021 * software by the user in light of its specific status of free software, +00022 * that may mean that it is complicated to manipulate, and that also +00023 * therefore means that it is reserved for developers and experienced +00024 * professionals having in-depth computer knowledge. Users are therefore +00025 * encouraged to load and test the software's suitability as regards their +00026 * requirements in conditions enabling the security of their systems and/or +00027 * data to be ensured and, more generally, to use and operate it in the +00028 * same conditions as regards security. +00029 * The fact that you are presently reading this means that you have had +00030 * knowledge of the CeCILL license and that you accept its terms. +00031 * +00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr +00033 * Contact: paradiseo-help@lists.gforge.inria.fr +00034 * +00035 */ +00036 +00037 #include <peo> +00038 +00039 typedef eoRealParticle < double >Indi; +00040 +00041 //Evaluation function +00042 double f (const Indi & _indi) +00043 { +00044 // Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2 +00045 // => optimal : f* = 0 , with x* =(1,1) +00046 +00047 double sum; +00048 sum=_indi[1]-pow(_indi[0],2); +00049 sum=100*pow(sum,2); +00050 sum+=pow((1-_indi[0]),2); +00051 return (-sum); +00052 } +00053 +00054 int main (int __argc, char *__argv[]) +00055 { +00056 +00057 // Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself +00058 peo :: init( __argc, __argv ); +00059 +00060 //Parameters +00061 eoParser parser(__argc, __argv); +00062 unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value(); +00063 unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value(); +00064 unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); +00065 double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); +00066 double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); +00067 double INIT_VELOCITY_MIN = parser.createParam(-1.0, "vMin", "Init velocity min",'n',"Param").value(); +00068 double INIT_VELOCITY_MAX = parser.createParam(1.0, "vMax", "Init velocity max",'x',"Param").value(); +00069 double weight = parser.createParam(1.0, "weight", "Weight",'w',"Param").value(); +00070 double C1 = parser.createParam(0.5, "c1", "C1",'1',"Param").value(); +00071 double C2 = parser.createParam(2.0, "c2t", "C2",'2',"Param").value(); +00072 unsigned int NEIGHBORHOOD_SIZE = parser.createParam((unsigned int)(6), "neighSize", "Neighborhood size",'H',"Param").value(); +00073 rng.reseed (time(0)); +00074 +00075 // Stopping +00076 eoGenContinue < Indi > genContPara (MAX_GEN); +00077 eoCombinedContinue <Indi> continuatorPara (genContPara); +00078 eoCheckPoint<Indi> checkpoint(continuatorPara); +00079 +00080 // For a parallel evaluation +00081 peoEvalFunc<Indi, double, const Indi& > plainEval(f); +00082 peoPopEval< Indi > eval(plainEval); +00083 +00084 // Initialization +00085 eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX); +00086 eoInitFixedLength < Indi > random (VEC_SIZE, uGen); +00087 +00088 // Velocity +00089 eoUniformGenerator < double >sGen (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX); +00090 eoVelocityInitFixedLength < Indi > veloRandom (VEC_SIZE, sGen); +00091 +00092 // Initializing the best +00093 eoFirstIsBestInit < Indi > localInit; +00094 +00095 // Flight +00096 eoRealVectorBounds bndsFlight(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX); +00097 eoStandardFlight < Indi > flight(bndsFlight); +00098 +00099 // Creation of the population +00100 eoPop < Indi > pop; +00101 pop.append (POP_SIZE, random); +00102 +00103 // Topology +00104 eoLinearTopology<Indi> topology(NEIGHBORHOOD_SIZE); +00105 eoRealVectorBounds bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX); +00106 eoStandardVelocity < Indi > velocity (topology,weight,C1,C2,bnds); +00107 +00108 // Initialization +00109 eoInitializer <Indi> init(eval,veloRandom,localInit,topology,pop); +00110 +00111 //Parallel algorithm +00112 eoSyncEasyPSO <Indi> psa(init,checkpoint,eval, velocity, flight); +00113 peoWrapper parallelPSO( psa, pop); +00114 eval.setOwner(parallelPSO); +00115 +00116 peo :: run(); +00117 peo :: finalize(); +00118 if (getNodeRank()==1) +00119 { +00120 pop.sort(); +00121 std::cout << "Final population :\n" << pop << std::endl; +00122 } +00123 } +
1.4.7
+
+
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2main_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2main_8cpp-source.html
deleted file mode 100644
index 9342a2ab5..000000000
--- a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson1_2main_8cpp-source.html
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-00001 /* -00002 * <main.cpp> -00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -00004 * (C) OPAC Team, LIFL, 2002-2007 -00005 * -00006 * Sebastien Cahon, Alexandru-Adrian Tantar -00007 * -00008 * This software is governed by the CeCILL license under French law and -00009 * abiding by the rules of distribution of free software. You can use, -00010 * modify and/ or redistribute the software under the terms of the CeCILL -00011 * license as circulated by CEA, CNRS and INRIA at the following URL -00012 * "http://www.cecill.info". -00013 * -00014 * As a counterpart to the access to the source code and rights to copy, -00015 * modify and redistribute granted by the license, users are provided only -00016 * with a limited warranty and the software's author, the holder of the -00017 * economic rights, and the successive licensors have only limited liability. -00018 * -00019 * In this respect, the user's attention is drawn to the risks associated -00020 * with loading, using, modifying and/or developing or reproducing the -00021 * software by the user in light of its specific status of free software, -00022 * that may mean that it is complicated to manipulate, and that also -00023 * therefore means that it is reserved for developers and experienced -00024 * professionals having in-depth computer knowledge. Users are therefore -00025 * encouraged to load and test the software's suitability as regards their -00026 * requirements in conditions enabling the security of their systems and/or -00027 * data to be ensured and, more generally, to use and operate it in the -00028 * same conditions as regards security. -00029 * The fact that you are presently reading this means that you have had -00030 * knowledge of the CeCILL license and that you accept its terms. -00031 * -00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr -00033 * Contact: paradiseo-help@lists.gforge.inria.fr -00034 * -00035 */ -00036 -00037 #include "route.h" -00038 #include "route_init.h" -00039 #include "route_eval.h" -00040 -00041 #include "order_xover.h" -00042 #include "city_swap.h" -00043 -00044 #include "param.h" -00045 -00046 #include <peo> -00047 -00048 -00049 #define POP_SIZE 10 -00050 #define NUM_GEN 100 -00051 #define CROSS_RATE 1.0 -00052 #define MUT_RATE 0.01 -00053 -00054 -00055 int main( int __argc, char** __argv ) { -00056 -00057 // initializing the ParadisEO-PEO environment -00058 peo :: init( __argc, __argv ); -00059 -00060 -00061 // processing the command line specified parameters -00062 loadParameters( __argc, __argv ); -00063 -00064 -00065 // init, eval operators, EA operators ------------------------------------------------------------------------------------------------------------- -00066 -00067 RouteInit route_init; // random init object - creates random Route objects -00068 RouteEval full_eval; // evaluator object - offers a fitness value for a specified Route object -00069 -00070 OrderXover crossover; // crossover operator - creates two offsprings out of two specified parents -00071 CitySwap mutation; // mutation operator - randomly mutates one gene for a specified individual -00072 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00073 -00074 -00075 // evolutionary algorithm components -------------------------------------------------------------------------------------------------------------- -00076 -00077 eoPop< Route > population( POP_SIZE, route_init ); // initial population for the algorithm having POP_SIZE individuals -00078 peoSeqPopEval< Route > eaPopEval( full_eval ); // evaluator object - to be applied at each iteration on the entire population -00079 -00080 eoGenContinue< Route > eaCont( NUM_GEN ); // continuation criterion - the algorithm will iterate for NUM_GEN generations -00081 eoCheckPoint< Route > eaCheckpointContinue( eaCont ); // checkpoint object - verify at each iteration if the continuation criterion is met -00082 -00083 eoRankingSelect< Route > selectionStrategy; // selection strategy - applied at each iteration for selecting parent individuals -00084 eoSelectNumber< Route > eaSelect( selectionStrategy, POP_SIZE ); // selection object - POP_SIZE individuals are selected at each iteration -00085 -00086 // transform operator - includes the crossover and the mutation operators with a specified associated rate -00087 eoSGATransform< Route > transform( crossover, CROSS_RATE, mutation, MUT_RATE ); -00088 peoSeqTransform< Route > eaTransform( transform ); // ParadisEO transform operator (please remark the peo prefix) - wraps an e EO transform object -00089 -00090 eoPlusReplacement< Route > eaReplace; // replacement strategy - for replacing the initial population with offspring individuals -00091 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00092 -00093 -00094 // ParadisEO-PEO evolutionary algorithm ----------------------------------------------------------------------------------------------------------- -00095 -00096 peoEA< Route > eaAlg( eaCheckpointContinue, eaPopEval, eaSelect, eaTransform, eaReplace ); -00097 -00098 eaAlg( population ); // specifying the initial population for the algorithm, to be iteratively evolved -00099 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00100 -00101 -00102 peo :: run( ); -00103 peo :: finalize( ); -00104 // shutting down the ParadisEO-PEO environment -00105 -00106 return 0; -00107 } -
1.4.7
-
-
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson2_2mainEA_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson2_2mainEA_8cpp-source.html
new file mode 100644
index 000000000..da1ad36ac
--- /dev/null
+++ b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson2_2mainEA_8cpp-source.html
@@ -0,0 +1,126 @@
+
+
+00001 /* +00002 * <mainEA.cpp> +00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 +00004 * (C) OPAC Team, INRIA, 2008 +00005 * +00006 * Clive Canape +00007 * +00008 * This software is governed by the CeCILL license under French law and +00009 * abiding by the rules of distribution of free software. You can use, +00010 * modify and/ or redistribute the software under the terms of the CeCILL +00011 * license as circulated by CEA, CNRS and INRIA at the following URL +00012 * "http://www.cecill.info". +00013 * +00014 * As a counterpart to the access to the source code and rights to copy, +00015 * modify and redistribute granted by the license, users are provided only +00016 * with a limited warranty and the software's author, the holder of the +00017 * economic rights, and the successive licensors have only limited liability. +00018 * +00019 * In this respect, the user's attention is drawn to the risks associated +00020 * with loading, using, modifying and/or developing or reproducing the +00021 * software by the user in light of its specific status of free software, +00022 * that may mean that it is complicated to manipulate, and that also +00023 * therefore means that it is reserved for developers and experienced +00024 * professionals having in-depth computer knowledge. Users are therefore +00025 * encouraged to load and test the software's suitability as regards their +00026 * requirements in conditions enabling the security of their systems and/or +00027 * data to be ensured and, more generally, to use and operate it in the +00028 * same conditions as regards security. +00029 * The fact that you are presently reading this means that you have had +00030 * knowledge of the CeCILL license and that you accept its terms. +00031 * +00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr +00033 * Contact: paradiseo-help@lists.gforge.inria.fr +00034 * +00035 */ +00036 +00037 #include <peo> +00038 #include <es.h> +00039 +00040 typedef eoReal<double> Indi; +00041 +00042 double f (const Indi & _indi) +00043 { +00044 double sum; +00045 sum=_indi[1]-pow(_indi[0],2); +00046 sum=100*pow(sum,2); +00047 sum+=pow((1-_indi[0]),2); +00048 return (-sum); +00049 } +00050 +00051 int main (int __argc, char *__argv[]) +00052 { +00053 +00054 peo :: init( __argc, __argv ); +00055 eoParser parser(__argc, __argv); +00056 unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value(); +00057 unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value(); +00058 double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value(); +00059 double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value(); +00060 double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value(); +00061 unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); +00062 double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); +00063 double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); +00064 rng.reseed (time(0)); +00065 eoGenContinue < Indi > genContPara (MAX_GEN); +00066 eoCombinedContinue <Indi> continuatorPara (genContPara); +00067 eoCheckPoint<Indi> checkpoint(continuatorPara); +00068 peoEvalFunc<Indi> plainEval(f); +00069 peoPopEval <Indi> eval(plainEval); +00070 eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX); +00071 eoInitFixedLength < Indi > random (VEC_SIZE, uGen); +00072 eoRankingSelect<Indi> selectionStrategy; +00073 eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE); +00074 eoSegmentCrossover<Indi> crossover; +00075 eoUniformMutation<Indi> mutation(EPSILON); +00076 +00077 // Parallel transformation +00078 peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE); +00079 +00080 eoPlusReplacement<Indi> replace; +00081 eoPop < Indi > pop; +00082 pop.append (POP_SIZE, random); +00083 eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace ); +00084 peoWrapper parallelEA( eaAlg, pop); +00085 eval.setOwner(parallelEA); +00086 +00087 // setOwner +00088 transform.setOwner (parallelEA); +00089 +00090 peo :: run(); +00091 peo :: finalize(); +00092 if (getNodeRank()==1) +00093 { +00094 pop.sort(); +00095 std::cout << "Final population :\n" << pop << std::endl; +00096 } +00097 } +
1.4.7
+
+
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson2_2main_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson2_2main_8cpp-source.html
deleted file mode 100644
index 1c9f16bfe..000000000
--- a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson2_2main_8cpp-source.html
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-00001 /* -00002 * <main.cpp> -00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -00004 * (C) OPAC Team, LIFL, 2002-2007 -00005 * -00006 * Sebastien Cahon, Alexandru-Adrian Tantar -00007 * -00008 * This software is governed by the CeCILL license under French law and -00009 * abiding by the rules of distribution of free software. You can use, -00010 * modify and/ or redistribute the software under the terms of the CeCILL -00011 * license as circulated by CEA, CNRS and INRIA at the following URL -00012 * "http://www.cecill.info". -00013 * -00014 * As a counterpart to the access to the source code and rights to copy, -00015 * modify and redistribute granted by the license, users are provided only -00016 * with a limited warranty and the software's author, the holder of the -00017 * economic rights, and the successive licensors have only limited liability. -00018 * -00019 * In this respect, the user's attention is drawn to the risks associated -00020 * with loading, using, modifying and/or developing or reproducing the -00021 * software by the user in light of its specific status of free software, -00022 * that may mean that it is complicated to manipulate, and that also -00023 * therefore means that it is reserved for developers and experienced -00024 * professionals having in-depth computer knowledge. Users are therefore -00025 * encouraged to load and test the software's suitability as regards their -00026 * requirements in conditions enabling the security of their systems and/or -00027 * data to be ensured and, more generally, to use and operate it in the -00028 * same conditions as regards security. -00029 * The fact that you are presently reading this means that you have had -00030 * knowledge of the CeCILL license and that you accept its terms. -00031 * -00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr -00033 * Contact: paradiseo-help@lists.gforge.inria.fr -00034 * -00035 */ -00036 -00037 #include "route.h" -00038 #include "route_init.h" -00039 #include "route_eval.h" -00040 -00041 #include "order_xover.h" -00042 #include "city_swap.h" -00043 -00044 #include "param.h" -00045 -00046 #include "merge_route_eval.h" -00047 #include "part_route_eval.h" -00048 -00049 -00050 #include <peo> -00051 -00052 -00053 #define POP_SIZE 10 -00054 #define NUM_GEN 100 -00055 #define CROSS_RATE 1.0 -00056 #define MUT_RATE 0.01 -00057 -00058 #define NUM_PART_EVALS 2 -00059 -00060 -00061 // by default, parallel evaluation of the population is performed; -00062 // for parallel fitness evaluation, uncomment the following line -00063 -00064 // #define PARALLEL_FIT_EVALUATION -00065 -00066 -00067 int main( int __argc, char** __argv ) { -00068 -00069 // initializing the ParadisEO-PEO environment -00070 peo :: init( __argc, __argv ); -00071 -00072 -00073 // processing the command line specified parameters -00074 loadParameters( __argc, __argv ); -00075 -00076 -00077 // init, eval operators, EA operators ------------------------------------------------------------------------------------------------------------- -00078 -00079 RouteInit route_init; // random init object - creates random Route objects -00080 RouteEval full_eval; // evaluator object - offers a fitness value for a specified Route object -00081 -00082 OrderXover crossover; // crossover operator - creates two offsprings out of two specified parents -00083 CitySwap mutation; // mutation operator - randomly mutates one gene for a specified individual -00084 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00085 -00086 -00087 // evolutionary algorithm components -------------------------------------------------------------------------------------------------------------- -00088 -00089 eoPop< Route > population( POP_SIZE, route_init ); // initial population for the algorithm having POP_SIZE individuals -00090 -00091 -00092 #ifdef PARALLEL_FIT_EVALUATION -00093 -00094 MergeRouteEval merge_eval; -00095 -00096 std :: vector< eoEvalFunc< Route >* > part_eval; -00097 for ( unsigned index = 1; index <= NUM_PART_EVALS; index++ ) -00098 part_eval.push_back( new PartRouteEval( ( float )( index - 1 ) / NUM_PART_EVALS, ( float )index / NUM_PART_EVALS ) ); -00099 -00100 peoParaPopEval< Route > ox_pop_eval( part_eval, merge_eval ); -00101 -00102 #else -00103 -00104 peoParaPopEval< Route > ox_pop_eval( full_eval ); -00105 -00106 #endif -00107 -00108 -00109 -00110 peoParaPopEval< Route > eaPopEval( full_eval ); // evaluator object - to be applied at each iteration on the entire population -00111 -00112 eoGenContinue< Route > eaCont( NUM_GEN ); // continuation criterion - the algorithm will iterate for NUM_GEN generations -00113 eoCheckPoint< Route > eaCheckpointContinue( eaCont ); // checkpoint object - verify at each iteration if the continuation criterion is met -00114 -00115 eoRankingSelect< Route > selectionStrategy; // selection strategy - applied at each iteration for selecting parent individuals -00116 eoSelectNumber< Route > eaSelect( selectionStrategy, POP_SIZE ); // selection object - POP_SIZE individuals are selected at each iteration -00117 -00118 // transform operator - includes the crossover and the mutation operators with a specified associated rate -00119 eoSGATransform< Route > transform( crossover, CROSS_RATE, mutation, MUT_RATE ); -00120 peoSeqTransform< Route > eaTransform( transform ); // ParadisEO transform operator (please remark the peo prefix) - wraps an e EO transform object -00121 -00122 eoPlusReplacement< Route > eaReplace; // replacement strategy - for replacing the initial population with offspring individuals -00123 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00124 -00125 -00126 // ParadisEO-PEO evolutionary algorithm ----------------------------------------------------------------------------------------------------------- -00127 -00128 peoEA< Route > eaAlg( eaCheckpointContinue, eaPopEval, eaSelect, eaTransform, eaReplace ); -00129 -00130 eaAlg( population ); // specifying the initial population for the algorithm, to be iteratively evolved -00131 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00132 -00133 -00134 peo :: run( ); -00135 peo :: finalize( ); -00136 // shutting down the ParadisEO-PEO environment -00137 -00138 return 0; -00139 } -
1.4.7
-
-
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2mainEA_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2mainEA_8cpp-source.html
new file mode 100644
index 000000000..b7a85c4ab
--- /dev/null
+++ b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2mainEA_8cpp-source.html
@@ -0,0 +1,179 @@
+
+
+00001 /* +00002 * <mainEA.cpp> +00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 +00004 * (C) OPAC Team, INRIA, 2008 +00005 * +00006 * Clive Canape +00007 * +00008 * This software is governed by the CeCILL license under French law and +00009 * abiding by the rules of distribution of free software. You can use, +00010 * modify and/ or redistribute the software under the terms of the CeCILL +00011 * license as circulated by CEA, CNRS and INRIA at the following URL +00012 * "http://www.cecill.info". +00013 * +00014 * As a counterpart to the access to the source code and rights to copy, +00015 * modify and redistribute granted by the license, users are provided only +00016 * with a limited warranty and the software's author, the holder of the +00017 * economic rights, and the successive licensors have only limited liability. +00018 * +00019 * In this respect, the user's attention is drawn to the risks associated +00020 * with loading, using, modifying and/syncor developing or reproducing the +00021 * software by the user in light of its specific status of free software, +00022 * that may mean that it is complicated to manipulate, and that also +00023 * therefore means that it is reserved for developers and experienced +00024 * professionals having in-depth computer knowledge. Users are therefore +00025 * encouraged to load and test the software's suitability as regards their +00026 * requirements in conditions enabling the security of their systems and/or +00027 * data to be ensured and, more generally, to use and operate it in the +00028 * same conditions as regards security. +00029 * The fact that you are presently reading this means that you have had +00030 * knowledge of the CeCILL license and that you accept its terms. +00031 * +00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr +00033 * Contact: paradiseo-help@lists.gforge.inria.fr +00034 * +00035 */ +00036 +00037 #include <peo> +00038 #include <es.h> +00039 +00040 typedef eoReal<double> Indi; +00041 +00042 double f (const Indi & _indi) +00043 { +00044 double sum; +00045 sum=_indi[1]-pow(_indi[0],2); +00046 sum=100*pow(sum,2); +00047 sum+=pow((1-_indi[0]),2); +00048 return (-sum); +00049 } +00050 +00051 int main (int __argc, char *__argv[]) +00052 { +00053 +00054 peo :: init( __argc, __argv ); +00055 eoParser parser(__argc, __argv); +00056 unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value(); +00057 unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value(); +00058 double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value(); +00059 double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value(); +00060 double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value(); +00061 unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); +00062 double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); +00063 double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); +00064 unsigned int MIG_FREQ = parser.createParam((unsigned int)(10), "migFreq", "Migration frequency",'F',"Param").value(); +00065 unsigned int MIG_SIZE = parser.createParam((unsigned int)(5), "migSize", "Migration size",'S',"Param").value(); +00066 rng.reseed (time(0)); +00067 +00068 // Define the topology of your island model +00069 RingTopology topology; +00070 +00071 // First algorithm +00072 /*****************************************************************************************/ +00073 +00074 eoGenContinue < Indi > genContPara (MAX_GEN); +00075 eoCombinedContinue <Indi> continuatorPara (genContPara); +00076 eoCheckPoint<Indi> checkpoint(continuatorPara); +00077 peoEvalFunc<Indi> mainEval( f ); +00078 peoPopEval <Indi> eval(mainEval); +00079 eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX); +00080 eoInitFixedLength < Indi > random (VEC_SIZE, uGen); +00081 eoRankingSelect<Indi> selectionStrategy; +00082 eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE); +00083 eoSegmentCrossover<Indi> crossover; +00084 eoUniformMutation<Indi> mutation(EPSILON); +00085 peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE); +00086 eoPop < Indi > pop; +00087 pop.append (POP_SIZE, random); +00088 +00089 // Define a synchronous island +00090 +00091 // Seclection +00092 eoRandomSelect<Indi> mig_select_one; +00093 eoSelector <Indi, eoPop<Indi> > mig_select (mig_select_one,MIG_SIZE,pop); +00094 // Replacement +00095 eoPlusReplacement<Indi> replace; +00096 eoReplace <Indi, eoPop<Indi> > mig_replace (replace,pop); +00097 // Island +00098 peoSyncIslandMig<eoPop<Indi>, eoPop<Indi> > mig(MIG_FREQ,mig_select,mig_replace,topology); +00099 checkpoint.add(mig); +00100 +00101 eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace ); +00102 peoWrapper parallelEA( eaAlg, pop); +00103 eval.setOwner(parallelEA); +00104 transform.setOwner(parallelEA); +00105 // setOwner +00106 mig.setOwner(parallelEA); +00107 +00108 /*****************************************************************************************/ +00109 +00110 // Second algorithm (on the same model but with others names) +00111 /*****************************************************************************************/ +00112 +00113 eoGenContinue < Indi > genContPara2 (MAX_GEN); +00114 eoCombinedContinue <Indi> continuatorPara2 (genContPara2); +00115 eoCheckPoint<Indi> checkpoint2(continuatorPara2); +00116 peoEvalFunc<Indi> mainEval2( f ); +00117 peoPopEval <Indi> eval2(mainEval2); +00118 eoUniformGenerator < double >uGen2 (INIT_POSITION_MIN, INIT_POSITION_MAX); +00119 eoInitFixedLength < Indi > random2 (VEC_SIZE, uGen2); +00120 eoRankingSelect<Indi> selectionStrategy2; +00121 eoSelectNumber<Indi> select2(selectionStrategy2,POP_SIZE); +00122 eoSegmentCrossover<Indi> crossover2; +00123 eoUniformMutation<Indi> mutation2(EPSILON); +00124 peoTransform<Indi> transform2(crossover2,CROSS_RATE,mutation2,MUT_RATE); +00125 eoPop < Indi > pop2; +00126 pop2.append (POP_SIZE, random2); +00127 eoPlusReplacement<Indi> replace2; +00128 eoRandomSelect<Indi> mig_select_one2; +00129 eoSelector <Indi, eoPop<Indi> > mig_select2 (mig_select_one2,MIG_SIZE,pop2); +00130 eoReplace <Indi, eoPop<Indi> > mig_replace2 (replace2,pop2); +00131 peoSyncIslandMig<eoPop<Indi>, eoPop<Indi> > mig2(MIG_FREQ,mig_select2,mig_replace2,topology); +00132 checkpoint2.add(mig2); +00133 eoEasyEA< Indi > eaAlg2( checkpoint2, eval2, select2, transform2, replace2 ); +00134 peoWrapper parallelEA2( eaAlg2, pop2); +00135 eval2.setOwner(parallelEA2); +00136 transform2.setOwner(parallelEA2); +00137 mig2.setOwner(parallelEA2); +00138 +00139 /*****************************************************************************************/ +00140 +00141 peo :: run(); +00142 peo :: finalize(); +00143 if (getNodeRank()==1) +00144 { +00145 pop.sort(); +00146 pop2.sort(); +00147 std::cout << "Final population 1 :\n" << pop << std::endl; +00148 std::cout << "Final population 2 :\n" << pop2 << std::endl; +00149 } +00150 } +
1.4.7
+
+
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2mainPSO_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2mainPSO_8cpp-source.html
new file mode 100644
index 000000000..66c1e860c
--- /dev/null
+++ b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2mainPSO_8cpp-source.html
@@ -0,0 +1,195 @@
+
+
+00001 /* +00002 * <mainPSO.cpp> +00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 +00004 * (C) OPAC Team, INRIA, 2008 +00005 * +00006 * Clive Canape +00007 * +00008 * This software is governed by the CeCILL license under French law and +00009 * abiding by the rules of distribution of free software. You can use, +00010 * modify and/ or redistribute the software under the terms of the CeCILL +00011 * license as circulated by CEA, CNRS and INRIA at the following URL +00012 * "http://www.cecill.info". +00013 * +00014 * As a counterpart to the access to the source code and rights to copy, +00015 * modify and redistribute granted by the license, users are provided only +00016 * with a limited warranty and the software's author, the holder of the +00017 * economic rights, and the successive licensors have only limited liability. +00018 * +00019 * In this respect, the user's attention is drawn to the risks associated +00020 * with loading, using, modifying and/or developing or reproducing the +00021 * software by the user in light of its specific status of free software, +00022 * that may mean that it is complicated to manipulate, and that also +00023 * therefore means that it is reserved for developers and experienced +00024 * professionals having in-depth computer knowledge. Users are therefore +00025 * encouraged to load and test the software's suitability as regards their +00026 * requirements in conditions enabling the security of their systems and/or +00027 * data to be ensured and, more generally, to use and operate it in the +00028 * same conditions as regards security. +00029 * The fact that you are presently reading this means that you have had +00030 * knowledge of the CeCILL license and that you accept its terms. +00031 * +00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr +00033 * Contact: paradiseo-help@lists.gforge.inria.fr +00034 * +00035 */ +00036 +00037 #include <peo> +00038 +00039 typedef eoRealParticle < double >Indi; +00040 +00041 double f (const Indi & _indi) +00042 { +00043 double sum; +00044 sum=_indi[1]-pow(_indi[0],2); +00045 sum=100*pow(sum,2); +00046 sum+=pow((1-_indi[0]),2); +00047 return (-sum); +00048 } +00049 +00050 int main (int __argc, char *__argv[]) +00051 { +00052 peo :: init( __argc, __argv ); +00053 eoParser parser(__argc, __argv); +00054 unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value(); +00055 unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value(); +00056 unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); +00057 double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); +00058 double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); +00059 double INIT_VELOCITY_MIN = parser.createParam(-1.0, "vMin", "Init velocity min",'n',"Param").value(); +00060 double INIT_VELOCITY_MAX = parser.createParam(1.0, "vMax", "Init velocity max",'x',"Param").value(); +00061 double omega = parser.createParam(1.0, "weight", "Weight",'w',"Param").value(); +00062 double C1 = parser.createParam(0.5, "c1", "C1",'1',"Param").value(); +00063 double C2 = parser.createParam(2.0, "c2t", "C2",'2',"Param").value(); +00064 unsigned int NEIGHBORHOOD_SIZE = parser.createParam((unsigned int)(6), "neighSize", "Neighborhood size",'H',"Param").value(); +00065 unsigned int MIG_FREQ = parser.createParam((unsigned int)(10), "migFreq", "Migration frequency",'F',"Param").value(); +00066 rng.reseed (time(0)); +00067 +00068 // Island model +00069 +00070 RingTopology topologyMig; +00071 +00072 // First +00073 eoGenContinue < Indi > genContPara (MAX_GEN); +00074 eoCombinedContinue <Indi> continuatorPara (genContPara); +00075 eoCheckPoint<Indi> checkpoint(continuatorPara); +00076 peoEvalFunc<Indi, double, const Indi& > plainEval(f); +00077 peoPopEval< Indi > eval(plainEval); +00078 eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX); +00079 eoInitFixedLength < Indi > random (VEC_SIZE, uGen); +00080 eoUniformGenerator < double >sGen (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX); +00081 eoVelocityInitFixedLength < Indi > veloRandom (VEC_SIZE, sGen); +00082 eoFirstIsBestInit < Indi > localInit; +00083 eoRealVectorBounds bndsFlight(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX); +00084 eoStandardFlight < Indi > flight(bndsFlight); +00085 eoPop < Indi > pop; +00086 pop.append (POP_SIZE, random); +00087 eoLinearTopology<Indi> topology(NEIGHBORHOOD_SIZE); +00088 eoRealVectorBounds bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX); +00089 eoStandardVelocity < Indi > velocity (topology,omega,C1,C2,bnds); +00090 eoInitializer <Indi> init(eval,veloRandom,localInit,topology,pop); +00091 +00092 // Island model +00093 +00094 eoPeriodicContinue< Indi > mig_cont( MIG_FREQ ); +00095 peoPSOSelect<Indi> mig_selec(topology); +00096 peoWorstPositionReplacement<Indi> mig_replac; +00097 +00098 // Specific implementation (peoData.h) +00099 +00100 eoContinuator<Indi> cont(mig_cont, pop); +00101 eoSelector <Indi, eoPop<Indi> > mig_select (mig_selec,1,pop); +00102 eoReplace <Indi, eoPop<Indi> > mig_replace (mig_replac,pop); +00103 +00104 +00105 // Second +00106 +00107 eoGenContinue < Indi > genContPara2 (MAX_GEN); +00108 eoCombinedContinue <Indi> continuatorPara2 (genContPara2); +00109 eoCheckPoint<Indi> checkpoint2(continuatorPara2); +00110 peoEvalFunc<Indi, double, const Indi& > plainEval2(f); +00111 peoPopEval< Indi > eval2(plainEval2); +00112 eoUniformGenerator < double >uGen2 (INIT_POSITION_MIN, INIT_POSITION_MAX); +00113 eoInitFixedLength < Indi > random2 (VEC_SIZE, uGen2); +00114 eoUniformGenerator < double >sGen2 (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX); +00115 eoVelocityInitFixedLength < Indi > veloRandom2 (VEC_SIZE, sGen2); +00116 eoFirstIsBestInit < Indi > localInit2; +00117 eoRealVectorBounds bndsFlight2(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX); +00118 eoStandardFlight < Indi > flight2(bndsFlight2); +00119 eoPop < Indi > pop2; +00120 pop2.append (POP_SIZE, random2); +00121 eoLinearTopology<Indi> topology2(NEIGHBORHOOD_SIZE); +00122 eoRealVectorBounds bnds2(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX); +00123 eoStandardVelocity < Indi > velocity2 (topology2,omega,C1,C2,bnds2); +00124 eoInitializer <Indi> init2(eval2,veloRandom2,localInit2,topology2,pop2); +00125 +00126 // Island model +00127 +00128 eoPeriodicContinue< Indi > mig_cont2( MIG_FREQ ); +00129 peoPSOSelect<Indi> mig_selec2(topology2); +00130 peoWorstPositionReplacement<Indi> mig_replac2; +00131 +00132 // Specific implementation (peoData.h) +00133 +00134 eoContinuator<Indi> cont2(mig_cont2,pop2); +00135 eoSelector <Indi, eoPop<Indi> > mig_select2 (mig_selec2,1,pop2); +00136 eoReplace <Indi, eoPop<Indi> > mig_replace2 (mig_replac2,pop2); +00137 +00138 +00139 // Asynchronous island +00140 +00141 peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > mig(cont,mig_select, mig_replace, topologyMig); +00142 checkpoint.add( mig ); +00143 peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > mig2(cont2,mig_select2, mig_replace2, topologyMig); +00144 checkpoint2.add( mig2 ); +00145 +00146 +00147 // Parallel algorithm +00148 +00149 eoSyncEasyPSO <Indi> psa(init,checkpoint,eval, velocity, flight); +00150 peoWrapper parallelPSO( psa, pop); +00151 eval.setOwner(parallelPSO); +00152 mig.setOwner(parallelPSO); +00153 eoSyncEasyPSO <Indi> psa2(init2,checkpoint2,eval2, velocity2, flight2); +00154 peoWrapper parallelPSO2( psa2, pop2); +00155 eval2.setOwner(parallelPSO2); +00156 mig2.setOwner(parallelPSO2); +00157 peo :: run(); +00158 peo :: finalize(); +00159 if (getNodeRank()==1) +00160 { +00161 pop.sort(); +00162 pop2.sort(); +00163 std::cout << "Final population :\n" << pop << std::endl; +00164 std::cout << "Final population :\n" << pop2 << std::endl; +00165 } +00166 } +
1.4.7
+
+
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2main_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2main_8cpp-source.html
deleted file mode 100644
index 95fcf0fac..000000000
--- a/tags/paradiseo-1.1/paradiseo-peo/doc/html/Lesson3_2main_8cpp-source.html
+++ /dev/null
@@ -1,217 +0,0 @@
-
-
-00001 /* -00002 * <main.cpp> -00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -00004 * (C) OPAC Team, LIFL, 2002-2007 -00005 * -00006 * Sebastien Cahon, Alexandru-Adrian Tantar -00007 * -00008 * This software is governed by the CeCILL license under French law and -00009 * abiding by the rules of distribution of free software. You can use, -00010 * modify and/ or redistribute the software under the terms of the CeCILL -00011 * license as circulated by CEA, CNRS and INRIA at the following URL -00012 * "http://www.cecill.info". -00013 * -00014 * As a counterpart to the access to the source code and rights to copy, -00015 * modify and redistribute granted by the license, users are provided only -00016 * with a limited warranty and the software's author, the holder of the -00017 * economic rights, and the successive licensors have only limited liability. -00018 * -00019 * In this respect, the user's attention is drawn to the risks associated -00020 * with loading, using, modifying and/or developing or reproducing the -00021 * software by the user in light of its specific status of free software, -00022 * that may mean that it is complicated to manipulate, and that also -00023 * therefore means that it is reserved for developers and experienced -00024 * professionals having in-depth computer knowledge. Users are therefore -00025 * encouraged to load and test the software's suitability as regards their -00026 * requirements in conditions enabling the security of their systems and/or -00027 * data to be ensured and, more generally, to use and operate it in the -00028 * same conditions as regards security. -00029 * The fact that you are presently reading this means that you have had -00030 * knowledge of the CeCILL license and that you accept its terms. -00031 * -00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr -00033 * Contact: paradiseo-help@lists.gforge.inria.fr -00034 * -00035 */ -00036 -00037 #include "route.h" -00038 #include "route_init.h" -00039 #include "route_eval.h" -00040 -00041 #include "order_xover.h" -00042 #include "city_swap.h" -00043 -00044 #include "param.h" -00045 -00046 -00047 #include <peo> -00048 -00049 -00050 #define POP_SIZE 10 -00051 #define NUM_GEN 100 -00052 #define CROSS_RATE 1.0 -00053 #define MUT_RATE 0.01 -00054 -00055 #define MIG_FREQ 10 -00056 #define MIG_SIZE 5 -00057 -00058 -00059 int main( int __argc, char** __argv ) { -00060 -00061 // initializing the ParadisEO-PEO environment -00062 peo :: init( __argc, __argv ); -00063 -00064 -00065 // processing the command line specified parameters -00066 loadParameters( __argc, __argv ); -00067 -00068 -00069 // init, eval operators, EA operators ------------------------------------------------------------------------------------------------------------- -00070 -00071 RouteInit route_init; // random init object - creates random Route objects -00072 RouteEval full_eval; // evaluator object - offers a fitness value for a specified Route object -00073 -00074 OrderXover crossover; // crossover operator - creates two offsprings out of two specified parents -00075 CitySwap mutation; // mutation operator - randomly mutates one gene for a specified individual -00076 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00077 -00078 -00079 // evolutionary algorithm components -------------------------------------------------------------------------------------------------------------- -00080 -00081 eoPop< Route > population( POP_SIZE, route_init ); // initial population for the algorithm having POP_SIZE individuals -00082 peoParaPopEval< Route > eaPopEval( full_eval ); // evaluator object - to be applied at each iteration on the entire population -00083 -00084 eoGenContinue< Route > eaCont( NUM_GEN ); // continuation criterion - the algorithm will iterate for NUM_GEN generations -00085 eoCheckPoint< Route > eaCheckpointContinue( eaCont ); // checkpoint object - verify at each iteration if the continuation criterion is met -00086 -00087 eoRankingSelect< Route > selectionStrategy; // selection strategy - applied at each iteration for selecting parent individuals -00088 eoSelectNumber< Route > eaSelect( selectionStrategy, POP_SIZE ); // selection object - POP_SIZE individuals are selected at each iteration -00089 -00090 // transform operator - includes the crossover and the mutation operators with a specified associated rate -00091 eoSGATransform< Route > transform( crossover, CROSS_RATE, mutation, MUT_RATE ); -00092 peoSeqTransform< Route > eaTransform( transform ); // ParadisEO transform operator (please remark the peo prefix) - wraps an e EO transform object -00093 -00094 eoPlusReplacement< Route > eaReplace; // replacement strategy - for replacing the initial population with offspring individuals -00095 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00096 -00097 -00098 -00099 RingTopology topology; -00100 -00101 // migration policy and components ---------------------------------------------------------------------------------------------------------------- -00102 -00103 eoPeriodicContinue< Route > mig_cont( MIG_FREQ ); // migration occurs periodically -00104 -00105 eoRandomSelect< Route > mig_select_one; // emigrants are randomly selected -00106 eoSelectNumber< Route > mig_select( mig_select_one, MIG_SIZE ); -00107 -00108 eoPlusReplacement< Route > mig_replace; // immigrants replace the worse individuals -00109 -00110 peoSyncIslandMig< Route > mig( MIG_FREQ, mig_select, mig_replace, topology, population, population ); -00111 //peoAsyncIslandMig< Route > mig( mig_cont, mig_select, mig_replace, topology, population, population ); -00112 -00113 eaCheckpointContinue.add( mig ); -00114 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00115 -00116 -00117 -00118 -00119 -00120 // ParadisEO-PEO evolutionary algorithm ----------------------------------------------------------------------------------------------------------- -00121 -00122 peoEA< Route > eaAlg( eaCheckpointContinue, eaPopEval, eaSelect, eaTransform, eaReplace ); -00123 -00124 mig.setOwner( eaAlg ); -00125 -00126 eaAlg( population ); // specifying the initial population for the algorithm, to be iteratively evolved -00127 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00128 -00129 -00130 -00131 -00132 // evolutionary algorithm components -------------------------------------------------------------------------------------------------------------- -00133 -00134 eoPop< Route > population2( POP_SIZE, route_init ); // initial population for the algorithm having POP_SIZE individuals -00135 peoParaPopEval< Route > eaPopEval2( full_eval ); // evaluator object - to be applied at each iteration on the entire population -00136 -00137 eoGenContinue< Route > eaCont2( NUM_GEN ); // continuation criterion - the algorithm will iterate for NUM_GEN generations -00138 eoCheckPoint< Route > eaCheckpointContinue2( eaCont2 ); // checkpoint object - verify at each iteration if the continuation criterion is met -00139 -00140 eoRankingSelect< Route > selectionStrategy2; // selection strategy - applied at each iteration for selecting parent individuals -00141 eoSelectNumber< Route > eaSelect2( selectionStrategy2, POP_SIZE ); // selection object - POP_SIZE individuals are selected at each iteration -00142 -00143 // transform operator - includes the crossover and the mutation operators with a specified associated rate -00144 eoSGATransform< Route > transform2( crossover, CROSS_RATE, mutation, MUT_RATE ); -00145 peoSeqTransform< Route > eaTransform2( transform2 ); // ParadisEO transform operator (please remark the peo prefix) - wraps an e EO transform object -00146 -00147 eoPlusReplacement< Route > eaReplace2; // replacement strategy - for replacing the initial population with offspring individuals -00148 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00149 -00150 -00151 -00152 -00153 // migration policy and components ---------------------------------------------------------------------------------------------------------------- -00154 -00155 eoPeriodicContinue< Route > mig_cont2( MIG_FREQ ); // migration occurs periodically -00156 -00157 eoRandomSelect< Route > mig_select_one2; // emigrants are randomly selected -00158 eoSelectNumber< Route > mig_select2( mig_select_one2, MIG_SIZE ); -00159 -00160 eoPlusReplacement< Route > mig_replace2; // immigrants replace the worse individuals -00161 -00162 peoSyncIslandMig< Route > mig2( MIG_FREQ, mig_select2, mig_replace2, topology, population2, population2 ); -00163 //peoAsyncIslandMig< Route > mig2( mig_cont2, mig_select2, mig_replace2, topology, population2, population2 ); -00164 -00165 eaCheckpointContinue2.add( mig2 ); -00166 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00167 -00168 -00169 -00170 -00171 -00172 // ParadisEO-PEO evolutionary algorithm ----------------------------------------------------------------------------------------------------------- -00173 -00174 peoEA< Route > eaAlg2( eaCheckpointContinue2, eaPopEval2, eaSelect2, eaTransform2, eaReplace2 ); -00175 -00176 mig2.setOwner( eaAlg2 ); -00177 -00178 eaAlg2( population2 ); // specifying the initial population for the algorithm, to be iteratively evolved -00179 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00180 -00181 -00182 -00183 peo :: run( ); -00184 peo :: finalize( ); -00185 // shutting down the ParadisEO-PEO environment -00186 -00187 return 0; -00188 } -
1.4.7
-
-
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/LessonParallelAlgorithm_2main_8cpp-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/LessonParallelAlgorithm_2main_8cpp-source.html
deleted file mode 100644
index 147881a07..000000000
--- a/tags/paradiseo-1.1/paradiseo-peo/doc/html/LessonParallelAlgorithm_2main_8cpp-source.html
+++ /dev/null
@@ -1,366 +0,0 @@
-
-
-00001 // "main.cpp" -00002 -00003 // (c) OPAC Team, LIFL, January 2006 -00004 -00005 /* -00006 Contact: paradiseo-help@lists.gforge.inria.fr -00007 */ -00008 -00009 #include <eo> -00010 #include <paradiseo> -00011 -00012 #include <peoParallelAlgorithmWrapper.h> -00013 #include <peoSynchronousMultiStart.h> -00014 -00015 -00016 -00017 #include "route.h" -00018 #include "route_init.h" -00019 #include "route_eval.h" -00020 -00021 #include "order_xover.h" -00022 #include "city_swap.h" -00023 -00024 #include "param.h" -00025 -00026 -00027 -00028 -00029 #include <mo.h> -00030 -00031 #include <graph.h> -00032 #include <route.h> -00033 #include <route_eval.h> -00034 #include <route_init.h> -00035 -00036 #include <two_opt.h> -00037 #include <two_opt_init.h> -00038 #include <two_opt_next.h> -00039 #include <two_opt_incr_eval.h> -00040 -00041 -00042 -00043 #define RANDOM_POP_SIZE 30 -00044 #define RANDOM_ITERATIONS 10 -00045 -00046 -00047 #define POP_SIZE 10 -00048 #define NUM_GEN 100 -00049 #define CROSS_RATE 1.0 -00050 #define MUT_RATE 0.01 -00051 -00052 #define NUMBER_OF_POPULATIONS 3 -00053 -00054 -00055 -00056 struct RandomExplorationAlgorithm { -00057 -00058 RandomExplorationAlgorithm( peoPopEval< Route >& __popEval, peoSynchronousMultiStart< Route >& extParallelExecution ) -00059 : popEval( __popEval ), parallelExecution( extParallelExecution ) { -00060 } -00061 -00062 -00063 // the sequential algorithm to be executed in parallel by the wrapper -00064 void operator()() { -00065 -00066 RouteInit route_init; // random init object - creates random Route objects -00067 RouteEval route_eval; -00068 eoPop< Route > population( RANDOM_POP_SIZE, route_init ); -00069 -00070 popEval( population ); -00071 -00072 -00073 // executing HCs on the population in parallel -00074 parallelExecution( population ); -00075 -00076 -00077 -00078 // just to show off :: HCs on a vector of Route objects -00079 { -00080 Route* rVect = new Route[ 5 ]; -00081 for ( unsigned int index = 0; index < 5; index++ ) { -00082 -00083 route_init( rVect[ index ] ); route_eval( rVect[ index ] ); -00084 } -00085 -00086 // applying the HCs on the vector of Route objects -00087 parallelExecution( rVect, rVect + 5 ); -00088 delete[] rVect; -00089 } -00090 -00091 -00092 -00093 Route bestRoute = population.best_element(); -00094 -00095 for ( unsigned int index = 0; index < RANDOM_ITERATIONS; index++ ) { -00096 -00097 for ( unsigned int routeIndex = 0; routeIndex < RANDOM_POP_SIZE; routeIndex++ ) { -00098 -00099 route_init( population[ routeIndex ] ); -00100 } -00101 -00102 popEval( population ); -00103 -00104 if ( fabs( population.best_element().fitness() ) < fabs( bestRoute.fitness() ) ) bestRoute = population.best_element(); -00105 -00106 std::cout << "Random Iteration #" << index << "... [ " << bestRoute.fitness() << " ]" << std::flush << std::endl; -00107 } -00108 } -00109 -00110 -00111 peoPopEval< Route >& popEval; -00112 peoSynchronousMultiStart< Route >& parallelExecution; -00113 }; -00114 -00115 -00116 -00117 -00118 int main( int __argc, char** __argv ) { -00119 -00120 srand( time(NULL) ); -00121 -00122 -00123 -00124 // initializing the ParadisEO-PEO environment -00125 peo :: init( __argc, __argv ); -00126 -00127 -00128 // processing the command line specified parameters -00129 loadParameters( __argc, __argv ); -00130 -00131 -00132 -00133 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00134 // #1 An EO evolutionary algorithm to be executed in parallel with other algorithms (no parallel evaluation, no etc.). -00135 -00136 // init, eval operators, EA operators ------------------------------------------------------------------------------------------------------------- -00137 RouteInit route_init; // random init object - creates random Route objects -00138 RouteEval full_eval; // evaluator object - offers a fitness value for a specified Route object -00139 -00140 OrderXover crossover; // crossover operator - creates two offsprings out of two specified parents -00141 CitySwap mutation; // mutation operator - randomly mutates one gene for a specified individual -00142 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00143 -00144 -00145 // evolutionary algorithm components -------------------------------------------------------------------------------------------------------------- -00146 -00147 eoPop< Route > population( POP_SIZE, route_init ); // initial population for the algorithm having POP_SIZE individuals -00148 -00149 eoGenContinue< Route > eaCont( NUM_GEN ); // continuation criterion - the algorithm will iterate for NUM_GEN generations -00150 eoCheckPoint< Route > eaCheckpointContinue( eaCont ); // checkpoint object - verify at each iteration if the continuation criterion is met -00151 -00152 eoRankingSelect< Route > selectionStrategy; // selection strategy - applied at each iteration for selecting parent individuals -00153 eoSelectNumber< Route > eaSelect( selectionStrategy, POP_SIZE ); // selection object - POP_SIZE individuals are selected at each iteration -00154 -00155 // transform operator - includes the crossover and the mutation operators with a specified associated rate -00156 eoSGATransform< Route > transform( crossover, CROSS_RATE, mutation, MUT_RATE ); -00157 -00158 eoPlusReplacement< Route > eaReplace; // replacement strategy - for replacing the initial population with offspring individuals -00159 // ------------------------------------------------------------------------------------------------------------------------------------------------ -00160 -00161 -00162 -00163 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -00164 // SEQENTIAL ALGORITHM DEFINITION ----------------------------------------------------------------------------------------------------------------- -00165 eoEasyEA< Route > eaAlg( eaCheckpointContinue, full_eval, eaSelect, transform, eaReplace ); -00166 // SEQENTIAL ALGORITHM DEFINITION ----------------------------------------------------------------------------------------------------------------- -00167 -00168 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00169 peoParallelAlgorithmWrapper parallelEAAlg( eaAlg, population ); // specifying the embedded algorithm and the algorithm input data -00170 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00171 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -00172 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00173 -00174 -00175 -00176 -00177 -00178 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00179 // #2 A MO hill climbing to be executed in parallel with other algorithms (no parallel evaluation, no etc.). -00180 -00181 if ( getNodeRank() == 1 ) { -00182 -00183 Graph::load( __argv [ 1 ] ); -00184 } -00185 -00186 Route route; -00187 RouteInit init; init( route ); -00188 RouteEval full_evalHC; full_evalHC( route ); -00189 -00190 if ( getNodeRank() == 1 ) { -00191 -00192 std :: cout << "[From] " << route << std :: endl; -00193 } -00194 -00195 -00196 TwoOptInit two_opt_init; -00197 TwoOptNext two_opt_next; -00198 TwoOptIncrEval two_opt_incr_eval; -00199 -00200 moBestImprSelect< TwoOpt > two_opt_select; -00201 -00202 -00203 -00204 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -00205 // SEQENTIAL ALGORITHM DEFINITION ----------------------------------------------------------------------------------------------------------------- -00206 moHC< TwoOpt > hill_climbing( two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_select, full_evalHC ); -00207 // SEQENTIAL ALGORITHM DEFINITION ----------------------------------------------------------------------------------------------------------------- -00208 -00209 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00210 peoParallelAlgorithmWrapper parallelHillClimbing( hill_climbing, route ); // specifying the embedded algorithm and the algorithm input data -00211 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00212 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -00213 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00214 -00215 -00216 -00217 -00218 -00219 -00220 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00221 // #3 A user defined algorithm to be executed in parallel with other algorithms - parallel evaluation and synchronous -00222 // multi-start of several hill-climbing algorithms (inside the user defined algorithm)!!. -00223 -00224 RouteEval full_evalRandom; -00225 peoParaPopEval< Route > randomParaEval( full_evalRandom ); -00226 -00227 -00228 peoSynchronousMultiStart< Route > parallelExecution( hill_climbing ); -00229 -00230 RandomExplorationAlgorithm randomExplorationAlgorithm( randomParaEval, parallelExecution ); -00231 -00232 -00233 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00234 peoParallelAlgorithmWrapper parallelRandExp( randomExplorationAlgorithm ); // specifying the embedded algorithm - no input data in this case -00235 -00236 randomParaEval.setOwner( parallelRandExp ); -00237 parallelExecution.setOwner( parallelRandExp ); -00238 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00239 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00240 -00241 -00242 -00243 -00244 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00245 // #4 Synchronous Multi-Start: several hill-climbing algorithms launched in parallel on different initial solutions -00246 -00247 RouteInit ex_hc_route_init; // random init object - creates random Route objects -00248 RouteEval ex_hc_full_eval; // evaluator object - offers a fitness value for a specified Route object -00249 -00250 eoPop< Route > ex_hc_population( POP_SIZE, ex_hc_route_init ); -00251 -00252 for ( unsigned int index = 0; index < POP_SIZE; index++ ) { -00253 -00254 ex_hc_full_eval( ex_hc_population[ index ] ); -00255 } -00256 -00257 -00258 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00259 peoSynchronousMultiStart< Route > ex_hc_parallelExecution( hill_climbing ); -00260 peoParallelAlgorithmWrapper ex_hc_parallel( ex_hc_parallelExecution, ex_hc_population ); // specifying the embedded algorithm - no input data in this case -00261 -00262 ex_hc_parallelExecution.setOwner( ex_hc_parallel ); -00263 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00264 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00265 -00266 -00267 -00268 -00269 -00270 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00271 // #5 Synchronous Multi-Start: Multiple EO evolutionary algorithms to be executed in parallel -00272 // (inside different processes, on different populations; no parallel evaluation, no etc.). -00273 -00274 RouteInit ex_route_init; // random init object - creates random Route objects -00275 RouteEval ex_full_eval; // evaluator object - offers a fitness value for a specified Route object -00276 -00277 std::vector< eoPop< Route > > ex_population; -00278 ex_population.resize( NUMBER_OF_POPULATIONS ); -00279 -00280 for ( unsigned int indexPop = 0; indexPop < NUMBER_OF_POPULATIONS; indexPop++ ) { -00281 -00282 ex_population[ indexPop ].resize( POP_SIZE ); -00283 -00284 for ( unsigned int index = 0; index < POP_SIZE; index++ ) { -00285 -00286 ex_route_init( ex_population[ indexPop ][ index ] ); -00287 ex_full_eval( ex_population[ indexPop ][ index ] ); -00288 } -00289 } -00290 -00291 -00292 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00293 peoSynchronousMultiStart< eoPop< Route > > ex_parallelExecution( eaAlg ); -00294 peoParallelAlgorithmWrapper ex_parallel( ex_parallelExecution, ex_population ); // specifying the embedded algorithm - no input data in this case -00295 -00296 ex_parallelExecution.setOwner( ex_parallel ); -00297 // SETTING UP THE PARALLEL WRAPPER ---------------------------------------------------------------------------------------------------------------- -00298 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -00299 -00300 -00301 -00302 -00303 -00304 -00305 peo :: run( ); -00306 peo :: finalize( ); -00307 // shutting down the ParadisEO-PEO environment -00308 -00309 -00310 -00311 // the algorithm is executed in the #1 rank process -00312 if ( getNodeRank() == 1 ) { -00313 -00314 std :: cout << "[To] " << route << std :: endl << std::endl; -00315 -00316 -00317 std :: cout << "Synchronous Multi-Start HCs:" << std :: endl ; -00318 for ( unsigned int index = 0; index < POP_SIZE; index++ ) { -00319 -00320 std::cout << ex_hc_population[ index ] << std::endl; -00321 } -00322 std::cout << std::endl << std::endl; -00323 -00324 -00325 std :: cout << "Synchronous Multi-Start EAs:" << std :: endl ; -00326 for ( unsigned int index = 0; index < NUMBER_OF_POPULATIONS; index++ ) { -00327 -00328 std::cout << ex_population[ index ] << std::endl; -00329 } -00330 std::cout << std::endl << std::flush; -00331 -00332 } -00333 -00334 -00335 -00336 return 0; -00337 } -
1.4.7
-
-
diff --git a/tags/paradiseo-1.1/paradiseo-peo/doc/html/README-source.html b/tags/paradiseo-1.1/paradiseo-peo/doc/html/README-source.html
index 87cd433a2..800226e61 100644
--- a/tags/paradiseo-1.1/paradiseo-peo/doc/html/README-source.html
+++ b/tags/paradiseo-1.1/paradiseo-peo/doc/html/README-source.html
@@ -98,7 +98,7 @@
00074 ===================================================================
00075
00076 Mailing list : paradiseo-help@lists.gforge.inria.fr
-
1.4.7