NSGA2 Class Reference
NSGA-II. More...

Classes | |
class | evaluationThread |
class | nObjectiveGreaterThan |
Utility class for generating a function for comparing genotype of an objective. | |
class | nsgaGenotype |
For implementing NSGA-II each genotype needs three more attributes necessary for the crowding distance calculation and sorting This class is a simple holder for such attributes. | |
Public Member Functions | |
NSGA2 () | |
Constructor. | |
virtual | ~NSGA2 () |
Destructor. | |
virtual void | configure (ConfigurationParameters ¶ms, QString prefix) |
Configure the object using the ConfigurationParameters specified. | |
virtual QVector< Evaluation * > | evaluationPool () |
Return the Evaluation Pool containing the Evaluations used. | |
virtual Evaluation * | evaluationPrototype () |
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. | |
Reproduction * | reproduction () |
Return the Reproduction operator. | |
virtual void | save (ConfigurationParameters ¶ms, 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. | |
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 | |
Evaluation * | fitfunc |
fitness function | |
bool | isFinalized |
True if SimpleGA is finalized. | |
bool | isInitialized |
True if SimpleGA is initialized. | |
Reproduction * | reprod |
reproduction operator |
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
Member Enumeration Documentation
Constructor & Destructor Documentation
NSGA2 | ( | ) |
Constructor.
Definition at line 33 of file nsga2.cpp.
References NSGA2::currPhase, NSGA2::fitfunc, NSGA2::isFinalized, NSGA2::isInitialized, GeneticAlgo::numGens, and NSGA2::reprod.
~NSGA2 | ( | ) | [virtual] |
Member Function Documentation
void configure | ( | ConfigurationParameters & | params, |
QString | prefix | ||
) | [virtual] |
Configure the object using the ConfigurationParameters specified.
- Parameters:
-
params the object with configuration parameters prefix the 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 51 of file nsga2.cpp.
References NSGA2::fitfunc, GeneticAlgo::genome(), ConfigurationParameters::getObjectFromGroup(), ConfigurationParameters::getValue(), GeneticAlgo::numGenerations(), NSGA2::setEvaluation(), Evaluation::setGenome(), GeneticAlgo::setGenome(), GeneticAlgo::setNumGenerations(), NSGA2::setNumThreads(), and NSGA2::setReproduction().
void describe | ( | QString | type | ) | [static] |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Reimplemented from ParameterSettable.
Definition at line 75 of file nsga2.cpp.
References ParameterSettable::addTypeDescription(), ParameterSettable::IntDescriptor::def(), ParameterSettable::Descriptor::describeInt(), ParameterSettable::Descriptor::describeSubgroup(), ParameterSettable::SubgroupDescriptor::help(), ParameterSettable::IntDescriptor::help(), ParameterSettable::IsMandatory, ParameterSettable::IntDescriptor::limits(), ParameterSettable::SubgroupDescriptor::props(), and ParameterSettable::SubgroupDescriptor::type().
QVector< Evaluation * > evaluationPool | ( | ) | [virtual] |
Return the Evaluation Pool containing the Evaluations used.
Implements GeneticAlgo.
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 107 of file nsga2.cpp.
References NSGA2::fitfunc.
void finalize | ( | ) | [virtual] |
Finalize the Genetic Algorithm Process.
Implements GeneticAlgo.
Definition at line 268 of file nsga2.cpp.
References GeneticAlgo::evolutionEnd, NSGA2::isFinalized, and NSGA2::isInitialized.
Referenced by NSGA2::gaStep().
void gaStep | ( | ) | [virtual] |
Execute a single minor step and return.
Implements GeneticAlgo.
Definition at line 156 of file nsga2.cpp.
References Genome::at(), NSGA2::currPhase, GeneticAlgo::evaluationDone, NSGA2::finalize(), NSGA2::fitfunc, GeneticAlgo::generation(), GeneticAlgo::genome(), GeneticAlgo::numGens, NSGA2::reprod, Reproduction::reproduction(), Genome::set(), GeneticAlgo::setGeneration(), Evaluation::setGenome(), GeneticAlgo::setGenome(), Genome::size(), and GeneticAlgo::updateStats().
void initialize | ( | ) | [virtual] |
Initializes the Genetic Algorithm Process and sets current generation to zero.
Implements GeneticAlgo.
Definition at line 129 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 98 of file nsga2.cpp.
Referenced by NSGA2::save(), and NSGA2::setNumThreads().
Reproduction * reproduction | ( | ) |
Return the Reproduction operator.
Definition at line 125 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:
-
params the configuration parameters object on which save actual parameters prefix the prefix to use to access the object configuration parameters.
Implements ParameterSettable.
Definition at line 63 of file nsga2.cpp.
References ConfigurationParameters::createParameter(), ConfigurationParameters::createSubGroup(), NSGA2::fitfunc, GeneticAlgo::genome(), GeneticAlgo::numGenerations(), NSGA2::numThreads(), NSGA2::reproduction(), Genome::save(), and ParameterSettable::save().
void setEvaluation | ( | Evaluation * | fitfunc | ) |
Set the fitness function to use.
Definition at line 102 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 84 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 120 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 258 of file nsga2.cpp.
References NSGA2::currPhase, GeneticAlgo::evaluationDone, GeneticAlgo::generation(), and GeneticAlgo::numGens.
Member Data Documentation
current Phase
Definition at line 108 of file nsga2.h.
Referenced by NSGA2::gaStep(), NSGA2::initialize(), NSGA2::NSGA2(), and NSGA2::skipEvaluation().
Evaluation* fitfunc [protected] |
fitness function
Definition at line 102 of file nsga2.h.
Referenced by NSGA2::configure(), NSGA2::evaluationPrototype(), NSGA2::gaStep(), NSGA2::initialize(), NSGA2::NSGA2(), NSGA2::save(), NSGA2::setEvaluation(), NSGA2::setNumThreads(), and NSGA2::~NSGA2().
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: