NSGA-II. More...

Inheritance diagram for NSGA2:

Public Member Functions

 NSGA2 ()
 Constructor.
 
virtual ~NSGA2 ()
 Destructor.
 
virtual void configure (ConfigurationParameters &params, QString prefix)
 Configure the object using the ConfigurationParameters specified.
 
virtual QVector< Evaluation * > evaluationPool ()
 Return the Evaluation Pool containing the Evaluations used.
 
virtual EvaluationevaluationPrototype ()
 Returns the Evaluation object used as prototype to eventually generate other evaluators.
 
virtual void finalize ()
 Finalize the Genetic Algorithm Process.
 
virtual void gaStep ()
 Execute a single minor step and return.
 
virtual void initialize ()
 Initializes the Genetic Algorithm Process and sets current generation to zero.
 
int numThreads ()
 Return the number of thread currently used.
 
Reproductionreproduction ()
 Return the Reproduction operator.
 
virtual void save (ConfigurationParameters &params, QString prefix)
 Save the actual status of parameters into the ConfigurationParameters object passed.
 
void setEvaluation (Evaluation *fitfunc)
 Set the fitness function to use.
 
void setNumThreads (int numThreads)
 Set the number of thread to use; or in other words the number of parallel evaluation of Genotypes.
 
void setReproduction (Reproduction *reproduct)
 Set the Reproduction operator to use.
 
virtual void skipEvaluation ()
 Skip the evaluation phase and put the algorithm in the state just after the evaluation.
 
- Public Member Functions inherited from GeneticAlgo
 GeneticAlgo ()
 Constructor.
 
virtual ~GeneticAlgo ()
 Destructor.
 
QVector< QVector< double > > averageFits () const
 Return the Average objective values over generation done.
 
QVector< QVector< double > > bestFits () const
 Return the Best objective values over generation done.
 
void evolve (unsigned int generationToReach)
 Evolve Genome until reach the generation specified.
 
void evolve ()
 Evolve Genome until condition isEvolutionEnded has been reached.
 
unsigned int generation () const
 Return the current generation number.
 
Genomegenome ()
 Return the current Genome.
 
const Genomegenome () const
 Return the current Genome.
 
bool isEvaluationDone ()
 returns true if we have evaluated genomes for the current generation
 
bool isEvolutionEnded ()
 returns true if the evolution process has reached the end
 
QVector< double > meanHammingDist () const
 Return the Mean of Hamming distance over generation done.
 
int numGenerations ()
 Return the number of Generations.
 
void setGeneration (unsigned int gen)
 Set the generation number.
 
void setGenome (Genome *gen)
 Set the Genome to use as current population.
 
void setNumGenerations (int g)
 Set the number of Generations to do.
 
QVector< double > standardDeviationHammingDist () const
 Return the Standard Deviation of Hamming distance over generation done.
 
QVector< double > varianceHammingDist () const
 Return the Variance of Hamming distance over generation done.
 
- Public Member Functions inherited from ParameterSettableWithConfigureFunction
void addObserver (RuntimeParameterObserver *obs)
 
getRuntimeParameter (QString paramName)
 
virtual ParameterSettableUIgetUIManager ()
 
 ParameterSettable ()
 
virtual void postConfigureInitialization ()
 
void removeObserver (RuntimeParameterObserver *obs)
 
void setRuntimeParameter (QString paramName, T newvalue)
 
QString typeName () const
 
- Public Member Functions inherited from ParameterSettable
void addObserver (RuntimeParameterObserver *obs)
 
getRuntimeParameter (QString paramName)
 
void removeObserver (RuntimeParameterObserver *obs)
 
void setRuntimeParameter (QString paramName, T newvalue)
 
QString typeName () const
 

Static Public Member Functions

static void describe (QString type)
 Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
 

Protected Types

enum  GAPhases {
  initEvaluation, evaluating, nextGeneration_pass1, nextGeneration_pass2,
  endEvolution
}
 used for manage GA cycle More...
 

Protected Attributes

GAPhases currPhase
 current Phase
 
Evaluationfitfunc
 fitness function
 
bool isFinalized
 True if SimpleGA is finalized.
 
bool isInitialized
 True if SimpleGA is initialized.
 
Reproductionreprod
 reproduction operator
 
- Protected Attributes inherited from GeneticAlgo
QVector< QVector< double > > avgfits
 Statistical Data: report the Average value for each objective for each generation.
 
QVector< QVector< double > > bestfits
 Statistical Data: report the Best value for each objective for each generation.
 
bool evaluationDone
 setted by implementors to signal that genomes have been evaluated
when true means that the genomes of the current generation have been evaluated (we are at the end of the end of the generation, next step will be reproduction and start of a new generation), when false means that genomes haven't still not been evaluated (we are at the beginning of a generation, next step will be evaluation of genomes)
 
bool evolutionEnd
 setted by implementors to signal the finish of evolution process
when true means that evolution is ended
 
unsigned int generationv
 current generation
 
Genomegenomev
 current genome
 
QVector< double > meanHdists
 Statistical Data: report the mean of all hamming distance between genotypes for each generation.
 
unsigned int numGens
 number of generations
 
QVector< double > stdHdists
 Statistical Data: report the standard variation of all hamming distance between genotypes for each generation.
 
QVector< double > varHdists
 Statistical Data: report the variance of all hamming distance between genotypes for each generation.
 

Additional Inherited Members

- Public Types inherited from ParameterSettableWithConfigureFunction
enum  Property
 
- Public Attributes inherited from ParameterSettableWithConfigureFunction
 AllowMultiple
 
 Default
 
 IsList
 
 IsMandatory
 
- Static Public Attributes inherited from ParameterSettableWithConfigureFunction
static const double Infinity
 
static const int MaxInteger
 
static const int MinInteger
 
- Protected Member Functions inherited from GeneticAlgo
void updateStats ()
 Update statistical data of current generation and Genome (Mean, Variance, Standard Deviation)
 
- Static Protected Member Functions inherited from ParameterSettableWithConfigureFunction
static Descriptor addTypeDescription (QString type, QString shortHelp, QString longHelp=QString(""))
 
static void setGraphicalEditor (QString type)
 

Detailed Description

NSGA-II.

Description
NSGA-II implements the Nondominated Sorting (multi-objective) Genetic Algorithm version 2
  • it use a multi-thread approach for parallel evaluation of Genotypes (see numThreads)
Warnings

Definition at line 43 of file nsga2.h.

Member Enumeration Documentation

enum GAPhases
protected

used for manage GA cycle

Definition at line 106 of file nsga2.h.

Constructor & Destructor Documentation

~NSGA2 ( )
virtual

Destructor.

Definition at line 45 of file nsga2.cpp.

References NSGA2::fitfunc.

Member Function Documentation

void configure ( ConfigurationParameters params,
QString  prefix 
)
virtual

Configure the object using the ConfigurationParameters specified.

Parameters
paramsthe object with configuration parameters
prefixthe group in which parameters are expected to be (this is terminated by a separator character). We expect to receive as prefix the groupwhich contains all GA parameters

Implements ParameterSettableWithConfigureFunction.

Definition at line 52 of file nsga2.cpp.

References NSGA2::fitfunc, GeneticAlgo::genome(), ConfigurationHelper::getInt(), ConfigurationParameters::getObjectFromGroup(), NSGA2::setEvaluation(), GeneticAlgo::setGenome(), Evaluation::setGenome(), GeneticAlgo::setNumGenerations(), NSGA2::setNumThreads(), and NSGA2::setReproduction().

QVector< Evaluation * > evaluationPool ( )
virtual

Return the Evaluation Pool containing the Evaluations used.

Implements GeneticAlgo.

Definition at line 110 of file nsga2.cpp.

Evaluation * evaluationPrototype ( )
virtual

Returns the Evaluation object used as prototype to eventually generate other evaluators.

This object could be or could be not used to compute the fitness of genotypes (depending on the specific genetic algorithm)

Implements GeneticAlgo.

Definition at line 105 of file nsga2.cpp.

References NSGA2::fitfunc.

void finalize ( )
virtual

Finalize the Genetic Algorithm Process.

Implements GeneticAlgo.

Definition at line 273 of file nsga2.cpp.

References GeneticAlgo::evolutionEnd, NSGA2::isFinalized, and NSGA2::isInitialized.

Referenced by NSGA2::gaStep().

void initialize ( )
virtual

Initializes the Genetic Algorithm Process and sets current generation to zero.

Implements GeneticAlgo.

Definition at line 127 of file nsga2.cpp.

References NSGA2::currPhase, GeneticAlgo::evaluationDone, GeneticAlgo::evolutionEnd, NSGA2::fitfunc, NSGA2::isFinalized, NSGA2::isInitialized, NSGA2::reprod, and GeneticAlgo::setGeneration().

int numThreads ( )

Return the number of thread currently used.

Definition at line 96 of file nsga2.cpp.

Referenced by NSGA2::save(), and NSGA2::setNumThreads().

Reproduction * reproduction ( )

Return the Reproduction operator.

Definition at line 123 of file nsga2.cpp.

References NSGA2::reprod.

Referenced by NSGA2::save().

void save ( ConfigurationParameters params,
QString  prefix 
)
virtual

Save the actual status of parameters into the ConfigurationParameters object passed.

Parameters
paramsthe configuration parameters object on which save actual parameters
prefixthe prefix to use to access the object configuration parameters.

Implements ParameterSettableWithConfigureFunction.

Definition at line 61 of file nsga2.cpp.

References ConfigurationParameters::createParameter(), ConfigurationParameters::createSubGroup(), NSGA2::fitfunc, GeneticAlgo::genome(), GeneticAlgo::numGenerations(), NSGA2::numThreads(), NSGA2::reproduction(), ParameterSettableWithConfigureFunction::save(), and Genome::save().

void setEvaluation ( Evaluation fitfunc)

Set the fitness function to use.

Definition at line 100 of file nsga2.cpp.

References NSGA2::fitfunc, and Evaluation::setGA().

Referenced by NSGA2::configure().

void setNumThreads ( int  numThreads)

Set the number of thread to use; or in other words the number of parallel evaluation of Genotypes.

Definition at line 82 of file nsga2.cpp.

References NSGA2::fitfunc, NSGA2::isFinalized, NSGA2::isInitialized, and NSGA2::numThreads().

Referenced by NSGA2::configure().

void setReproduction ( Reproduction reproduct)

Set the Reproduction operator to use.

Definition at line 118 of file nsga2.cpp.

References NSGA2::reprod, and Reproduction::setGA().

Referenced by NSGA2::configure().

void skipEvaluation ( )
virtual

Skip the evaluation phase and put the algorithm in the state just after the evaluation.

This can be used after restarting an interrupted evolution to prevent re-evaluation of the genome that was loaded from file.

Implements GeneticAlgo.

Definition at line 263 of file nsga2.cpp.

References NSGA2::currPhase, GeneticAlgo::evaluationDone, GeneticAlgo::generation(), and GeneticAlgo::numGens.

Member Data Documentation

GAPhases currPhase
protected

current Phase

Definition at line 108 of file nsga2.h.

Referenced by NSGA2::gaStep(), NSGA2::initialize(), NSGA2::NSGA2(), and NSGA2::skipEvaluation().

bool isFinalized
protected

True if SimpleGA is finalized.

Definition at line 112 of file nsga2.h.

Referenced by NSGA2::finalize(), NSGA2::initialize(), NSGA2::NSGA2(), and NSGA2::setNumThreads().

bool isInitialized
protected

True if SimpleGA is initialized.

Definition at line 110 of file nsga2.h.

Referenced by NSGA2::finalize(), NSGA2::initialize(), NSGA2::NSGA2(), and NSGA2::setNumThreads().

Reproduction* reprod
protected

reproduction operator

Definition at line 104 of file nsga2.h.

Referenced by NSGA2::gaStep(), NSGA2::initialize(), NSGA2::NSGA2(), NSGA2::reproduction(), and NSGA2::setReproduction().


The documentation for this class was generated from the following files: