dignea
1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
|
Instance Generation Algorithm. Known as Meta-Evolutionary Algorithm (MapElites). This algorithm uses a Weighted Fitness Function (WFF) to evaluate how biased and diverse are the instances generated during the evolutionary process. The instances generated should be biased to the performance of the target algorithm in the portfolio but also should show some diversity between them. More...
#include <MapElites.h>
Public Types | |
using | Alg = AbstractEA< OS > |
using | Value = IS |
using | Grid = std::map< Key, Value > |
Public Types inherited from EIG< IP, IS, OP, OS > | |
using | Alg = AbstractEA< OS > |
Public Member Functions | |
MapElites () | |
Creates a default MapElites with only the evaluation as EasyInstances. More... | |
void | run () override |
Interface to run the MapElites for generating a set of instances for the optimisation problem defined (OP) More... | |
json | to_json () const override |
Creates the JSON representation of the MapElites. More... | |
string | getName () const override |
Get the name of the algorithm. More... | |
virtual Front< IS > | getResults () const override |
Returns a set of individuals as a result of the evolutionary method. The individual are instances for the OP. More... | |
void | setFeaturesInfo (const Features &f) |
Creates the pre-defined bins for each feature in the domain Creates the linspace with nBins different value for each feature. More... | |
Public Member Functions inherited from EIG< IP, IS, OP, OS > | |
EIG (const float &fitness=0.6f, const float &novelty=0.4f) | |
Construct a new EIG object using a fitness ratio of 0.6 and novelty of 0.4 by default. Use the EIGBuilder instead of the constructor for safe experimentation. More... | |
string | getID () const override |
Get the ID. Similar to getName. | |
const IP * | getInstanceProblem () const |
Get a raw pointer to the Instance Generation Problem. More... | |
void | setInstanceProblem (unique_ptr< IP > problem) |
Set the Instance Generation Problem. More... | |
vector< Alg * > | getPortfolio () const |
Get the portfolio of algorithms used in the evolutionary process. More... | |
void | setPortfolio (vector< unique_ptr< Alg >> &configs) |
Set the portfolio of algorithms to use in the evolutionary process. The order of the algorithms in the portfolio is crucial. Notice that the first algorithm in the portfolio will be considered the target and therefore the instances will be generated according to its performance. Also, it is important to know the order of the remaining algorithms in order to analysis the results obtained since not tags are included in the results at this moment. More... | |
float | getMutationRate () const |
Get the mutation rate used in EIG for mutation instances during the evolutionary process. More... | |
void | setMutationRate (float mRate) |
Set the mutation rate used in EIG for mutation instances during the evolutionary process. More... | |
float | getCrossoverRate () const |
Get the crossover rate used in EIG for applying the crossover operator to instances during the evolutionary process. More... | |
void | setCrossoverRate (float cRate) |
Set the crossover rate used in EIG for applying the crossover operator to instances during the evolutionary process. More... | |
int | getRepetitions () const |
Get the number of repetitions that each algorithm in the portfolio must perform over each instance at every generation of the EIG. More... | |
void | setRepetitions (int reps) |
Set the number of repetitions that each algorithm in the portfolio must perform over each instance at every generation of the EIG. Due to stochastic nature of most algorithms used in EIG the number of repetitions should vary between 10 to 30. For deterministic heuristics can be set to one. More... | |
Mutation< IS > * | getMutation () const |
Get the mutation operator used to mutate instances in EIG. More... | |
void | setMutation (unique_ptr< Mutation< IS >> mut) |
Set the mutation operator. Takes ownership of the pointer. More... | |
Crossover< IS > * | getCrossover () const |
Get the crossover operator used in EIG. More... | |
void | setCrossover (unique_ptr< Crossover< IS >> cx) |
Set the crossover operator. Takes ownership of the pointer. More... | |
Selection< IS > * | getSelection () const |
Get the selection operator. More... | |
void | setSelection (unique_ptr< Selection< IS >> sel) |
Set the selection operator. Takes ownership of the pointer. More... | |
void | setReplacement (unique_ptr< Replacement< IS >> rep) |
Set the selection operator. Takes ownership of the pointer. More... | |
InstanceFitness * | getEvaluation () const |
Get the evaluation approach for the instances. More... | |
void | setInstanceFitness (unique_ptr< InstanceFitness > eval) |
Set the evaluation approach for the instances. More... | |
int | getGenerations () |
Get the number of generations that EIG must perform. More... | |
const NoveltySearch< IS > * | getNoveltySearch () const |
Get the Novelty Search approach used in EIG. More... | |
void | setNoveltySearch (unique_ptr< NoveltySearch< IS >> noveltySearch) |
Set the Novelty Search approach to use. More... | |
void | setWeightedFunction (const float &fW, const float &nW) |
Set the weights to use in the WFF. More... | |
Public Member Functions inherited from AbstractEA< IS > | |
AbstractEA () | |
Construct a new Abstract EA object with default parameter values. More... | |
AbstractEA (const int &maxEvals, const int &popsize) | |
AbstractEA constructor which initialises the parameters maxEvalautions and populationSize. More... | |
AbstractEA (unique_ptr< PopulationEvaluator< IS >>, const int &maxEvals, const int &popsize) | |
AbstractEA constructor which initialises the parameters maxEvalautions, the populationSize and the evaluator approach. More... | |
int | getPopulationSize () const |
Get the population size. More... | |
void | setPopulationSize (int pSize) |
Setter to update the population size. More... | |
double | getElapsedTime () const |
Get the elapsed time of the evolutionary process. More... | |
const vector< IS > & | getPopulation () const |
Gets a reference of the population. More... | |
int | getMaxEvaluations () const |
Get the maximum number of evaluations to perform. More... | |
void | setMaxEvaluations (int maxEval) |
Set a new maximum number of evaluations to perform. More... | |
const Problem< IS > * | getProblem () const |
Gets a pointer to the problem which is being solved. More... | |
virtual void | setProblem (shared_ptr< Problem< IS >> prob) |
Set the new problem to solve. Uses a shared_ptr pointer which updates the reference counter. Does no take the ownership. More... | |
virtual void | setProblem (Problem< IS > *prob) |
Set the new problem to solve. Uses a raw pointer and takes the ownership of the object. More... | |
PopulationEvaluator< IS > * | getEvaluator () const |
Gets a pointer to the population evaluator system. More... | |
void | setEvaluator (unique_ptr< PopulationEvaluator< IS >> eval) |
Updates the population evaluator system with the unique_ptr. The method takes the ownership of the object behind. More... | |
int | getPerformedEvaluations () const |
Get the performed evaluations. More... | |
void | setPerformedEvaluations (int pEvals) |
Set the Performed Evaluations. Useful for the updateProgress method. More... | |
void | setPopulation (const vector< IS > &pop) |
Set the Population. More... | |
virtual Evolution< IS > | getEvolution () const |
Get the Evolution data. More... | |
int | getPrintingInterval () const |
Get the interval of checkpoints. More... | |
Protected Member Functions | |
void | createInitialPopulation () override |
Creates a initial population of Problem Instances of the OP type. Uses the IP method "createSolutions". More... | |
void | evaluatePopulation (vector< IS > &individuals) override |
Evaluates the population of individuals with all the algorithms in the portfolio. More... | |
Protected Member Functions inherited from EIG< IP, IS, OP, OS > | |
void | initProgress () override |
Initialises the number of generations performed to 0. More... | |
void | updateProgress () override |
Updates the evolution by increasing the number of generations performed. More... | |
void | finishProgress () override |
Finishes the execution of the EIG. More... | |
bool | isStoppingConditionReached () override |
Checks whether the number of performed generations has reached the maximum allowed. More... | |
void | evaluateIndividual (IS &individual) |
Evaluates the given IS with all the algorithms in the porftolio. More... | |
virtual void | evaluationPhase (vector< IS > &individuals) |
Evaluation phase of the EIG All the stages necessary to evaluated the population of individuals are performed from this method. More... | |
virtual void | reproduction (IS &solution, IS &solution2) |
Executes the genetic operator over two instances to generate new individuals. More... | |
virtual void | replacement (vector< IS > &individuals) |
Replacement method for the population. In this case, the replacement is a simple generational approach, which also includes the comparison of individuals with the archive and the feature set of the NS. More... | |
virtual void | updateEvolution (vector< IS > &solutions) |
Updates the evolution results of the algorithm for the given checkpoint. More... | |
Protected Member Functions inherited from AbstractEA< IS > | |
virtual void | updateEvolution (vector< IS > &pop) |
virtual void | updateEvolution (const int &checkpoint, vector< IS > &) |
Additional Inherited Members | |
Static Public Attributes inherited from AbstractEA< IS > | |
static const int | DEFAULT_POPULATION_SIZE |
Default population size equal to 100 individuals. More... | |
static const int | DEFAULT_EVALUATIONS_LIMIT |
Default evaluation limit equal to 100000 evaluations. More... | |
static const std::string | NAME |
static const std::string | MAX_EVALUATIONS |
static const std::string | POP_SIZE |
static const std::string | ELAPSED_TIME |
static const std::string | EVALUATOR |
static const int | EVOLUTION_SIZE |
Protected Attributes inherited from EIG< IP, IS, OP, OS > | |
unique_ptr< IP > | instProb |
vector< unique_ptr< Alg > > | algPortfolio |
unique_ptr< Mutation< IS > > | mutation |
unique_ptr< Crossover< IS > > | crossover |
unique_ptr< Selection< IS > > | selection |
unique_ptr< Replacement< IS > > | repOperator |
float | mutationRate |
float | crossoverRate |
int | repetitions |
unique_ptr< NoveltySearch< IS > > | noveltySearch |
unique_ptr< InstanceFitness > | instanceFitness |
unique_ptr< Weighted< IS > > | weightedFitness |
AverageFitness< OS > | averageFitness |
BestFitness< OS > | bestFitness |
Protected Attributes inherited from AbstractEA< IS > | |
int | maxEvaluations |
int | performedEvaluations |
int | populationSize |
vector< IS > | population |
shared_ptr< Problem< IS > > | problem |
unique_ptr< PopulationEvaluator< IS > > | evaluator |
Evolution< IS > | evolution |
AvgEvolution< IS > | avgEvolution |
std::chrono::system_clock::time_point | startTime |
std::chrono::system_clock::time_point | endTime |
double | elapsedTime |
int | nextCheckpoint |
int | evolutionInterval |
Instance Generation Algorithm. Known as Meta-Evolutionary Algorithm (MapElites). This algorithm uses a Weighted Fitness Function (WFF) to evaluate how biased and diverse are the instances generated during the evolutionary process. The instances generated should be biased to the performance of the target algorithm in the portfolio but also should show some diversity between them.
using MapElites< IP, IS, OP, OS >::Alg = AbstractEA<OS> |
Acronym for an AbstractEA<OS>
MapElites< IP, IS, OP, OS >::MapElites |
Creates a default MapElites with only the evaluation as EasyInstances.
|
overrideprotectedvirtual |
Creates a initial population of Problem Instances of the OP type. Uses the IP method "createSolutions".
IP | Type of Instance Problem to toSolve |
IS | Type of instances of the Optimisation Problem |
OP | Optimisation problem to toSolve with the configurations |
OS | Solutions to the OP type |
Reimplemented from EIG< IP, IS, OP, OS >.
|
overrideprotectedvirtual |
Evaluates the population of individuals with all the algorithms in the portfolio.
IP | Type of Instance Problem to toSolve |
IS | Type of instances of the Optimisation Problem |
OP | Optimisation problem to toSolve with the configurations |
OS | Solutions to the OP type |
individuals | Population of IS to evaluate using the configurations |
Reimplemented from EIG< IP, IS, OP, OS >.
|
inlineoverridevirtual |
Get the name of the algorithm.
Reimplemented from EIG< IP, IS, OP, OS >.
|
overridevirtual |
Returns a set of individuals as a result of the evolutionary method. The individual are instances for the OP.
IP | Type of Instance Problem to toSolve |
IS | Type of instances of the Optimisation Problem |
OP | Optimisation problem to toSolve with the configurations |
OS | Solutions to the OP type |
Reimplemented from EIG< IP, IS, OP, OS >.
|
overridevirtual |
Interface to run the MapElites for generating a set of instances for the optimisation problem defined (OP)
IP | Type of Instance Problem to toSolve |
IS | Type of instances of the Optimisation Problem |
OP | Optimisation problem to toSolve with the configurations |
OS | Solutions to the OP type |
Reimplemented from EIG< IP, IS, OP, OS >.
void MapElites< IP, IS, OP, OS >::setFeaturesInfo | ( | const Features & | f | ) |
Creates the pre-defined bins for each feature in the domain Creates the linspace with nBins different value for each feature.
IP | |
IS | |
OP | |
OS |
individuals |
|
overridevirtual |
Creates the JSON representation of the MapElites.
IP | Type of Instance Problem to toSolve |
IS | Type of instances of the Optimisation Problem |
OP | Optimisation problem to toSolve with the configurations |
OS | Solutions to the OP type |
Reimplemented from EIG< IP, IS, OP, OS >.