GPLIB++
|
Implements a genetic algorithm based on the concept of pareto-optimality, best suited for multi-objective problems. More...
#include <ParetoGA.h>
Public Member Functions | |
unsigned virtual int | GetNBestmodels () |
Return the size of the pareto-optimal front. More... | |
virtual std::vector< int > | GetBestModelIndices () |
Get the indices of the models within the Pareto front. More... | |
virtual void | CalcProbabilities (const int iterationnumber, gplib::rmat &LocalMisFit, GeneralPopulation &LocalPopulation) |
Calculate the probabilities of reproduction by ranking the population. More... | |
void | PrintRanks (std::ostream &output) |
Write the population by ranks to the stream output. More... | |
void | PrintFront (std::ostream &output) |
Write the models in the pareto-optimal front to stream output. More... | |
ParetoGA (GeneralPropagation *const LocalPropagation, GeneralPopulation *const LocalPopulation, GeneralTranscribe *const LocalTranscribe, const tObjectiveVector &IndObjective, const int nthreads=1) | |
The constructor needs other classes that determine the behaviour of the GA. More... | |
virtual | ~ParetoGA () |
Public Member Functions inherited from gplib::GeneralGA | |
const std::vector< double > & | GetWeights () |
Return the weight for each objecive function. More... | |
void | SetupParams (const ttranscribed &member, tparamvector ¶ms) |
Copy the appropriate parameter values from the transcribed vector for use with the objective functions. More... | |
const std::vector< double > & | GetAvgFit () |
Return the average fitness for each objective function. More... | |
void | SetElitist (const bool IsElitist) |
Do we want elitist behaviour, effect depends on the GA implementetion in the derived class. More... | |
void | SetWeights (const std::vector< double > &LocalWeights) |
Set the weights for each objective function. More... | |
void | SetParameterIndices (const tparamindv &Indices) |
Configure which parts of the complete parameter vector are used in each objective function. More... | |
void | PrintFitStat (std::ostream &output) |
Print Fitness statistics for each objective function to output. More... | |
void | PrintMisfit (std::ostream &output) |
Print misfit for each member to output. More... | |
void | PrintTranscribed (std::ostream &output) |
Print transcribed values for each member to output. More... | |
void | PrintUniquePop (std::ostream &output) |
Print each population member exactly once. More... | |
void | PrintBestMisfit (std::ostream &output) |
Print misfit of the best population members. More... | |
virtual void | DoIteration (const int iterationnumber, const bool last) |
Do one iteration of the GA. More... | |
GeneralGA (GeneralPropagation *const LocalPropagation, GeneralPopulation *const LocalPopulation, GeneralTranscribe *const LocalTranscribe, const tObjectiveVector &IndObjective, const int nthreads=1) | |
virtual | ~GeneralGA () |
Protected Member Functions | |
virtual void | Elitism (const int iterationnumber) |
The function Elitism ensures that the best models are preserved after mutation and crossover. More... | |
Additional Inherited Members | |
Public Types inherited from gplib::GeneralGA | |
typedef std::vector< gplib::rvec > | tparamvector |
We provide some typedefs that are used in other parts as well. More... | |
typedef std::vector < boost::shared_ptr < GeneralObjective > > | tObjectiveVector |
typedef std::vector < std::vector< int > > | tparamindv |
Protected Attributes inherited from gplib::GeneralGA | |
gplib::rmat | OldMisFit |
const unsigned int | nobjective |
The number of objective functions we're using. More... | |
gplib::rmat | Transcribed |
A matrix holding the numerical model vectors (transcribed from the genes) for each population member. More... | |
gplib::rmat | MisFit |
Misfit first index objective function second index population member. More... | |
tObjectiveVector | Objective |
The vector holding the objective functions. More... | |
GeneralPropagation *const | Propagation |
A pointer to an object dealing with propagation. More... | |
GeneralPopulation *const | Population |
A pointer to an object holding the population. More... | |
GeneralTranscribe *const | Transcribe |
A pointer to an object translating genes to model vectors. More... | |
Implements a genetic algorithm based on the concept of pareto-optimality, best suited for multi-objective problems.
The class ParetoGA implements a variant of NSGA-II by Deb et al.: Deb, K., Pratap. A, Agarwal, S., and Meyarivan, T. (2002). A fast and elitist multi-objective genetic algorithm: NSGA-II. IEEE Transaction on Evolutionary Computation, 6(2), 181-197.
Definition at line 17 of file ParetoGA.h.
|
inline |
The constructor needs other classes that determine the behaviour of the GA.
Definition at line 47 of file ParetoGA.h.
|
virtual |
Definition at line 239 of file ParetoGA.cpp.
|
virtual |
Calculate the probabilities of reproduction by ranking the population.
Implements gplib::GeneralGA.
Definition at line 89 of file ParetoGA.cpp.
References gplib::GeneralPopulation::GetPopsize(), gplib::GeneralPopulation::SetProbabilities(), and size.
|
protectedvirtual |
The function Elitism ensures that the best models are preserved after mutation and crossover.
Reimplemented from gplib::GeneralGA.
Definition at line 162 of file ParetoGA.cpp.
|
inlinevirtual |
Get the indices of the models within the Pareto front.
Implements gplib::GeneralGA.
Definition at line 35 of file ParetoGA.h.
|
inlinevirtual |
Return the size of the pareto-optimal front.
Implements gplib::GeneralGA.
Definition at line 30 of file ParetoGA.h.
void gplib::ParetoGA::PrintFront | ( | std::ostream & | output | ) |
Write the models in the pareto-optimal front to stream output.
Definition at line 226 of file ParetoGA.cpp.
void gplib::ParetoGA::PrintRanks | ( | std::ostream & | output | ) |
Write the population by ranks to the stream output.
Definition at line 208 of file ParetoGA.cpp.