* Add problems/DTLZ from http://paradiseo.gforge.inria.fr/index.php?n=Problems.DTLZ
This commit is contained in:
parent
dffd873774
commit
521c7e5bf5
64 changed files with 4770 additions and 0 deletions
76
problems/DTLZ/application/CMakeLists.txt
Normal file
76
problems/DTLZ/application/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${PARADISEO_EO_SRC_DIR}/src
|
||||
${PARADISEO_MO_SRC_DIR}/src
|
||||
${PARADISEO_MOEO_SRC_DIR}/src
|
||||
${DTLZ_SOURCE_DIR}/src)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${PARADISEO_EO_BIN_DIR}/lib)
|
||||
LINK_DIRECTORIES(${PARADISEO_MOEO_BIN_DIR}/lib)
|
||||
LINK_DIRECTORIES(${DTLZ_BINARY_DIR}/lib)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target: just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(DTLZ_SPEA2 DTLZ_SPEA2.cpp)
|
||||
ADD_EXECUTABLE(DTLZ_NSGAII DTLZ_NSGAII.cpp)
|
||||
ADD_EXECUTABLE(DTLZ_IBEA DTLZ_IBEA.cpp)
|
||||
ADD_DEPENDENCIES(DTLZ_SPEA2 lDTLZ)
|
||||
ADD_DEPENDENCIES(DTLZ_NSGAII lDTLZ)
|
||||
ADD_DEPENDENCIES(DTLZ_IBEA lDTLZ)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Link the librairies for your executable
|
||||
######################################################################################
|
||||
|
||||
# Only if you need to link libraries
|
||||
TARGET_LINK_LIBRARIES(DTLZ_SPEA2 moeo eo eoutils lDTLZ)
|
||||
TARGET_LINK_LIBRARIES(DTLZ_NSGAII moeo eo eoutils lDTLZ)
|
||||
TARGET_LINK_LIBRARIES(DTLZ_IBEA moeo eo eoutils lDTLZ)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Copy the instances and the "param" file in the build path for an easy use.
|
||||
###
|
||||
### --> run the "make install" target to copy the parameter file / instances
|
||||
### in the directory where you build the application
|
||||
######################################################################################
|
||||
|
||||
ADD_CUSTOM_TARGET(install DEPENDS ${DTLZ_SOURCE_DIR}/application/IBEA.param
|
||||
${DTLZ_SOURCE_DIR}/application/NSGAII.param
|
||||
${DTLZ_SOURCE_DIR}/application/SPEA2.param
|
||||
${DTLZ_SOURCE_DIR}/application)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET install
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${DTLZ_SOURCE_DIR}/application/IBEA.param
|
||||
${DTLZ_BINARY_DIR}/application
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${DTLZ_SOURCE_DIR}/application/NSGAII.param
|
||||
${DTLZ_BINARY_DIR}/application
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${DTLZ_SOURCE_DIR}/application/SPEA2.param
|
||||
${DTLZ_BINARY_DIR}/application)
|
||||
|
||||
######################################################################################
|
||||
172
problems/DTLZ/application/DTLZ_IBEA.cpp
Normal file
172
problems/DTLZ/application/DTLZ_IBEA.cpp
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
// moeo general include
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <moeo>
|
||||
#include <es/eoRealInitBounded.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 <DTLZ.h>
|
||||
#include <DTLZ1Eval.h>
|
||||
#include <DTLZ2Eval.h>
|
||||
#include <DTLZ3Eval.h>
|
||||
#include <DTLZ4Eval.h>
|
||||
#include <DTLZ5Eval.h>
|
||||
#include <DTLZ6Eval.h>
|
||||
#include <DTLZ7Eval.h>
|
||||
#include <SBXCrossover.h>
|
||||
#include <PolynomialMutation.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
|
||||
|
||||
unsigned int MAX_GEN = parser.createParam((unsigned int)(10000), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||
double P_CROSS = parser.createParam(1.0, "pCross", "Crossover probability",'C',"Param").value();
|
||||
double EXT_P_MUT = parser.createParam(1.0, "extPMut", "External Mutation probability",'E',"Param").value();
|
||||
double INT_P_MUT = parser.createParam(0.083, "intPMut", "Internal Mutation probability",'I',"Param").value();
|
||||
unsigned int VEC_SIZE = parser.createParam((unsigned int)(12), "vecSize", "Genotype Size",'V',"Param").value();
|
||||
unsigned int NB_OBJ= parser.createParam((unsigned int)(3), "nbObj", "Number of Objective",'N',"Param").value();
|
||||
std::string OUTPUT_FILE = parser.createParam(std::string("dtlz_ibea"), "outputFile", "Path of the output file",'o',"Output").value();
|
||||
unsigned int EVAL = parser.createParam((unsigned int)(1), "eval", "Number of the DTLZ evaluation fonction",'F',"Param").value();
|
||||
unsigned int DTLZ4_PARAM = parser.createParam((unsigned int)(100), "dtlz4_param", "Parameter of the DTLZ4 evaluation fonction",'P',"Param").value();
|
||||
unsigned int NB_EVAL = parser.createParam((unsigned int)(0), "nbEval", "Number of evaluation before Stop",'P',"Param").value();
|
||||
unsigned int TIME = parser.createParam((unsigned int)(0), "time", "Time(seconds) before Stop",'T',"Param").value();
|
||||
|
||||
|
||||
|
||||
/*** the representation-dependent things ***/
|
||||
std::vector <bool> bObjectives(NB_OBJ);
|
||||
for (unsigned int i=0; i<NB_OBJ ; i++)
|
||||
bObjectives[i]=true;
|
||||
moeoObjectiveVectorTraits::setup(NB_OBJ,bObjectives);
|
||||
|
||||
// The fitness evaluation
|
||||
eoEvalFunc <DTLZ> * eval;
|
||||
|
||||
if (EVAL == 1)
|
||||
eval= new DTLZ1Eval;
|
||||
else if (EVAL == 2)
|
||||
eval= new DTLZ2Eval;
|
||||
else if (EVAL == 3)
|
||||
eval= new DTLZ3Eval;
|
||||
else if (EVAL == 4)
|
||||
eval= new DTLZ4Eval(DTLZ4_PARAM);
|
||||
else if (EVAL == 5)
|
||||
eval= new DTLZ5Eval;
|
||||
else if (EVAL == 6)
|
||||
eval= new DTLZ6Eval;
|
||||
else if (EVAL == 7)
|
||||
eval= new DTLZ7Eval;
|
||||
|
||||
// the genotype (through a genotype initializer)
|
||||
eoRealVectorBounds bounds(VEC_SIZE, 0.0, 1.0);
|
||||
|
||||
eoRealInitBounded <DTLZ> init (bounds);
|
||||
// the variation operators
|
||||
SBXCrossover < DTLZ > xover(bounds, 15);
|
||||
|
||||
PolynomialMutation < DTLZ > mutation (bounds, INT_P_MUT, 20);
|
||||
|
||||
/*** the representation-independent things ***/
|
||||
|
||||
// initialization of the population
|
||||
|
||||
// definition of the archive
|
||||
// stopping criteria
|
||||
|
||||
eoGenContinue<DTLZ> term(MAX_GEN);
|
||||
|
||||
eoEvalFuncCounter<DTLZ> evalFunc(*eval);
|
||||
|
||||
/*eoTimeContinue<DTLZ> timeContinuator(TIME);
|
||||
eoCheckPoint<DTLZ> checkpoint(timeContinuator);*/
|
||||
|
||||
eoCheckPoint<DTLZ>* checkpoint;
|
||||
|
||||
if (TIME > 0)
|
||||
checkpoint = new eoCheckPoint<DTLZ>(*(new eoTimeContinue<DTLZ>(TIME)));
|
||||
else if (NB_EVAL > 0)
|
||||
checkpoint = new eoCheckPoint<DTLZ>(*(new eoEvalContinue<DTLZ>(evalFunc, NB_EVAL)));
|
||||
else {
|
||||
cout << "ERROR!!! : TIME or NB_EVAL must be > 0 : used option --time or --nbEval\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
checkpoint->add(term);
|
||||
|
||||
/*moeoArchiveObjectiveVectorSavingUpdater < DTLZ > updater(arch, OUTPUT_FILE);
|
||||
checkpoint->add(updater);*/
|
||||
|
||||
// algorithm
|
||||
|
||||
eoSGAGenOp < DTLZ > op(xover, P_CROSS, mutation, EXT_P_MUT);
|
||||
|
||||
/* moeoArchiveUpdater < DTLZ > up(arch, pop);
|
||||
checkpoint.add(up);*/
|
||||
|
||||
//moeoNSGAII<DTLZ> algo(*checkpoint, *eval ,op);
|
||||
|
||||
moeoAdditiveEpsilonBinaryMetric < DTLZObjectiveVector > metric;
|
||||
moeoIBEA<DTLZ> algo(*checkpoint, evalFunc ,op, metric);
|
||||
|
||||
|
||||
/*** Go ! ***/
|
||||
|
||||
// help ?
|
||||
|
||||
|
||||
eoPop<DTLZ>& pop = do_make_pop(parser, state, init);
|
||||
|
||||
make_help(parser);
|
||||
|
||||
// run the algo
|
||||
do_run(algo, pop);
|
||||
|
||||
moeoUnboundedArchive<DTLZ> finalArchive;
|
||||
finalArchive(pop);
|
||||
|
||||
// printing of the final population
|
||||
//cout << "Final Archive \n";
|
||||
//finalArchive.sortedPrintOn(outfile);
|
||||
|
||||
ofstream outfile(OUTPUT_FILE.c_str(), ios::app);
|
||||
if ((unsigned int)outfile.tellp() != 0)
|
||||
outfile << endl;
|
||||
|
||||
for (unsigned int i=0 ; i < finalArchive.size(); i++) {
|
||||
for (unsigned int j=0 ; j<NB_OBJ; j++) {
|
||||
outfile << finalArchive[i].objectiveVector()[j];
|
||||
if (j != NB_OBJ -1)
|
||||
outfile << " ";
|
||||
}
|
||||
outfile << endl;
|
||||
}
|
||||
|
||||
outfile.close();
|
||||
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
169
problems/DTLZ/application/DTLZ_NSGAII.cpp
Normal file
169
problems/DTLZ/application/DTLZ_NSGAII.cpp
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
// moeo general include
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <moeo>
|
||||
#include <es/eoRealInitBounded.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 <DTLZ.h>
|
||||
#include <DTLZ1Eval.h>
|
||||
#include <DTLZ2Eval.h>
|
||||
#include <DTLZ3Eval.h>
|
||||
#include <DTLZ4Eval.h>
|
||||
#include <DTLZ5Eval.h>
|
||||
#include <DTLZ6Eval.h>
|
||||
#include <DTLZ7Eval.h>
|
||||
#include <SBXCrossover.h>
|
||||
#include <PolynomialMutation.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
|
||||
|
||||
unsigned int MAX_GEN = parser.createParam((unsigned int)(10000), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||
double P_CROSS = parser.createParam(1.0, "pCross", "Crossover probability",'C',"Param").value();
|
||||
double EXT_P_MUT = parser.createParam(1.0, "extPMut", "External Mutation probability",'E',"Param").value();
|
||||
double INT_P_MUT = parser.createParam(0.083, "intPMut", "Internal Mutation probability",'I',"Param").value();
|
||||
unsigned int VEC_SIZE = parser.createParam((unsigned int)(12), "vecSize", "Genotype Size",'V',"Param").value();
|
||||
unsigned int NB_OBJ= parser.createParam((unsigned int)(3), "nbObj", "Number of Objective",'N',"Param").value();
|
||||
std::string OUTPUT_FILE = parser.createParam(std::string("dtlz_nsgaII"), "outputFile", "Path of the output file",'o',"Output").value();
|
||||
unsigned int EVAL = parser.createParam((unsigned int)(1), "eval", "Number of the DTLZ evaluation fonction",'F',"Param").value();
|
||||
unsigned int DTLZ4_PARAM = parser.createParam((unsigned int)(100), "dtlz4_param", "Parameter of the DTLZ4 evaluation fonction",'P',"Param").value();
|
||||
unsigned int NB_EVAL = parser.createParam((unsigned int)(0), "nbEval", "Number of evaluation before Stop",'P',"Param").value();
|
||||
unsigned int TIME = parser.createParam((unsigned int)(0), "time", "Time(seconds) before Stop",'T',"Param").value();
|
||||
|
||||
/*** the representation-dependent things ***/
|
||||
std::vector <bool> bObjectives(NB_OBJ);
|
||||
for (unsigned int i=0; i<NB_OBJ ; i++)
|
||||
bObjectives[i]=true;
|
||||
moeoObjectiveVectorTraits::setup(NB_OBJ,bObjectives);
|
||||
|
||||
// The fitness evaluation
|
||||
eoEvalFunc <DTLZ> * eval;
|
||||
|
||||
if (EVAL == 1)
|
||||
eval= new DTLZ1Eval;
|
||||
else if (EVAL == 2)
|
||||
eval= new DTLZ2Eval;
|
||||
else if (EVAL == 3)
|
||||
eval= new DTLZ3Eval;
|
||||
else if (EVAL == 4)
|
||||
eval= new DTLZ4Eval(DTLZ4_PARAM);
|
||||
else if (EVAL == 5)
|
||||
eval= new DTLZ5Eval;
|
||||
else if (EVAL == 6)
|
||||
eval= new DTLZ6Eval;
|
||||
else if (EVAL == 7)
|
||||
eval= new DTLZ7Eval;
|
||||
|
||||
// the genotype (through a genotype initializer)
|
||||
eoRealVectorBounds bounds(VEC_SIZE, 0.0, 1.0);
|
||||
|
||||
eoRealInitBounded <DTLZ> init (bounds);
|
||||
// the variation operators
|
||||
SBXCrossover < DTLZ > xover(bounds, 15);
|
||||
|
||||
PolynomialMutation < DTLZ > mutation (bounds, INT_P_MUT, 20);
|
||||
|
||||
/*** the representation-independent things ***/
|
||||
|
||||
// initialization of the population
|
||||
|
||||
// definition of the archive
|
||||
// stopping criteria
|
||||
|
||||
eoGenContinue<DTLZ> term(MAX_GEN);
|
||||
|
||||
eoEvalFuncCounter<DTLZ> evalFunc(*eval);
|
||||
|
||||
/*eoTimeContinue<DTLZ> timeContinuator(TIME);
|
||||
eoCheckPoint<DTLZ> checkpoint(timeContinuator);*/
|
||||
|
||||
eoCheckPoint<DTLZ>* checkpoint;
|
||||
|
||||
if (TIME > 0)
|
||||
checkpoint = new eoCheckPoint<DTLZ>(*(new eoTimeContinue<DTLZ>(TIME)));
|
||||
else if (NB_EVAL > 0)
|
||||
checkpoint = new eoCheckPoint<DTLZ>(*(new eoEvalContinue<DTLZ>(evalFunc, NB_EVAL)));
|
||||
else {
|
||||
cout << "ERROR!!! : TIME or NB_EVAL must be > 0 : used option --time or --nbEval\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
checkpoint->add(term);
|
||||
|
||||
/*moeoArchiveObjectiveVectorSavingUpdater < DTLZ > updater(arch, OUTPUT_FILE);
|
||||
checkpoint->add(updater);*/
|
||||
|
||||
// algorithm
|
||||
|
||||
eoSGAGenOp < DTLZ > op(xover, P_CROSS, mutation, EXT_P_MUT);
|
||||
|
||||
/* moeoArchiveUpdater < DTLZ > up(arch, pop);
|
||||
checkpoint.add(up);*/
|
||||
|
||||
moeoNSGAII<DTLZ> algo(*checkpoint, evalFunc ,op);
|
||||
|
||||
/*moeoAdditiveEpsilonBinaryMetric < DTLZObjectiveVector > metric;
|
||||
moeoIBEA<DTLZ> algo(checkpoint, eval ,op, metric);*/
|
||||
|
||||
|
||||
/*** Go ! ***/
|
||||
|
||||
// help ?
|
||||
|
||||
|
||||
eoPop<DTLZ>& pop = do_make_pop(parser, state, init);
|
||||
|
||||
make_help(parser);
|
||||
// run the algo
|
||||
do_run(algo, pop);
|
||||
|
||||
moeoUnboundedArchive<DTLZ> finalArchive;
|
||||
finalArchive(pop);
|
||||
|
||||
// printing of the final population
|
||||
//cout << "Final Archive \n";
|
||||
//finalArchive.sortedPrintOn(outfile);
|
||||
|
||||
ofstream outfile(OUTPUT_FILE.c_str(), ios::app);
|
||||
if ((unsigned int)outfile.tellp() != 0)
|
||||
outfile << endl;
|
||||
|
||||
for (unsigned int i=0 ; i < finalArchive.size(); i++) {
|
||||
for (unsigned int j=0 ; j<NB_OBJ; j++) {
|
||||
outfile << finalArchive[i].objectiveVector()[j];
|
||||
if (j != NB_OBJ -1)
|
||||
outfile << " ";
|
||||
}
|
||||
outfile << endl;
|
||||
}
|
||||
|
||||
outfile.close();
|
||||
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
190
problems/DTLZ/application/DTLZ_SPEA2.cpp
Normal file
190
problems/DTLZ/application/DTLZ_SPEA2.cpp
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
// moeo general include
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <moeo>
|
||||
#include <es/eoRealInitBounded.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>
|
||||
|
||||
#include <algo/moeoSPEA2.h>
|
||||
#include <archive/moeoSPEA2Archive.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 <DTLZ.h>
|
||||
#include <DTLZ1Eval.h>
|
||||
#include <DTLZ2Eval.h>
|
||||
#include <DTLZ3Eval.h>
|
||||
#include <DTLZ4Eval.h>
|
||||
#include <DTLZ5Eval.h>
|
||||
#include <DTLZ6Eval.h>
|
||||
#include <DTLZ7Eval.h>
|
||||
#include <SBXCrossover.h>
|
||||
#include <PolynomialMutation.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
|
||||
|
||||
unsigned int ARC_SIZE = parser.createParam((unsigned int)(100), "arcSize", "Archive size",'A',"Param").value();
|
||||
unsigned int MAX_GEN = parser.createParam((unsigned int)(10000), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||
double P_CROSS = parser.createParam(1.0, "pCross", "Crossover probability",'C',"Param").value();
|
||||
double EXT_P_MUT = parser.createParam(1.0, "extPMut", "External Mutation probability",'E',"Param").value();
|
||||
double INT_P_MUT = parser.createParam(0.083, "intPMut", "Internal Mutation probability",'I',"Param").value();
|
||||
unsigned int VEC_SIZE = parser.createParam((unsigned int)(12), "vecSize", "Genotype Size",'V',"Param").value();
|
||||
unsigned int NB_OBJ= parser.createParam((unsigned int)(3), "nbObj", "Number of Objective",'N',"Param").value();
|
||||
unsigned int K = parser.createParam((unsigned int)(10), "k", "k-th nearest neighbor",'K',"Param").value();
|
||||
std::string OUTPUT_FILE = parser.createParam(std::string("dtlz_spea2"), "outputFile", "Path of the output file",'o',"Output").value();
|
||||
unsigned int EVAL = parser.createParam((unsigned int)(1), "eval", "Number of the DTLZ evaluation fonction",'F',"Param").value();
|
||||
unsigned int DTLZ4_PARAM = parser.createParam((unsigned int)(100), "dtlz4_param", "Parameter of the DTLZ4 evaluation fonction",'P',"Param").value();
|
||||
unsigned int NB_EVAL = parser.createParam((unsigned int)(0), "nbEval", "Number of evaluation before Stop",'P',"Param").value();
|
||||
unsigned int TIME = parser.createParam((unsigned int)(0), "time", "Time(seconds) before Stop",'T',"Param").value();
|
||||
|
||||
/*cout << "ARC_SIZE : " << ARC_SIZE << endl;
|
||||
cout << "P_CROSS : " << P_CROSS << endl;
|
||||
cout << "EXT_P_MUT : " << EXT_P_MUT << endl;
|
||||
cout << "INT_P_MUT : " << INT_P_MUT << endl;
|
||||
cout << "VEC_SIZE : " << VEC_SIZE << endl;
|
||||
cout << "NB_OBJ : " << NB_OBJ << endl;
|
||||
cout << "K : " << K << endl;
|
||||
cout << "DTLZ EVAL :" << EVAL << endl;
|
||||
cout << "DTLZ4_PARAM : " << DTLZ4_PARAM << endl;
|
||||
cout << "NB_EVAL : " << NB_EVAL << endl;
|
||||
cout << "TIME : " << TIME << endl; */
|
||||
|
||||
|
||||
/*** the representation-dependent things ***/
|
||||
std::vector <bool> bObjectives(NB_OBJ);
|
||||
for (unsigned int i=0; i<NB_OBJ ; i++)
|
||||
bObjectives[i]=true;
|
||||
moeoObjectiveVectorTraits::setup(NB_OBJ,bObjectives);
|
||||
|
||||
// The fitness evaluation
|
||||
eoEvalFunc <DTLZ> * eval;
|
||||
|
||||
if (EVAL == 1)
|
||||
eval= new DTLZ1Eval;
|
||||
else if (EVAL == 2)
|
||||
eval= new DTLZ2Eval;
|
||||
else if (EVAL == 3)
|
||||
eval= new DTLZ3Eval;
|
||||
else if (EVAL == 4)
|
||||
eval= new DTLZ4Eval(DTLZ4_PARAM);
|
||||
else if (EVAL == 5)
|
||||
eval= new DTLZ5Eval;
|
||||
else if (EVAL == 6)
|
||||
eval= new DTLZ6Eval;
|
||||
else if (EVAL == 7)
|
||||
eval= new DTLZ7Eval;
|
||||
|
||||
// the genotype (through a genotype initializer)
|
||||
eoRealVectorBounds bounds(VEC_SIZE, 0.0, 1.0);
|
||||
|
||||
eoRealInitBounded <DTLZ> init (bounds);
|
||||
// the variation operators
|
||||
SBXCrossover < DTLZ > xover(bounds, 20);
|
||||
|
||||
PolynomialMutation < DTLZ > mutation (bounds, INT_P_MUT, 20);
|
||||
|
||||
/*** the representation-independent things ***/
|
||||
|
||||
// initialization of the population
|
||||
|
||||
// definition of the archive
|
||||
moeoSPEA2Archive<DTLZ> arch(ARC_SIZE);
|
||||
//moeoUnboundedArchive<DTLZ> arch;
|
||||
// stopping criteria
|
||||
|
||||
eoGenContinue<DTLZ> term(MAX_GEN);
|
||||
|
||||
eoEvalFuncCounter<DTLZ> evalFunc(*eval);
|
||||
|
||||
/*eoTimeContinue<DTLZ> timeContinuator(TIME);
|
||||
eoCheckPoint<DTLZ> checkpoint(timeContinuator);*/
|
||||
|
||||
eoCheckPoint<DTLZ>* checkpoint;
|
||||
|
||||
if (TIME > 0)
|
||||
checkpoint = new eoCheckPoint<DTLZ>(*(new eoTimeContinue<DTLZ>(TIME)));
|
||||
else if (NB_EVAL > 0)
|
||||
checkpoint = new eoCheckPoint<DTLZ>(*(new eoEvalContinue<DTLZ>(evalFunc, NB_EVAL)));
|
||||
else {
|
||||
cout << "ERROR!!! : TIME or NB_EVAL must be > 0 : used option --time or --nbEval\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
checkpoint->add(term);
|
||||
|
||||
/*moeoArchiveObjectiveVectorSavingUpdater < DTLZ > updater(arch, OUTPUT_FILE);
|
||||
checkpoint->add(updater);*/
|
||||
|
||||
// algorithm
|
||||
|
||||
moeoSPEA2<DTLZ> algo(*checkpoint, evalFunc ,xover, P_CROSS, mutation, EXT_P_MUT, arch, K, false);
|
||||
/* eoSGAGenOp < DTLZ > op(xover, 1.0, mutation, 1/12);
|
||||
|
||||
moeoArchiveUpdater < DTLZ > up(arch, pop);
|
||||
checkpoint.add(up);
|
||||
|
||||
moeoNSGAII<DTLZ> algo(checkpoint, eval ,op);
|
||||
|
||||
/*moeoAdditiveEpsilonBinaryMetric < DTLZObjectiveVector > metric;
|
||||
moeoIBEA<DTLZ> algo(checkpoint, eval ,op, metric);*/
|
||||
|
||||
|
||||
/*** Go ! ***/
|
||||
|
||||
// help ?
|
||||
|
||||
eoPop<DTLZ>& pop = do_make_pop(parser, state, init);
|
||||
// run the algo
|
||||
make_help(parser);
|
||||
|
||||
do_run(algo, pop);
|
||||
|
||||
moeoUnboundedArchive<DTLZ> finalArchive;
|
||||
finalArchive(arch);
|
||||
|
||||
|
||||
// printing of the final population
|
||||
//cout << "Final Archive \n";
|
||||
//finalArchive.sortedPrintOn(outfile);
|
||||
|
||||
ofstream outfile(OUTPUT_FILE.c_str(), ios::app);
|
||||
if ((unsigned int)outfile.tellp() != 0)
|
||||
outfile << endl;
|
||||
|
||||
for (unsigned int i=0 ; i < finalArchive.size(); i++) {
|
||||
for (unsigned int j=0 ; j<NB_OBJ; j++) {
|
||||
outfile << finalArchive[i].objectiveVector()[j];
|
||||
if (j != NB_OBJ -1)
|
||||
outfile << " ";
|
||||
}
|
||||
outfile << endl;
|
||||
}
|
||||
|
||||
outfile.close();
|
||||
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
28
problems/DTLZ/application/IBEA.param
Normal file
28
problems/DTLZ/application/IBEA.param
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
###### General ######
|
||||
# --help=0 # -h : Prints this message
|
||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
# --seed=1238424544 # -S : Random number seed
|
||||
|
||||
###### Evolution Engine ######
|
||||
# --popSize=20 # -P : Population Size
|
||||
|
||||
###### Output ######
|
||||
--outputFile=IBEA.out # -o : Path of the output file
|
||||
|
||||
###### Param ######
|
||||
# --maxGen=10000 # -G : Maximum number of generations
|
||||
--pCross=1 # -C : Crossover probability
|
||||
--extPMut=1 # -E : External Mutation probability
|
||||
--intPMut=0.083333 # -I : Internal Mutation probability
|
||||
--vecSize=30 # -V : Genotype Size
|
||||
--nbObj=3 # -N : Number of Objective
|
||||
--eval=1 # -F : Number of the DTLZ evaluation fonction
|
||||
--dtlz4_param=100 # -P : Parameter of the DTLZ4 evaluation fonction
|
||||
--nbEval=500 # -P : Number of evaluation before Stop
|
||||
--time=0 # -T : Time(seconds) before Stop
|
||||
|
||||
###### Persistence ######
|
||||
# --Load= # -L : A save file to restart from
|
||||
# --recomputeFitness=0 # -r : Recompute the fitness after re-loading the pop.?
|
||||
# --status=./build/application/DTLZ_IBEA.status # Status file
|
||||
28
problems/DTLZ/application/NSGAII.param
Normal file
28
problems/DTLZ/application/NSGAII.param
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
###### General ######
|
||||
# --help=0 # -h : Prints this message
|
||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
# --seed=1238424545 # -S : Random number seed
|
||||
|
||||
###### Evolution Engine ######
|
||||
# --popSize=20 # -P : Population Size
|
||||
|
||||
###### Output ######
|
||||
--outputFile=NSGAII.out # -o : Path of the output file
|
||||
|
||||
###### Param ######
|
||||
# --maxGen=10000 # -G : Maximum number of generations
|
||||
--pCross=1 # -C : Crossover probability
|
||||
--extPMut=1 # -E : External Mutation probability
|
||||
--intPMut=0.083333 # -I : Internal Mutation probability
|
||||
--vecSize=30 # -V : Genotype Size
|
||||
--nbObj=3 # -N : Number of Objective
|
||||
--eval=1 # -F : Number of the DTLZ evaluation fonction
|
||||
--dtlz4_param=100 # -P : Parameter of the DTLZ4 evaluation fonction
|
||||
--nbEval=500 # -P : Number of evaluation before Stop
|
||||
--time=0 # -T : Time(seconds) before Stop
|
||||
|
||||
###### Persistence ######
|
||||
# --Load= # -L : A save file to restart from
|
||||
# --recomputeFitness=0 # -r : Recompute the fitness after re-loading the pop.?
|
||||
# --status=./build/application/DTLZ_NSGAII.status # Status file
|
||||
30
problems/DTLZ/application/SPEA2.param
Normal file
30
problems/DTLZ/application/SPEA2.param
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
###### General ######
|
||||
# --help=0 # -h : Prints this message
|
||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
# --seed=1238424543 # -S : Random number seed
|
||||
|
||||
###### Evolution Engine ######
|
||||
# --popSize=20 # -P : Population Size
|
||||
|
||||
###### Output ######
|
||||
--outputFile=SPEA2.out # -o : Path of the output file
|
||||
|
||||
###### Param ######
|
||||
--arcSize=100 # -A : Archive size
|
||||
# --maxGen=10000 # -G : Maximum number of generations
|
||||
--pCross=1 # -C : Crossover probability
|
||||
--extPMut=1 # -E : External Mutation probability
|
||||
--intPMut=0.083333 # -I : Internal Mutation probability
|
||||
--vecSize=30 # -V : Genotype Size
|
||||
--nbObj=3 # -N : Number of Objective
|
||||
--k=10 # -K : k-th nearest neighbor
|
||||
--eval=1 # -F : Number of the DTLZ evaluation fonction
|
||||
--dtlz4_param=100 # -P : Parameter of the DTLZ4 evaluation fonction
|
||||
--nbEval=500 # -P : Number of evaluation before Stop
|
||||
--time=0 # -T : Time(seconds) before Stop
|
||||
|
||||
###### Persistence ######
|
||||
# --Load= # -L : A save file to restart from
|
||||
# --recomputeFitness=0 # -r : Recompute the fitness after re-loading the pop.?
|
||||
# --status=./build/application/DTLZ_SPEA2.status # Status file
|
||||
Loading…
Add table
Add a link
Reference in a new issue