Stores the individuals (solutions). More...
#include <populationreal.h>
Public Member Functions | |
PopulationReal (Random *random, unsigned int max, unsigned int pob) | |
virtual void | reset (DomainRealPtr domain, int init=-1) |
void | removeWorses (void) |
void | random (void) |
void | sort (void) |
tIndividualReal * | getInd (unsigned int pos) |
void | replace (int pos, const tIndividualReal *ind) |
void | append (tIndividualReal *ind) |
void | change (unsigned int pos, const tChromosomeReal &sol, tFitness fitness) |
void | replace (unsigned pos, tIndividualRealPtr newind) |
unsigned | getBest (void) |
tFitness | getMedian (void) |
tFitness | getMean (void) |
void | getPercentils (double *percen, unsigned num) |
vector< unsigned > | getBests (unsigned num) |
unsigned | getWorst (void) |
unsigned | size (void) |
unsigned | ndim (void) |
void | eval (IEvalInd *fitness, unsigned newevals=-1) |
void | setObserver (PopulationObserver *observer) |
virtual tIndividualReal * | getInstance (tChromosomeReal &crom, tFitness fitness) |
virtual tIndividualReal * | getInstance (tChromosomeReal &crom) |
Protected Member Functions | |
void | notifyObservers (unsigned id) |
Stores the individuals (solutions).
Stores a group of individuals (its size m_minsize is fixed, but a temporal greater number m_aditionalsize is allowed)
Definition at line 44 of file populationreal.h.
PopulationReal::PopulationReal | ( | Random * | random, | |
unsigned int | max, | |||
unsigned int | pob | |||
) |
Constructor.
random | generator of the population | |
max | maximum population size. | |
pob | normal population size. |
Definition at line 37 of file populationreal.cc.
void PopulationReal::append | ( | tIndividualReal * | ind | ) |
Append a new individual
ind | new individual |
Definition at line 264 of file populationreal.cc.
void PopulationReal::change | ( | unsigned int | pos, | |
const tChromosomeReal & | sol, | |||
tFitness | fitness | |||
) |
change the current position with individual sol
Definition at line 273 of file populationreal.cc.
void PopulationReal::eval | ( | IEvalInd * | fitness, | |
unsigned | newevals = -1 | |||
) |
The current new individuals are evaluated.
fitness | Fitness class. | |
neweval | maximum new evaluations (-1 not limit) |
Definition at line 380 of file populationreal.cc.
unsigned PopulationReal::getBest | ( | void | ) |
Definition at line 279 of file populationreal.cc.
vector< unsigned > PopulationReal::getBests | ( | unsigned | num | ) |
num | the number of best individuals to return. (if num == 1 it is equals that call to getBest) |
Definition at line 329 of file populationreal.cc.
tIndividualReal * PopulationReal::getInd | ( | unsigned int | pos | ) |
pos | the position |
Definition at line 253 of file populationreal.cc.
tIndividualReal * PopulationReal::getInstance | ( | tChromosomeReal & | crom | ) | [virtual] |
get a new instance of a chromosome
Definition at line 112 of file populationreal.cc.
tIndividualReal * PopulationReal::getInstance | ( | tChromosomeReal & | crom, | |
tFitness | fitness | |||
) | [virtual] |
get a new instance of a chromosome
Definition at line 116 of file populationreal.cc.
tFitness PopulationReal::getMean | ( | void | ) |
Definition at line 441 of file populationreal.cc.
tFitness PopulationReal::getMedian | ( | void | ) |
Definition at line 454 of file populationreal.cc.
void PopulationReal::getPercentils | ( | double * | percen, | |
unsigned | num | |||
) |
Obtain the difference percentiles (useful to test the behaviour population
Definition at line 470 of file populationreal.cc.
unsigned PopulationReal::getWorst | ( | void | ) |
Definition at line 344 of file populationreal.cc.
unsigned PopulationReal::ndim | ( | void | ) |
Definition at line 405 of file populationreal.cc.
void PopulationReal::notifyObservers | ( | unsigned | id | ) | [protected] |
Update the identifications of a specific individual
id | individual id to notify |
Definition at line 154 of file populationreal.cc.
void PopulationReal::random | ( | void | ) |
Orders randomly the individuals
Definition at line 232 of file populationreal.cc.
void PopulationReal::removeWorses | ( | void | ) |
Removes the (m_aditionalsize - m_minsize) worse individuals.
Definition at line 219 of file populationreal.cc.
void PopulationReal::replace | ( | unsigned | pos, | |
tIndividualRealPtr | newind | |||
) |
Este método permite reemplazar un individuo de la población por un nuevo individuo
Definition at line 410 of file populationreal.cc.
void realea::PopulationReal::replace | ( | int | pos, | |
const tIndividualReal * | ind | |||
) |
Replaces the current individual in position pos with new individual real
pos | of the current individual to be removed (> 0 <= size()) | |
ind | new individual to be inserted |
void PopulationReal::reset | ( | DomainRealPtr | domain, | |
int | init = -1 | |||
) | [virtual] |
Reset the population size randomly.
domain | domain of individuals. | |
init | the begin position of individuals to be restarted. (init = -1 does not keep anyone. init == x keep the individual) |
Definition at line 67 of file populationreal.cc.
void PopulationReal::setObserver | ( | PopulationObserver * | observer | ) |
add Observer
Definition at line 33 of file populationreal.cc.
unsigned PopulationReal::size | ( | void | ) |
Definition at line 397 of file populationreal.cc.
void PopulationReal::sort | ( | void | ) |
Sorts the individuals in function of its fitness
Definition at line 176 of file populationreal.cc.