update do
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@376 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
b6c8d1986c
commit
7698e2267e
4 changed files with 91 additions and 82 deletions
|
|
@ -21,11 +21,11 @@
|
|||
#include <utils/selectors.h>
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
#include <moeoArchiveUpdater.h>
|
||||
#include <moeoArchiveObjectiveVectorSavingUpdater.h>
|
||||
#include <metric/moeoBinaryMetricSavingUpdater.h>
|
||||
#include <metric/moeoContributionMetric.h>
|
||||
#include <metric/moeoEntropyMetric.h>
|
||||
#include <utils/moeoArchiveUpdater.h>
|
||||
#include <utils/moeoArchiveObjectiveVectorSavingUpdater.h>
|
||||
#include <utils/moeoBinaryMetricSavingUpdater.h>
|
||||
|
||||
bool testDirRes(std::string _dirName, bool _erase);
|
||||
|
||||
|
|
@ -51,9 +51,9 @@ eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState &
|
|||
// is nb Eval to be used as counter?
|
||||
//bool useEval = _parser.getORcreateParam(true, "useEval", "Use nb of eval. as counter (vs nb of gen.)", '\0', "Output").value();
|
||||
// Create anyway a generation-counter parameter
|
||||
eoValueParam<unsigned> *generationCounter = new eoValueParam<unsigned>(0, "Gen.");
|
||||
eoValueParam<unsigned int> *generationCounter = new eoValueParam<unsigned int>(0, "Gen.");
|
||||
// Create an incrementor (sub-class of eoUpdater).
|
||||
eoIncrementor<unsigned> & increment = _state.storeFunctor( new eoIncrementor<unsigned>(generationCounter->value()) );
|
||||
eoIncrementor<unsigned int> & increment = _state.storeFunctor( new eoIncrementor<unsigned int>(generationCounter->value()) );
|
||||
// Add it to the checkpoint
|
||||
checkpoint.add(increment);
|
||||
// dir for DISK output
|
||||
|
|
@ -77,13 +77,13 @@ eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState &
|
|||
//////////////////////////////
|
||||
// feed the state to state savers
|
||||
// save state every N generation
|
||||
eoValueParam<unsigned>& saveFrequencyParam = _parser.createParam(unsigned(0), "saveFrequency", "Save every F generation (0 = only final state, absent = never)", '\0', "Persistence" );
|
||||
eoValueParam<unsigned int>& saveFrequencyParam = _parser.createParam((unsigned int)(0), "saveFrequency", "Save every F generation (0 = only final state, absent = never)", '\0', "Persistence" );
|
||||
if (_parser.isItThere(saveFrequencyParam))
|
||||
{
|
||||
// first make sure dirName is OK
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
|
||||
unsigned int freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\generations";
|
||||
#else
|
||||
|
|
@ -94,7 +94,7 @@ eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState &
|
|||
checkpoint.add(*stateSaver1);
|
||||
}
|
||||
// save state every T seconds
|
||||
eoValueParam<unsigned>& saveTimeIntervalParam = _parser.getORcreateParam(unsigned(0), "saveTimeInterval", "Save every T seconds (0 or absent = never)", '\0',"Persistence" );
|
||||
eoValueParam<unsigned int>& saveTimeIntervalParam = _parser.getORcreateParam((unsigned int)(0), "saveTimeInterval", "Save every T seconds (0 or absent = never)", '\0',"Persistence" );
|
||||
if (_parser.isItThere(saveTimeIntervalParam) && saveTimeIntervalParam.value()>0)
|
||||
{
|
||||
// first make sure dirName is OK
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ eoContinue<MOEOT> & do_make_continue_moeo(eoParser& _parser, eoState& _state, eo
|
|||
eoCombinedContinue<MOEOT> *continuator = NULL;
|
||||
// First the eoGenContinue - need a default value so you can run blind
|
||||
// but we also need to be able to avoid it <--> 0
|
||||
eoValueParam<unsigned>& maxGenParam = _parser.createParam(unsigned(100), "maxGen", "Maximum number of generations (0 = none)",'G',"Stopping criterion");
|
||||
eoValueParam<unsigned int>& maxGenParam = _parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations (0 = none)",'G',"Stopping criterion");
|
||||
if (maxGenParam.value()) // positive: -> define and store
|
||||
{
|
||||
eoGenContinue<MOEOT> *genCont = new eoGenContinue<MOEOT>(maxGenParam.value());
|
||||
|
|
@ -63,7 +63,7 @@ eoContinue<MOEOT> & do_make_continue_moeo(eoParser& _parser, eoState& _state, eo
|
|||
continuator = make_combinedContinue<MOEOT>(continuator, genCont);
|
||||
}
|
||||
// maxEval
|
||||
eoValueParam<unsigned long>& maxEvalParam = _parser.getORcreateParam((unsigned long)0, "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion");
|
||||
eoValueParam<unsigned long>& maxEvalParam = _parser.getORcreateParam((unsigned long)(0), "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion");
|
||||
if (maxEvalParam.value())
|
||||
{
|
||||
eoEvalContinue<MOEOT> *evalCont = new eoEvalContinue<MOEOT>(_eval, maxEvalParam.value());
|
||||
|
|
@ -72,7 +72,7 @@ eoContinue<MOEOT> & do_make_continue_moeo(eoParser& _parser, eoState& _state, eo
|
|||
continuator = make_combinedContinue<MOEOT>(continuator, evalCont);
|
||||
}
|
||||
// maxTime
|
||||
eoValueParam<unsigned long>& maxTimeParam = _parser.getORcreateParam((unsigned long)0, "maxTime", "Maximum running time in seconds (0 = none)", 'T', "Stopping criterion");
|
||||
eoValueParam<unsigned long>& maxTimeParam = _parser.getORcreateParam((unsigned long)(0), "maxTime", "Maximum running time in seconds (0 = none)", 'T', "Stopping criterion");
|
||||
if (maxTimeParam.value()) // positive: -> define and store
|
||||
{
|
||||
eoTimeContinue<MOEOT> *timeCont = new eoTimeContinue<MOEOT>(maxTimeParam.value());
|
||||
|
|
|
|||
|
|
@ -20,26 +20,35 @@
|
|||
#include <eoGenOp.h>
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
#include <moeoArchive.h>
|
||||
#include <moeoComparator.h>
|
||||
#include <moeoCrowdingDistanceDiversityAssignment.h>
|
||||
#include <moeoDetTournamentSelect.h>
|
||||
#include <moeoDiversityAssignment.h>
|
||||
#include <moeoEA.h>
|
||||
#include <moeoEasyEA.h>
|
||||
#include <moeoElitistReplacement.h>
|
||||
#include <moeoEnvironmentalReplacement.h>
|
||||
#include <moeoFastNonDominatedSortingFitnessAssignment.h>
|
||||
#include <moeoFitnessAssignment.h>
|
||||
#include <moeoGenerationalReplacement.h>
|
||||
#include <moeoIndicatorBasedFitnessAssignment.h>
|
||||
#include <moeoRandomSelect.h>
|
||||
#include <moeoReplacement.h>
|
||||
#include <moeoRouletteSelect.h>
|
||||
#include <moeoSelectOne.h>
|
||||
#include <moeoSharingDiversityAssignment.h>
|
||||
#include <moeoStochTournamentSelect.h>
|
||||
|
||||
#include <algo/moeoEA.h>
|
||||
#include <algo/moeoEasyEA.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <comparator/moeoAggregativeComparator.h>
|
||||
#include <comparator/moeoComparator.h>
|
||||
#include <comparator/moeoDiversityThenFitnessComparator.h>
|
||||
#include <comparator/moeoFitnessThenDiversityComparator.h>
|
||||
#include <diversity/moeoDiversityAssignment.h>
|
||||
#include <diversity/moeoDummyDiversityAssignment.h>
|
||||
#include <diversity/moeoFrontByFrontCrowdingDistanceDiversityAssignment.h>
|
||||
#include <diversity/moeoFrontByFrontSharingDiversityAssignment.h>
|
||||
#include <fitness/moeoFastNonDominatedSortingFitnessAssignment.h>
|
||||
#include <fitness/moeoDummyFitnessAssignment.h>
|
||||
#include <fitness/moeoFitnessAssignment.h>
|
||||
#include <fitness/moeoIndicatorBasedFitnessAssignment.h>
|
||||
#include <metric/moeoAdditiveEpsilonBinaryMetric.h>
|
||||
#include <metric/moeoHypervolumeBinaryMetric.h>
|
||||
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
|
||||
#include <replacement/moeoElitistReplacement.h>
|
||||
#include <replacement/moeoEnvironmentalReplacement.h>
|
||||
#include <replacement/moeoGenerationalReplacement.h>
|
||||
#include <replacement/moeoReplacement.h>
|
||||
#include <selection/moeoDetTournamentSelect.h>
|
||||
#include <selection/moeoRandomSelect.h>
|
||||
#include <selection/moeoStochTournamentSelect.h>
|
||||
#include <selection/moeoSelectOne.h>
|
||||
#include <selection/moeoSelectors.h>
|
||||
|
||||
|
||||
/**
|
||||
* This functions allows to build a moeoEA from the parser
|
||||
|
|
@ -59,10 +68,10 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
|
||||
|
||||
/* the fitness assignment strategy */
|
||||
string & fitnessParam = _parser.createParam(string("FastNonDominatedSorting"), "fitness",
|
||||
std::string & fitnessParam = _parser.createParam(std::string("FastNonDominatedSorting"), "fitness",
|
||||
"Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased", 'F',
|
||||
"Evolution Engine").value();
|
||||
string & indicatorParam = _parser.createParam(string("Epsilon"), "indicator",
|
||||
std::string & indicatorParam = _parser.createParam(std::string("Epsilon"), "indicator",
|
||||
"Binary indicator for IndicatorBased: Epsilon, Hypervolume", 'i',
|
||||
"Evolution Engine").value();
|
||||
double rho = _parser.createParam(1.1, "rho", "reference point for the hypervolume indicator", 'r',
|
||||
|
|
@ -70,36 +79,36 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
double kappa = _parser.createParam(0.05, "kappa", "Scaling factor kappa for IndicatorBased", 'k',
|
||||
"Evolution Engine").value();
|
||||
moeoFitnessAssignment < MOEOT > * fitnessAssignment;
|
||||
if (fitnessParam == string("Dummy"))
|
||||
if (fitnessParam == std::string("Dummy"))
|
||||
{
|
||||
fitnessAssignment = new moeoDummyFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == string("FastNonDominatedSorting"))
|
||||
else if (fitnessParam == std::string("FastNonDominatedSorting"))
|
||||
{
|
||||
fitnessAssignment = new moeoFastNonDominatedSortingFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == string("IndicatorBased"))
|
||||
else if (fitnessParam == std::string("IndicatorBased"))
|
||||
{
|
||||
// metric
|
||||
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > *metric;
|
||||
if (indicatorParam == string("Epsilon"))
|
||||
if (indicatorParam == std::string("Epsilon"))
|
||||
{
|
||||
metric = new moeoAdditiveEpsilonBinaryMetric < ObjectiveVector >;
|
||||
}
|
||||
else if (indicatorParam == string("Hypervolume"))
|
||||
else if (indicatorParam == std::string("Hypervolume"))
|
||||
{
|
||||
metric = new moeoHypervolumeBinaryMetric < ObjectiveVector > (rho);
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid binary quality indicator: ") + indicatorParam;
|
||||
std::string stmp = std::string("Invalid binary quality indicator: ") + indicatorParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
fitnessAssignment = new moeoIndicatorBasedFitnessAssignment < MOEOT > (*metric, kappa);
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||
std::string stmp = std::string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(fitnessAssignment);
|
||||
|
|
@ -110,16 +119,16 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
"Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding", 'D', "Evolution Engine");
|
||||
eoParamParamType & diversityParamValue = diversityParam.value();
|
||||
moeoDiversityAssignment < MOEOT > * diversityAssignment;
|
||||
if (diversityParamValue.first == string("Dummy"))
|
||||
if (diversityParamValue.first == std::string("Dummy"))
|
||||
{
|
||||
diversityAssignment = new moeoDummyDiversityAssignment < MOEOT> ();
|
||||
}
|
||||
else if (diversityParamValue.first == string("Sharing"))
|
||||
else if (diversityParamValue.first == std::string("Sharing"))
|
||||
{
|
||||
double nicheSize;
|
||||
if (!diversityParamValue.second.size()) // no parameter added
|
||||
{
|
||||
cerr << "WARNING, no niche size given for Sharing, using 0.5" << std::endl;
|
||||
std::cerr << "WARNING, no niche size given for Sharing, using 0.5" << std::endl;
|
||||
nicheSize = 0.5;
|
||||
diversityParamValue.second.push_back(std::string("0.5"));
|
||||
}
|
||||
|
|
@ -129,37 +138,37 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
}
|
||||
diversityAssignment = new moeoFrontByFrontSharingDiversityAssignment < MOEOT> (nicheSize);
|
||||
}
|
||||
else if (diversityParamValue.first == string("Crowding"))
|
||||
else if (diversityParamValue.first == std::string("Crowding"))
|
||||
{
|
||||
diversityAssignment = new moeoFrontByFrontCrowdingDistanceDiversityAssignment < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid diversity assignment strategy: ") + diversityParamValue.first;
|
||||
std::string stmp = std::string("Invalid diversity assignment strategy: ") + diversityParamValue.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(diversityAssignment);
|
||||
|
||||
|
||||
/* the comparator strategy */
|
||||
string & comparatorParam = _parser.createParam(string("FitnessThenDiversity"), "comparator",
|
||||
std::string & comparatorParam = _parser.createParam(std::string("FitnessThenDiversity"), "comparator",
|
||||
"Comparator scheme: FitnessThenDiversity, DiversityThenFitness or Aggregative", 'C', "Evolution Engine").value();
|
||||
moeoComparator < MOEOT > * comparator;
|
||||
if (comparatorParam == string("FitnessThenDiversity"))
|
||||
if (comparatorParam == std::string("FitnessThenDiversity"))
|
||||
{
|
||||
comparator = new moeoFitnessThenDiversityComparator < MOEOT> ();
|
||||
}
|
||||
else if (comparatorParam == string("DiversityThenFitness"))
|
||||
else if (comparatorParam == std::string("DiversityThenFitness"))
|
||||
{
|
||||
comparator = new moeoDiversityThenFitnessComparator < MOEOT> ();
|
||||
}
|
||||
else if (comparatorParam == string("Aggregative"))
|
||||
else if (comparatorParam == std::string("Aggregative"))
|
||||
{
|
||||
comparator = new moeoAggregativeComparator < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid comparator strategy: ") + comparatorParam;
|
||||
std::string stmp = std::string("Invalid comparator strategy: ") + comparatorParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(comparator);
|
||||
|
|
@ -170,15 +179,15 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
"Selection scheme: DetTour(T), StochTour(t) or Random", 'S', "Evolution Engine");
|
||||
eoParamParamType & ppSelect = selectionParam.value();
|
||||
moeoSelectOne < MOEOT > * select;
|
||||
if (ppSelect.first == string("DetTour"))
|
||||
if (ppSelect.first == std::string("DetTour"))
|
||||
{
|
||||
unsigned tSize;
|
||||
unsigned int tSize;
|
||||
if (!ppSelect.second.size()) // no parameter added
|
||||
{
|
||||
cerr << "WARNING, no parameter passed to DetTour, using 2" << endl;
|
||||
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
||||
tSize = 2;
|
||||
// put back 2 in parameter for consistency (and status file)
|
||||
ppSelect.second.push_back(string("2"));
|
||||
ppSelect.second.push_back(std::string("2"));
|
||||
}
|
||||
else // parameter passed by user as DetTour(T)
|
||||
{
|
||||
|
|
@ -186,15 +195,15 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
}
|
||||
select = new moeoDetTournamentSelect < MOEOT > (*comparator, tSize);
|
||||
}
|
||||
else if (ppSelect.first == string("StochTour"))
|
||||
else if (ppSelect.first == std::string("StochTour"))
|
||||
{
|
||||
double tRate;
|
||||
if (!ppSelect.second.size()) // no parameter added
|
||||
{
|
||||
cerr << "WARNING, no parameter passed to StochTour, using 1" << endl;
|
||||
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
||||
tRate = 1;
|
||||
// put back 1 in parameter for consistency (and status file)
|
||||
ppSelect.second.push_back(string("1"));
|
||||
ppSelect.second.push_back(std::string("1"));
|
||||
}
|
||||
else // parameter passed by user as StochTour(T)
|
||||
{
|
||||
|
|
@ -209,37 +218,37 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
// ...
|
||||
}
|
||||
*/
|
||||
else if (ppSelect.first == string("Random"))
|
||||
else if (ppSelect.first == std::string("Random"))
|
||||
{
|
||||
select = new moeoRandomSelect <MOEOT > ();
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid selection strategy: ") + ppSelect.first;
|
||||
std::string stmp = std::string("Invalid selection strategy: ") + ppSelect.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(select);
|
||||
|
||||
|
||||
/* the replacement strategy */
|
||||
string & replacementParam = _parser.createParam(string("Elitist"), "replacement",
|
||||
std::string & replacementParam = _parser.createParam(std::string("Elitist"), "replacement",
|
||||
"Replacement scheme: Elitist, Environmental or Generational", 'R', "Evolution Engine").value();
|
||||
moeoReplacement < MOEOT > * replace;
|
||||
if (replacementParam == string("Elitist"))
|
||||
if (replacementParam == std::string("Elitist"))
|
||||
{
|
||||
replace = new moeoElitistReplacement < MOEOT> (*fitnessAssignment, *diversityAssignment, *comparator);
|
||||
}
|
||||
else if (replacementParam == string("Environmental"))
|
||||
else if (replacementParam == std::string("Environmental"))
|
||||
{
|
||||
replace = new moeoEnvironmentalReplacement < MOEOT> (*fitnessAssignment, *diversityAssignment, *comparator);
|
||||
}
|
||||
else if (replacementParam == string("Generational"))
|
||||
else if (replacementParam == std::string("Generational"))
|
||||
{
|
||||
replace = new moeoGenerationalReplacement < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid replacement strategy: ") + replacementParam;
|
||||
std::string stmp = std::string("Invalid replacement strategy: ") + replacementParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(replace);
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
#include <eoGenOp.h>
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
#include <moeoArchive.h>
|
||||
#include <moeoIndicatorBasedFitnessAssignment.h>
|
||||
#include <moeoLS.h>
|
||||
#include <moeoIndicatorBasedLS.h>
|
||||
#include <moeoIteratedIBMOLS.h>
|
||||
#include <algo/moeoIBMOLS.h>
|
||||
#include <algo/moeoIteratedIBMOLS.h>
|
||||
#include <algo/moeoLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <fitness/moeoIndicatorBasedFitnessAssignment.h>
|
||||
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
|
||||
#include <moeoMoveIncrEval.h>
|
||||
#include <move/moeoMoveIncrEval.h>
|
||||
|
||||
/**
|
||||
* This functions allows to build a moeoLS from the parser
|
||||
|
|
@ -56,10 +56,10 @@ moeoLS < MOEOT, eoPop<MOEOT> & > & do_make_ls_moeo (
|
|||
/* the objective vector type */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
/* the fitness assignment strategy */
|
||||
string & fitnessParam = _parser.getORcreateParam(string("IndicatorBased"), "fitness",
|
||||
std::string & fitnessParam = _parser.getORcreateParam(std::string("IndicatorBased"), "fitness",
|
||||
"Fitness assignment strategy parameter: IndicatorBased...", 'F',
|
||||
"Evolution Engine").value();
|
||||
string & indicatorParam = _parser.getORcreateParam(string("Epsilon"), "indicator",
|
||||
std::string & indicatorParam = _parser.getORcreateParam(std::string("Epsilon"), "indicator",
|
||||
"Binary indicator to use with the IndicatorBased assignment: Epsilon, Hypervolume", 'i',
|
||||
"Evolution Engine").value();
|
||||
double rho = _parser.getORcreateParam(1.1, "rho", "reference point for the hypervolume indicator",
|
||||
|
|
@ -67,49 +67,49 @@ moeoLS < MOEOT, eoPop<MOEOT> & > & do_make_ls_moeo (
|
|||
double kappa = _parser.getORcreateParam(0.05, "kappa", "Scaling factor kappa for IndicatorBased",
|
||||
'k', "Evolution Engine").value();
|
||||
moeoIndicatorBasedFitnessAssignment < MOEOT > * fitnessAssignment;
|
||||
if (fitnessParam == string("IndicatorBased"))
|
||||
if (fitnessParam == std::string("IndicatorBased"))
|
||||
{
|
||||
// metric
|
||||
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > *metric;
|
||||
if (indicatorParam == string("Epsilon"))
|
||||
if (indicatorParam == std::string("Epsilon"))
|
||||
{
|
||||
metric = new moeoAdditiveEpsilonBinaryMetric < ObjectiveVector >;
|
||||
}
|
||||
else if (indicatorParam == string("Hypervolume"))
|
||||
else if (indicatorParam == std::string("Hypervolume"))
|
||||
{
|
||||
metric = new moeoHypervolumeBinaryMetric < ObjectiveVector > (rho);
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid binary quality indicator: ") + indicatorParam;
|
||||
std::string stmp = std::string("Invalid binary quality indicator: ") + indicatorParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
fitnessAssignment = new moeoIndicatorBasedFitnessAssignment < MOEOT> (*metric, kappa);
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||
std::string stmp = std::string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(fitnessAssignment);
|
||||
// number of iterations
|
||||
unsigned n = _parser.getORcreateParam(1, "n", "Number of iterations for population Initialization", 'n', "Evolution Engine").value();
|
||||
unsigned int n = _parser.getORcreateParam(1, "n", "Number of iterations for population Initialization", 'n', "Evolution Engine").value();
|
||||
// LS
|
||||
string & lsParam = _parser.getORcreateParam(string("I-IBMOLS"), "ls",
|
||||
std::string & lsParam = _parser.getORcreateParam(std::string("I-IBMOLS"), "ls",
|
||||
"Local Search: IBMOLS, I-IBMOLS (Iterated-IBMOLS)...", 'L',
|
||||
"Evolution Engine").value();
|
||||
moeoLS < MOEOT, eoPop<MOEOT> & > * ls;
|
||||
if (lsParam == string("IBMOLS"))
|
||||
if (lsParam == std::string("IBMOLS"))
|
||||
{
|
||||
ls = new moeoIndicatorBasedLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue);;
|
||||
ls = new moeoIBMOLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue);;
|
||||
}
|
||||
else if (lsParam == string("I-IBMOLS"))
|
||||
else if (lsParam == std::string("I-IBMOLS"))
|
||||
{
|
||||
ls = new moeoIteratedIBMOLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue, _op, _opInit, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||
std::string stmp = std::string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(ls);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue