Base class for the individuals in a Pareto optimization population. More...
#include <Individual.hpp>
Public Member Functions | |
Individual () | |
Create uninitialized; only for reading from stream very soon. | |
Individual (size_t numObjectives) | |
Create and initialize; should call this from derived constructor. | |
virtual Individual * | clone ()=0 |
Cloning can use the default copy constructor, but otherwise it is specific to the derived classes. | |
virtual void | evaluate ()=0 |
Evaluate objective functions. | |
virtual void | mutate ()=0 |
Apply evolutionary mutation operator(s). | |
virtual void | improve (mt19937 *mt)=0 |
Apply memetic improvement operator(s). | |
virtual pair< unique_ptr < Individual >, unique_ptr < Individual > > | crossWith (Individual &other)=0 |
Binary cross-over with another individual. | |
virtual int | getId () |
virtual void | setId (int id) |
virtual int | getRank () |
virtual void | setRank (int rank) |
virtual double | getCrowdingDistance () |
virtual void | setCrowdingDistance (double crowdingDistance) |
virtual double | getObjective (size_t index) |
virtual void | setObjective (size_t index, double value) |
virtual vector< double > | getTrace () |
Get measures that are interesting in post-run tracing; subclasses would know which measures are of importance. | |
virtual bool | winsTournamentAgainst (const Individual &opponent, mt19937 *mt) |
Returns true if this individual is better than another in the NSGA-II -sense, i.e., based on dominance, crowding distance within non-dominated solutions, and random selection in complete draws. | |
virtual void | fromStream (istream &ist) |
Replace contents with that read from an ASCII stream, for analysis or continuing a halted computation. | |
virtual void | toStream (ostream &ost) |
Write content to an ASCII stream, for result output and computation tracing. | |
Protected Member Functions | |
virtual void | impl_from_stream (istream &repr)=0 |
"Crowding" value/dist. (e.g. NSGA-II) | |
virtual void | impl_to_stream (ostream &repr)=0 |
Write the actual (concrete) representation to a stream. | |
Protected Attributes | |
int | _id |
int | _rank |
Running index or other ID tag. | |
vector< double > | _objectives |
Pareto rank within container pop. | |
double | _constraintViolation |
Objective function values. | |
double | _crowding |
Constraint violation. | |
Friends | |
int | checkDominance (const Individual &ind1, const Individual &ind2) |
Dominance comparison operation as in NSGA-II; returns 1 if ind1 dominates, -1 if ind2 dominates, and 0 upon mutual non-domination. |
Base class for the individuals in a Pareto optimization population.
Must be derived for concrete objective computations. This base class is an abstraction layer that does not care about internal representation or how to compute anything. Rather, this implements only the facilities for Pareto dominance handling and storage in the evolving population and in the total solution archive.
Individual::Individual | ( | ) | [inline] |
Create uninitialized; only for reading from stream very soon.
Individual::Individual | ( | size_t | numObjectives | ) |
Create and initialize; should call this from derived constructor.
virtual pair<unique_ptr<Individual>,unique_ptr<Individual> > Individual::crossWith | ( | Individual & | other | ) | [pure virtual] |
virtual void Individual::evaluate | ( | ) | [pure virtual] |
Evaluate objective functions.
Is to be called before getting values, if any operators have been applied. The concrete derived class must assign objective values when this is called.
Implemented in MlpIndividual.
vector< double > Individual::getTrace | ( | ) | [virtual] |
Get measures that are interesting in post-run tracing; subclasses would know which measures are of importance.
By default, the objectives are returned as a vector object.
Reimplemented in MlpIndividual.
virtual void Individual::impl_from_stream | ( | istream & | repr | ) | [protected, pure virtual] |
"Crowding" value/dist. (e.g. NSGA-II)
Read the actual (concrete) representation from a stream.
Implemented in MlpIndividual.
virtual void Individual::impl_to_stream | ( | ostream & | repr | ) | [protected, pure virtual] |
Write the actual (concrete) representation to a stream.
Implemented in MlpIndividual.
virtual void Individual::improve | ( | mt19937 * | mt | ) | [pure virtual] |
virtual void Individual::mutate | ( | ) | [pure virtual] |
void Individual::toStream | ( | ostream & | ost | ) | [virtual] |
Write content to an ASCII stream, for result output and computation tracing.
bool Individual::winsTournamentAgainst | ( | const Individual & | opponent, | |
mt19937 * | mt | |||
) | [virtual] |
Returns true if this individual is better than another in the NSGA-II -sense, i.e., based on dominance, crowding distance within non-dominated solutions, and random selection in complete draws.
Needs the source for random numbers to make the draw.