Initial import.
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1384 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
f8da7c715a
commit
ef8dafa740
397 changed files with 118785 additions and 0 deletions
11
contribution/trunk/tutos_META08/.project
Normal file
11
contribution/trunk/tutos_META08/.project
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Tutos_META08</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
84
contribution/trunk/tutos_META08/README.txt
Executable file
84
contribution/trunk/tutos_META08/README.txt
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
###############
|
||||
# CONTENTS #
|
||||
###############
|
||||
|
||||
The package "paradiseo_tutorials" contains pre-compiled files for different operating systems and a "not_compiled" package:
|
||||
- windows
|
||||
- linux 32bits
|
||||
- linux 64bits
|
||||
- not_compiled
|
||||
|
||||
Each pre_compiled sub-directory contains an executable file, a parameter file and a c++ source file (provided as an informational resource only) for each lesson:
|
||||
- EO_lesson1 (contains "tsp_EA(.exe)", "tsp_EA.cpp", param)
|
||||
- MO_lesson1 (contains "hill_climbing(.exe)", "hill_climbing.cpp", param)
|
||||
- MO_lesson2 (contains "tabu_search(.exe)", "tabu_search.cpp", param)
|
||||
- MO_lesson3 (contains "simulated_annealing(.exe)", "simulated_annealing.cpp", param)
|
||||
- MO_lesson4 (contains "iterated_local_search(.exe)", "iterated_local_search.cpp", param)
|
||||
- hybrid_lesson (contains "hybrid_ga(.exe)", "hybrid_ga.cpp", param)
|
||||
- MOEO_lesson (contains "FlowShopEA(.exe)", "FlowShopEA.cpp", param)
|
||||
|
||||
For advance users:
|
||||
- The package "not_compiled" allows you to compile tutorials in your own machine ONLY IF PARADISEO HAS BEEN PREVIOUSLY INSTALLED on it.
|
||||
|
||||
|
||||
|
||||
###############
|
||||
# USE #
|
||||
###############
|
||||
|
||||
Copy the package corresponding to your operating system on your computer.
|
||||
|
||||
Then, you can execute all lessons with a command line interpreter.
|
||||
Windows users, do not click on the executable file "*.exe" whereas you won't be able to see the results.
|
||||
|
||||
For instance, to run the hill_climbing, launch a command line interpreter, go to the "MO_lesson1" directory and type:
|
||||
(windows system)
|
||||
> hill_climbing.exe @param
|
||||
(Linux system)
|
||||
> ./hill_climbing @param
|
||||
|
||||
|
||||
|
||||
###############
|
||||
# COMPILATION #
|
||||
###############
|
||||
|
||||
We recommend you to use the pre-compiled packages. But if you still want to compile the "not_compiled" package, please perform the following steps.
|
||||
|
||||
Linux users:
|
||||
************
|
||||
1. Go to the not_compiled directory
|
||||
2. Edit the install.cmake file
|
||||
• PARADISEO DIR : replace "TO FILL" by the path where ParadisEO has been installed (for instance, "/home/user/paradiseo-1.1/")
|
||||
• SOURCES DIR : replace "TO FILL" by the path where the install.cmake file is located on your computer (for instance, "/home/user/tutorials/not_compiled/")
|
||||
3. Go to the build directory and run the following command lines:
|
||||
> cmake ..
|
||||
> make
|
||||
> make install
|
||||
|
||||
Windows users (Visual Studio 9 2008):
|
||||
*************************************
|
||||
1. Go to the not_compiled directory
|
||||
2. Edit the install.cmake file
|
||||
• PARADISEO DIR : replace "TO FILL" by the path where ParadisEO has been installed WITH DOUBLE BACKSLASHES (for instance, "C:\\[ParadisEO_PATH]")
|
||||
• SOURCES DIR : replace "TO FILL" by the path where the install.cmake file is located on your computer (for instance, "C:\\...\\not_compiled")
|
||||
3. Run The Cmake interface.
|
||||
• In the field "Where is the source code:", browse to find path of the "not_compiled" directory.
|
||||
• In the field "Where to build the binaries:", browse to find path of the "not_compiled/build" directory.
|
||||
• Click on "Configure"
|
||||
• Choose "Visual Studio 9 2008"
|
||||
• Skip Warnings (click "OK" for all)
|
||||
• click on "Configure"
|
||||
• Skip Warnings (click "OK" for all)
|
||||
• Click on "Ok"
|
||||
• Skip Warnings (click "OK" for all)
|
||||
4. Compilation.
|
||||
• Go in "not_compiled/build" directory.
|
||||
• Double click on the Visual Studio Solution "TUTORIAUX".
|
||||
• Skip Warnings while Visual Studio is launched (click "OK" for all)
|
||||
• Choose "Release" in the top of the windows near the green arrow.
|
||||
• In the Solutions Explorer (on the left), right click on "Solution'TUTORIAUX'", then click on "Build Solution".
|
||||
• right click on "installall", then click on "Build Solution".
|
||||
Now lessons should be compiled in the build directories.
|
||||
Executable are in the "Release" directories.
|
||||
NOTE: Relative path in "param" files must be changed in added "../" to --instancePath.
|
||||
14
contribution/trunk/tutos_META08/linux_32bits/EO_lesson1/current_param
Executable file
14
contribution/trunk/tutos_META08/linux_32bits/EO_lesson1/current_param
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
###### General ######
|
||||
# --help=0 # -h : Prints this message
|
||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
|
||||
###### Configuration ######
|
||||
--instancePath=../tsp/benchs/berlin52.tsp # Path to the instance.
|
||||
# --seed=1224772176 # Seed for rand.
|
||||
--popSize=100 # Size of the population.
|
||||
--maxGen=1000 # Maximum number of generations.
|
||||
--crossRate=1 # Probability of crossover.
|
||||
--mutRate=0.01 # Probability of mutation.
|
||||
--nbOffspring=100 # Number of offspring.
|
||||
--crossType=Partial # Crossover to use, it can be 'Partial', 'Order' or 'Edge'.
|
||||
9
contribution/trunk/tutos_META08/linux_32bits/EO_lesson1/param
Executable file
9
contribution/trunk/tutos_META08/linux_32bits/EO_lesson1/param
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
###### Configuration ######
|
||||
--instancePath=../tsp/benchs/berlin52.tsp # Path to the instance.
|
||||
--popSize=100 # Size of the population.
|
||||
--nbOffspring=100 # Number of selected parents.
|
||||
--maxGen=1000 # Maximum number of iterations.
|
||||
--crossType=Partial # Crossover to use, it can be 'Partial', 'Order' or 'Edge'.
|
||||
--crossRate=1 # Probability of crossover.
|
||||
--mutRate=0.01 # Probability of mutation
|
||||
|
||||
160
contribution/trunk/tutos_META08/linux_32bits/EO_lesson1/tsp.cpp
Executable file
160
contribution/trunk/tutos_META08/linux_32bits/EO_lesson1/tsp.cpp
Executable file
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* <tsp.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sébastien Cahon, Thomas Legrand
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#include <eo>
|
||||
#include <tsp>
|
||||
|
||||
void manage_configuration_file(eoParser & _parser);
|
||||
|
||||
int main (int _argc, char* _argv [])
|
||||
{
|
||||
|
||||
eoParser parser(_argc, _argv);
|
||||
|
||||
manage_configuration_file(parser);
|
||||
|
||||
unsigned int seed=atoi( (parser.getParamWithLongName("seed")->getValue()).c_str() );
|
||||
std::string instancePath=parser.getParamWithLongName("instancePath")->getValue();
|
||||
unsigned int populationSize=atoi( (parser.getParamWithLongName("popSize")->getValue()).c_str() );
|
||||
unsigned int maxGen=atoi( (parser.getParamWithLongName("maxGen")->getValue()).c_str() );
|
||||
double crossoverRate=atof( (parser.getParamWithLongName("crossRate")->getValue()).c_str() );
|
||||
double mutationRate=atof( (parser.getParamWithLongName("mutRate")->getValue()).c_str() );
|
||||
unsigned int nbOffspring=atoi( (parser.getParamWithLongName("nbOffspring")->getValue()).c_str() );
|
||||
std::string crossoverType=parser.getParamWithLongName("crossType")->getValue();
|
||||
|
||||
// random number generator
|
||||
srand (seed);
|
||||
|
||||
// load test instance
|
||||
Graph::load(instancePath.c_str());
|
||||
|
||||
|
||||
|
||||
/*** the representation-dependent things ***/
|
||||
|
||||
// the evaluation function
|
||||
RouteEval full_eval ;
|
||||
// the genotype (through a genotype initializer)
|
||||
RouteInit init ;
|
||||
// crossover
|
||||
eoQuadOp <Route>*crossover;
|
||||
if(crossoverType.compare("Partial")==0)
|
||||
{
|
||||
crossover=new PartialMappedXover();
|
||||
}
|
||||
else if (crossoverType.compare("Order")==0)
|
||||
{
|
||||
crossover=new OrderXover();
|
||||
}
|
||||
else if (crossoverType.compare("Edge")==0)
|
||||
{
|
||||
crossover=new EdgeXover();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("[tsp.cpp]: the crossover type '"+crossoverType+"' is not correct.");
|
||||
}
|
||||
// mutation
|
||||
CitySwap mutation ;
|
||||
// variation operators
|
||||
eoSGATransform <Route> transform (*crossover, crossoverRate, mutation, mutationRate) ;
|
||||
|
||||
|
||||
|
||||
/*** the representation-independent things ***/
|
||||
|
||||
// initialization of the population
|
||||
eoPop <Route> pop (populationSize, init) ;
|
||||
apply <Route> (full_eval, pop) ;
|
||||
// select
|
||||
eoDetTournamentSelect <Route> select_one ;
|
||||
eoSelectNumber <Route> select (select_one, nbOffspring) ;
|
||||
// replace
|
||||
eoGenerationalReplacement <Route> genReplace;
|
||||
eoWeakElitistReplacement <Route> replace(genReplace);
|
||||
// stopping criteria
|
||||
eoGenContinue <Route> continu (maxGen) ;
|
||||
// algorithm
|
||||
eoEasyEA <Route> ea (continu, full_eval, select, transform, replace) ;
|
||||
|
||||
|
||||
|
||||
/*** Go ! ***/
|
||||
|
||||
// initial solution
|
||||
std :: cout << "[From] " << pop.best_element () << std :: endl ;
|
||||
|
||||
// run the algo
|
||||
ea(pop);
|
||||
|
||||
// final solution
|
||||
std :: cout << "[To] " << pop.best_element () << std :: endl ;
|
||||
|
||||
|
||||
|
||||
// delete pointer
|
||||
delete(crossover);
|
||||
|
||||
// that's all
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void manage_configuration_file(eoParser & _parser)
|
||||
{
|
||||
std::ofstream os;
|
||||
_parser.getORcreateParam(std::string("../tsp/benchs/berlin52.tsp"), "instancePath", "Path to the instance.", 0, "Configuration", false);
|
||||
_parser.getORcreateParam((unsigned int)time(0), "seed", "Seed for rand.", 0, "Configuration", false);
|
||||
_parser.getORcreateParam((unsigned int)100, "popSize", "Size of the population.", 0, "Configuration", false);
|
||||
_parser.getORcreateParam((unsigned int)1000, "maxGen", "Maximum number of generations.", 0, "Configuration", false);
|
||||
_parser.getORcreateParam((double)1.0, "crossRate", "Probability of crossover.", 0, "Configuration", false);
|
||||
_parser.getORcreateParam((double)0.01, "mutRate", "Probability of mutation.", 0, "Configuration", false);
|
||||
_parser.getORcreateParam((unsigned int)100, "nbOffspring", "Number of offspring.", 0, "Configuration", false);
|
||||
_parser.getORcreateParam(std::string("Partial"), "crossType", "Crossover to use, it can be 'Partial', 'Order' or 'Edge'.", 0, "Configuration", false);
|
||||
if (_parser.userNeedsHelp())
|
||||
{
|
||||
_parser.printHelp(std::cout);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
os.open("current_param");
|
||||
if(!os.is_open())
|
||||
{
|
||||
throw std::runtime_error("[tsp.cpp]: the file current_param cannot be created.");
|
||||
}
|
||||
os <<_parser;
|
||||
os.close();
|
||||
}
|
||||
BIN
contribution/trunk/tutos_META08/linux_32bits/EO_lesson1/tsp_EA
Executable file
BIN
contribution/trunk/tutos_META08/linux_32bits/EO_lesson1/tsp_EA
Executable file
Binary file not shown.
BIN
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/FlowShopEA
Executable file
BIN
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/FlowShopEA
Executable file
Binary file not shown.
132
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/FlowShopEA.cpp
Executable file
132
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/FlowShopEA.cpp
Executable file
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* <FlowShopEA.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// moeo general include
|
||||
#include <moeo>
|
||||
// for the creation of an evaluator
|
||||
#include <make_eval_FlowShop.h>
|
||||
// for the creation of an initializer
|
||||
#include <make_genotype_FlowShop.h>
|
||||
// for the creation of the variation operators
|
||||
#include <make_op_FlowShop.h>
|
||||
// how to initialize the population
|
||||
#include <do/make_pop.h>
|
||||
// the stopping criterion
|
||||
#include <do/make_continue_moeo.h>
|
||||
// outputs (stats, population dumps, ...)
|
||||
#include <do/make_checkpoint_moeo.h>
|
||||
// evolution engine (selection and replacement)
|
||||
#include <do/make_ea_moeo.h>
|
||||
// simple call to the algo
|
||||
#include <do/make_run.h>
|
||||
// checks for help demand, and writes the status file and make_help; in libutils
|
||||
void make_help(eoParser & _parser);
|
||||
// definition of the representation
|
||||
#include <FlowShop.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
eoParser parser(argc, argv); // for user-parameter reading
|
||||
eoState state; // to keep all things allocated
|
||||
|
||||
|
||||
/*** the representation-dependent things ***/
|
||||
|
||||
// The evaluation
|
||||
eoEvalFuncCounter<FlowShop>& eval = do_make_eval(parser, state);
|
||||
// the genotype (through a genotype initializer)
|
||||
eoInit<FlowShop>& init = do_make_genotype(parser, state);
|
||||
// the variation operators
|
||||
eoGenOp<FlowShop>& op = do_make_op(parser, state);
|
||||
|
||||
|
||||
/*** the representation-independent things ***/
|
||||
|
||||
// initialization of the population
|
||||
eoPop<FlowShop>& pop = do_make_pop(parser, state, init);
|
||||
// definition of the archive
|
||||
moeoArchive<FlowShop> arch;
|
||||
// stopping criteria
|
||||
eoContinue<FlowShop>& term = do_make_continue_moeo(parser, state, eval);
|
||||
// output
|
||||
eoCheckPoint<FlowShop>& checkpoint = do_make_checkpoint_moeo(parser, state, eval, term, pop, arch);
|
||||
// algorithm
|
||||
eoAlgo<FlowShop>& algo = do_make_ea_moeo(parser, state, eval, checkpoint, op, arch);
|
||||
|
||||
|
||||
/*** Go ! ***/
|
||||
|
||||
// help ?
|
||||
make_help(parser);
|
||||
|
||||
// first evalution (for printing)
|
||||
apply<FlowShop>(eval, pop);
|
||||
|
||||
// printing of the initial population
|
||||
cout << "Initial Population\n";
|
||||
pop.sortedPrintOn(cout);
|
||||
cout << endl;
|
||||
|
||||
// run the algo
|
||||
algo(pop);
|
||||
|
||||
// printing of the final population
|
||||
cout << "Final Population\n";
|
||||
pop.sortedPrintOn(cout);
|
||||
cout << endl;
|
||||
|
||||
// printing of the final archive
|
||||
cout << "Final Archive\n";
|
||||
arch.sortedPrintOn(cout);
|
||||
cout << endl;
|
||||
|
||||
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
49
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/FlowShopEA.status
Executable file
49
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/FlowShopEA.status
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
###### General ######
|
||||
# --help=0 # -h : Prints this message
|
||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
# --seed=1224772186 # -S : Random number seed
|
||||
|
||||
###### Evolution Engine ######
|
||||
--popSize=100 # -P : Population Size
|
||||
--updateArch=1 # Update the archive at each gen.
|
||||
--fitness=FastNonDominatedSorting # -F : Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased
|
||||
--indicator=Epsilon # -i : Binary indicator for IndicatorBased: Epsilon, Hypervolume
|
||||
# --rho=1.1 # reference point for the hypervolume indicator
|
||||
# --kappa=0.05 # -k : Scaling factor kappa for IndicatorBased
|
||||
--diversity=Crowding # -D : Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding
|
||||
--comparator=FitnessThenDiversity # -c : Comparator scheme: FitnessThenDiversity, DiversityThenFitness or Aggregative
|
||||
--selection=DetTour(2) # -S : Selection scheme: DetTour(T), StochTour(t) or Random
|
||||
--replacement=Elitist # -R : Replacement scheme: Elitist, Environmental or Generational
|
||||
--nbOffspring=100% # -O : Number of offspring (percentage or absolute)
|
||||
|
||||
###### Output ######
|
||||
--resDir=Res # Directory to store DISK outputs
|
||||
--eraseDir=1 # erase files in dirName if any
|
||||
--printPop=0 # Print sorted pop. every gen.
|
||||
--storeArch=1 # Store the archive's objective vectors at each gen.
|
||||
--contribution=0 # Store the contribution of the archive at each gen.
|
||||
--entropy=0 # Store the entropy of the archive at each gen.
|
||||
|
||||
###### Persistence ######
|
||||
# --Load= # -L : A save file to restart from
|
||||
# --recomputeFitness=0 # -r : Recompute the fitness after re-loading the pop.?
|
||||
# --saveFrequency=0 # Save every F generation (0 = only final state, absent = never)
|
||||
# --saveTimeInterval=0 # Save every T seconds (0 or absent = never)
|
||||
# --status=./FlowShopEA.status # Status file
|
||||
|
||||
###### Representation ######
|
||||
--BenchmarkFile=../flowshop/benchs/020_10_01.txt # -B : Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks) REQUIRED
|
||||
|
||||
###### Stopping criterion ######
|
||||
--maxGen=100 # -G : Maximum number of generations (0 = none)
|
||||
--maxEval=0 # -E : Maximum number of evaluations (0 = none)
|
||||
--maxTime=0 # -T : Maximum running time in seconds (0 = none)
|
||||
# --CtrlC=1 # -C : Terminate current generation upon Ctrl C
|
||||
|
||||
###### Variation Operators ######
|
||||
--crossRate=1 # Relative rate for the only crossover
|
||||
--shiftMutRate=0.5 # Relative rate for shift mutation
|
||||
--exchangeMutRate=0.5 # Relative rate for exchange mutation
|
||||
--pCross=0.25 # -c : Probability of Crossover
|
||||
--pMut=0.35 # -m : Probability of Mutation
|
||||
3
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/Res/arch
Executable file
3
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/Res/arch
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
1637 2875
|
||||
1670 2653
|
||||
1634 3244
|
||||
33
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/param
Executable file
33
contribution/trunk/tutos_META08/linux_32bits/MOEO_lesson/param
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
###### Evolution Engine ######
|
||||
--popSize=100 # -P : Population Size
|
||||
--updateArch=1 # Update the archive at each gen.
|
||||
--fitness=FastNonDominatedSorting # -F : Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased
|
||||
--indicator=Epsilon # -i : Binary indicator for IndicatorBased: Epsilon, Hypervolume
|
||||
--diversity=Crowding # -D : Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding
|
||||
--comparator=FitnessThenDiversity # -C : Comparator scheme: FitnessThenDiversity, DiversityThenFitness or Aggregative
|
||||
--selection=DetTour(2) # -S : Selection scheme: DetTour(T), StochTour(t) or Random
|
||||
--replacement=Elitist # -R : Replacement scheme: Elitist, Environmental or Generational
|
||||
--nbOffspring=100% # -O : Number of offspring (percentage or absolute)
|
||||
|
||||
###### Output ######
|
||||
--resDir=Res # Directory to store DISK outputs
|
||||
--eraseDir=1 # erase files in dirName if any
|
||||
--printPop=0 # Print sorted pop. every gen.
|
||||
--storeArch=1 # Store the archive's objective vectors at each gen.
|
||||
--contribution=0 # Store the contribution of the archive at each gen.
|
||||
--entropy=0 # Store the entropy of the archive at each gen.
|
||||
|
||||
###### Representation ######
|
||||
--BenchmarkFile=../flowshop/benchs/020_10_01.txt # -B : Benchmark file name REQUIRED
|
||||
|
||||
###### Stopping criterion ######
|
||||
--maxGen=100 # -G : Maximum number of generations (0 = none)
|
||||
--maxEval=0 # -E : Maximum number of evaluations (0 = none)
|
||||
--maxTime=0 # -T : Maximum running time in seconds (0 = none)
|
||||
|
||||
###### Variation Operators ######
|
||||
--crossRate=1 # Relative rate for the only crossover
|
||||
--shiftMutRate=0.5 # Relative rate for shift mutation
|
||||
--exchangeMutRate=0.5 # Relative rate for exchange mutation
|
||||
--pCross=0.25 # -c : Probability of Crossover
|
||||
--pMut=0.35 # -m : Probability of Mutation
|
||||
9
contribution/trunk/tutos_META08/linux_32bits/MO_lesson1/current_param
Executable file
9
contribution/trunk/tutos_META08/linux_32bits/MO_lesson1/current_param
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
###### General ######
|
||||
# --help=0 # -h : Prints this message
|
||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
|
||||
###### Configuration ######
|
||||
--instancePath=../tsp/benchs/berlin52.tsp # Path to the instance.
|
||||
# --seed=1224772221 # Seed for rand.
|
||||
--selectionType=Best # Type of the selection: 'Best', 'First' or 'Random'.
|
||||
BIN
contribution/trunk/tutos_META08/linux_32bits/MO_lesson1/hill_climbing
Executable file
BIN
contribution/trunk/tutos_META08/linux_32bits/MO_lesson1/hill_climbing
Executable file
Binary file not shown.
134
contribution/trunk/tutos_META08/linux_32bits/MO_lesson1/hill_climbing.cpp
Executable file
134
contribution/trunk/tutos_META08/linux_32bits/MO_lesson1/hill_climbing.cpp
Executable file
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
<hill_climbing.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
(C) OPAC Team, LIFL, 2002-2008
|
||||
|
||||
Sébastien Cahon, Jean-Charles Boisson
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <eo>
|
||||
#include <mo>
|
||||
#include <tsp>
|
||||
|
||||
void manage_configuration_file(eoParser & _parser);
|
||||
|
||||
int
|
||||
main (int _argc, char* _argv [])
|
||||
{
|
||||
std::string instancePath, selectionType;
|
||||
unsigned int seed;
|
||||
|
||||
eoParser parser(_argc, _argv);
|
||||
|
||||
manage_configuration_file(parser);
|
||||
|
||||
seed=atoi( (parser.getParamWithLongName("seed")->getValue()).c_str() );
|
||||
instancePath=parser.getParamWithLongName("instancePath")->getValue();
|
||||
selectionType=parser.getParamWithLongName("selectionType")->getValue();
|
||||
|
||||
srand (seed);
|
||||
Graph::load(instancePath.c_str());
|
||||
|
||||
Route solution;
|
||||
|
||||
RouteInit initializer;
|
||||
initializer (solution);
|
||||
|
||||
RouteEval full_evaluation;
|
||||
full_evaluation (solution);
|
||||
|
||||
std :: cout << "[From] " << solution << std :: endl;
|
||||
|
||||
/* Tools for an efficient (? :-))
|
||||
local search ! */
|
||||
|
||||
TwoOptInit two_opt_initializer;
|
||||
|
||||
TwoOptNext two_opt_next_move_generator;
|
||||
|
||||
TwoOptIncrEval two_opt_incremental_evaluation;
|
||||
|
||||
moMoveSelect<TwoOpt>* two_opt_selection;
|
||||
|
||||
if(selectionType.compare("Best")==0)
|
||||
{
|
||||
two_opt_selection= new moBestImprSelect<TwoOpt>();
|
||||
}
|
||||
else if (selectionType.compare("First")==0)
|
||||
{
|
||||
two_opt_selection= new moFirstImprSelect<TwoOpt>();
|
||||
}
|
||||
else if (selectionType.compare("Random")==0)
|
||||
{
|
||||
two_opt_selection= new moRandImprSelect<TwoOpt>();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("[hill_climbing.cpp]: the type of selection '"+selectionType+"' is not correct.");
|
||||
}
|
||||
|
||||
moHC <TwoOpt> hill_climbing (two_opt_initializer, two_opt_next_move_generator, two_opt_incremental_evaluation,
|
||||
*two_opt_selection, full_evaluation);
|
||||
hill_climbing (solution) ;
|
||||
|
||||
std :: cout << "[To] " << solution << std :: endl;
|
||||
|
||||
delete(two_opt_selection);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
manage_configuration_file(eoParser & _parser)
|
||||
{
|
||||
std::ofstream os;
|
||||
|
||||
_parser.createParam(std::string("../tsp/benchs/berlin52.tsp"), "instancePath", "Path to the instance.",
|
||||
0, "Configuration", false);
|
||||
|
||||
_parser.getORcreateParam((unsigned int)time(0), "seed", "Seed for rand.", 0, "Configuration", false);
|
||||
|
||||
_parser.getORcreateParam(std::string("Best"), "selectionType", "Type of the selection: 'Best', 'First' or 'Random'.",
|
||||
0, "Configuration", false);
|
||||
|
||||
if (_parser.userNeedsHelp())
|
||||
{
|
||||
_parser.printHelp(std::cout);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
os.open("current_param");
|
||||
if(!os.is_open())
|
||||
{
|
||||
throw std::runtime_error("[hill_climbing.cpp]: the file current_param cannot be created.");
|
||||
}
|
||||
os <<_parser;
|
||||
os.close();
|
||||
}
|
||||
3
contribution/trunk/tutos_META08/linux_32bits/MO_lesson1/param
Executable file
3
contribution/trunk/tutos_META08/linux_32bits/MO_lesson1/param
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
###### Configuration ######
|
||||
--instancePath=../tsp/benchs/berlin52.tsp # Path to the instance.
|
||||
--selectionType=Best # Type of the selection: 'Best', 'First' or 'Random'.
|
||||
11
contribution/trunk/tutos_META08/linux_32bits/MO_lesson2/current_param
Executable file
11
contribution/trunk/tutos_META08/linux_32bits/MO_lesson2/current_param
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
###### General ######
|
||||
# --help=0 # -h : Prints this message
|
||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
|
||||
###### Configuration ######
|
||||
--instancePath=../tsp/benchs/berlin52.tsp # Path to the instance.
|
||||
# --seed=1224772237 # Seed for rand.
|
||||
--tabuListSize=10 # Size of the tabu list.
|
||||
--maxIter=1000 # Maximum number of iterations.
|
||||
--tabuListType=TwoOpt # Type of the tabu list: 'TwoOpt', 'SimpleMove' or 'SimpleSolution'.
|
||||
5
contribution/trunk/tutos_META08/linux_32bits/MO_lesson2/param
Executable file
5
contribution/trunk/tutos_META08/linux_32bits/MO_lesson2/param
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
###### Configuration ######
|
||||
--instancePath=../tsp/benchs/berlin52.tsp # Path to the instance
|
||||
--tabuListSize=10 # Size of the tabu list
|
||||
--maxIter=1000 # Maximum number of iterations
|
||||
--tabuListType=TwoOpt # Type of the tabu list: 'TwoOpt', 'SimpleMove' or 'SimpleSolution'
|
||||
BIN
contribution/trunk/tutos_META08/linux_32bits/MO_lesson2/tabu_search
Executable file
BIN
contribution/trunk/tutos_META08/linux_32bits/MO_lesson2/tabu_search
Executable file
Binary file not shown.
145
contribution/trunk/tutos_META08/linux_32bits/MO_lesson2/tabu_search.cpp
Executable file
145
contribution/trunk/tutos_META08/linux_32bits/MO_lesson2/tabu_search.cpp
Executable file
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
<tabu_search.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
(C) OPAC Team, LIFL, 2002-2008
|
||||
|
||||
Sébastien Cahon, Jean-Charles Boisson
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
|
||||
*/
|
||||
|
||||
#include <eo>
|
||||
#include <mo>
|
||||
#include <tsp>
|
||||
|
||||
void manage_configuration_file(eoParser & _parser);
|
||||
|
||||
int
|
||||
main (int _argc, char* _argv [])
|
||||
{
|
||||
std::string instancePath, value;
|
||||
unsigned int seed, maxIterations, tabuListSize;
|
||||
|
||||
eoParser parser(_argc, _argv);
|
||||
|
||||
manage_configuration_file(parser);
|
||||
|
||||
seed=atoi( (parser.getParamWithLongName("seed")->getValue()).c_str() );
|
||||
maxIterations=atoi( (parser.getParamWithLongName("maxIter")->getValue()).c_str() );
|
||||
tabuListSize=atoi( (parser.getParamWithLongName("tabuListSize")->getValue()).c_str() );
|
||||
instancePath=parser.getParamWithLongName("instancePath")->getValue();
|
||||
value=parser.getParamWithLongName("tabuListType")->getValue();
|
||||
|
||||
srand (seed);
|
||||
Graph::load(instancePath.c_str());
|
||||
|
||||
Route solution;
|
||||
|
||||
RouteInit initializer;
|
||||
initializer(solution);
|
||||
|
||||
RouteEval full_evaluation;
|
||||
full_evaluation(solution);
|
||||
|
||||
std :: cout << "[From] " << solution << std :: endl;
|
||||
|
||||
/* Tools for an efficient (? :-))
|
||||
local search ! */
|
||||
|
||||
TwoOptInit two_opt_initializer;
|
||||
|
||||
TwoOptNext two_opt_next_move_generator;
|
||||
|
||||
TwoOptIncrEval two_opt_incremental_evaluation;
|
||||
|
||||
moTabuList<TwoOpt> *tabuList;
|
||||
|
||||
if(value.compare("TwoOpt")==0)
|
||||
{
|
||||
tabuList=new TwoOptTabuList();
|
||||
}
|
||||
else if (value.compare("SimpleMove")==0)
|
||||
{
|
||||
tabuList=new moSimpleMoveTabuList<TwoOpt>(tabuListSize);
|
||||
}
|
||||
else if (value.compare("SimpleSolution")==0)
|
||||
{
|
||||
tabuList=new moSimpleSolutionTabuList<TwoOpt>(tabuListSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("[tabu_search.cpp]: the type of tabu list '"+value+"' is not correct.");
|
||||
}
|
||||
|
||||
moNoAspirCrit <TwoOpt> aspiration_criterion;
|
||||
|
||||
moGenSolContinue <Route> continu (maxIterations);
|
||||
|
||||
moTS <TwoOpt> tabu_search (two_opt_initializer, two_opt_next_move_generator,
|
||||
two_opt_incremental_evaluation, *tabuList, aspiration_criterion, continu, full_evaluation);
|
||||
tabu_search(solution);
|
||||
|
||||
std :: cout << "[To] " << solution << std :: endl;
|
||||
|
||||
delete(tabuList);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
manage_configuration_file(eoParser & _parser)
|
||||
{
|
||||
std::ofstream os;
|
||||
|
||||
_parser.createParam(std::string("../tsp/benchs/berlin52.tsp"), "instancePath", "Path to the instance.",
|
||||
0, "Configuration", false);
|
||||
|
||||
_parser.getORcreateParam((unsigned int)time(0), "seed", "Seed for rand.", 0, "Configuration", false);
|
||||
|
||||
_parser.getORcreateParam((unsigned int)10, "tabuListSize", "Size of the tabu list.", 0, "Configuration", false);
|
||||
|
||||
_parser.getORcreateParam((unsigned int)1000, "maxIter", "Maximum number of iterations.", 0, "Configuration", false);
|
||||
|
||||
_parser.getORcreateParam(std::string("TwoOpt"), "tabuListType", "Type of the tabu list: 'TwoOpt', 'SimpleMove' or 'SimpleSolution'.",
|
||||
0, "Configuration", false);
|
||||
|
||||
if (_parser.userNeedsHelp())
|
||||
{
|
||||
_parser.printHelp(std::cout);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
os.open("current_param");
|
||||
if(!os.is_open())
|
||||
{
|
||||
throw std::runtime_error("[tabu_search.cpp]: the file current_param cannot be created.");
|
||||
}
|
||||
os <<_parser;
|
||||
os.close();
|
||||
}
|
||||
14
contribution/trunk/tutos_META08/linux_32bits/MO_lesson3/current_param
Executable file
14
contribution/trunk/tutos_META08/linux_32bits/MO_lesson3/current_param
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
###### General ######
|
||||
# --help=0 # -h : Prints this message
|
||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
|
||||
###### Configuration ######
|
||||
--instancePath=../tsp/benchs/berlin52.tsp # Path to the instance.
|
||||
# --seed=1224772252 # Seed for rand.
|
||||
--maxIter=1000 # Maximum number of iterations.
|
||||
--initialTemp=1000 # Initial temperature.
|
||||
--threshold=0.1 # Minimum temperature allowed.
|
||||
--expoRatio=0.98 # Ratio used if exponential cooling schedule is chosen.
|
||||
--lineaRatio=0.5 # Ratio used if linear cooling schedule is chosen.
|
||||
--coolSchedType=Expo # Type the cooling schedule: 'Expo' or 'Linear'.
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue