#include <SIG_GPPopulation.h>
Public Methods | |
SIG_GPPopulation () | |
The constructor of a population, which builds an empty pool with default value initialisation. More... | |
SIG_GPPopulation (int size) | |
The constructor of a population, which builds a pool with a number of randomly created individuals. More... | |
SIG_GPPopulation (int size, SIGEL_Tools::SIG_Randomizer &r, SIGEL_GP::SIG_GPParameter& param, SIGEL_Robot::SIG_LanguageParameters& languageP) | |
This constructor should be the STANDARD constructor to create a pupoluation consisting of a number of SIZE individuals. More... | |
SIG_GPPopulation (QString data) | |
The constructor of an population, which is constructed from a QString. More... | |
~SIG_GPPopulation () | |
The destructor of a population object. More... | |
void | sort () |
The operation sorts the pool, due to the value of the fitness of the individuals. More... | |
SIG_GPIndividual& | getIndividual (int poolpos) |
This operation returns an individual, which is placed in the population on position poolpos. More... | |
void | setIndividual (SIG_GPIndividual& indi, int poolpos) |
This operation sets an individual to the demanded position in the population. More... | |
int | getSize () |
This operation returns the number of individuals, which are members of the population. More... | |
QString | getNextIdentifier () |
This operation returns the name for the next new individual. More... | |
void | setNextIdentifier (QString identifier) |
This operation sets a new identifier for an experiment. More... | |
int | getPoolGeneration () |
This operation returns the number of generations of the population, or how long the pool exists. More... | |
void | loadPool (QTextStream & pool) |
This operation accepts a qtextstream is an input, to build a new population. More... | |
void | savePool (QTextStream & pool) |
This operation returns a qtextstream, in which the data of the population is encoded. More... | |
SIG_GPPopulation (int size, SIGEL_Tools::SIG_Randomizer &r) | |
This constructor creates a population that contains a number of randomly created individuals. More... | |
SIGEL_GP::SIG_GPIndividual* | getIndividualPointer (int poolpos) |
This function returns the pointer to an individual. More... | |
void | deleteIndividual (int poolpos) |
This function deletes an individual. More... | |
void | setPoolGeneration (int pGen) |
This function sets the generation number of a pool. More... | |
void | setRandomizer (SIGEL_Tools::SIG_Randomizer *r) |
This function sets a randomizer for all random operations. More... | |
SIGEL_Tools::SIG_Randomizer | getRandomizer () |
This function returns the pointer of the randomizer all random operations are connected with. More... | |
SIGEL_Tools::SIG_Randomizer* | getRandomizerPointer () |
This function is obsolete (and will be deleted later). More... | |
void | readFromFile (QTextStream &file) |
This function writes a complete population (including all individuals and their programs) to a text stream. More... | |
void | writeToFile (QTextStream &file) |
This function reads a complete population out of a given text stream. More... | |
void | addRandomIndividuals (int quantity, SIGEL_GP::SIG_GPParameter& param, SIGEL_Robot::SIG_LanguageParameters& languageP) |
This operation adds randomly created individuals to the pool. More... | |
double | getBestFitness (bool high) |
This function searches for the best fitness within the population. More... | |
double | getWorstFitness (bool high) |
double | getAverageFitness () |
void | resetPool () |
void | importNewIndividual ( QString& filename ) |
This function imports a new individual. More... | |
Public Attributes | |
QString | nextIdentifier |
This attribute contains the next free name for a new individual. More... | |
int | poolGeneration |
The value, which indicates how old a population is. More... | |
Private Attributes | |
QVector<SIG_GPIndividual> | pool |
This is the main datastructure in the SIG_GPPopulation. More... | |
SIGEL_Tools::SIG_Randomizer* | randomizer |
The is a refernce of the SIG_Randomizer object of the GPManager. More... |
It uses the randomizer for the randomly creation of new individuals. The name of an new individual can be taken from the attribute nextidentifier, which contains the continuos name for new individuals. There are also other operations like sort, which sorts the pool.
Definition at line 26 of file SIG_GPPopulation.h.
|
The constructor of a population, which builds an empty pool with default value initialisation.
Definition at line 7 of file SIG_GPPopulation.cpp. |
|
The constructor of a population, which builds a pool with a number of randomly created individuals.
Definition at line 16 of file SIG_GPPopulation.cpp. |
|
This constructor should be the STANDARD constructor to create a pupoluation consisting of a number of SIZE individuals. All individuals are created as defined in the language and GP parameters.
Definition at line 60 of file SIG_GPPopulation.cpp. |
|
The constructor of an population, which is constructed from a QString.
Definition at line 39 of file SIG_GPPopulation.cpp. |
|
The destructor of a population object.
Definition at line 95 of file SIG_GPPopulation.cpp. |
|
This constructor creates a population that contains a number of randomly created individuals.
Definition at line 80 of file SIG_GPPopulation.cpp. |
|
This operation adds randomly created individuals to the pool. First the individuals are created and than they are appended to the population of the current experiment.
Definition at line 140 of file SIG_GPPopulation.cpp. |
|
This function deletes an individual.
Definition at line 230 of file SIG_GPPopulation.cpp. |
|
Definition at line 471 of file SIG_GPPopulation.cpp. |
|
This function searches for the best fitness within the population. It returns the best found fitness and the position of the intdividual the fitness belongs to. HIGH = TRUE defines a high fitness to be a better fitness. Vice versa, HIGH=FALSE defines a low fitness to be better fitness. Definition at line 421 of file SIG_GPPopulation.cpp. |
|
This operation returns an individual, which is placed in the population on position poolpos.
Definition at line 116 of file SIG_GPPopulation.cpp. |
|
This function returns the pointer to an individual.
Definition at line 225 of file SIG_GPPopulation.cpp. Referenced by SIG_GPPopulation(), addRandomIndividuals(), deleteIndividual(), getBestFitness(), readFromFile(), and writeToFile(). |
|
This operation returns the name for the next new individual. The individual names are continous and so, it is necessary to controll the name giver operation to ensure that the right names for new individuals are taken.
Definition at line 187 of file SIG_GPPopulation.cpp. Referenced by addRandomIndividuals(), and importNewIndividual(). |
|
This operation returns the number of generations of the population, or how long the pool exists.
Definition at line 203 of file SIG_GPPopulation.cpp. Referenced by writeToFile(). |
|
This function returns the pointer of the randomizer all random operations are connected with.
Definition at line 255 of file SIG_GPPopulation.cpp. |
|
This function is obsolete (and will be deleted later).
Definition at line 260 of file SIG_GPPopulation.cpp. Referenced by SIG_GPPopulation(), and addRandomIndividuals(). |
|
This operation returns the number of individuals, which are members of the population.
Definition at line 181 of file SIG_GPPopulation.cpp. Referenced by SIG_GPPopulation(), addRandomIndividuals(), deleteIndividual(), getBestFitness(), getIndividual(), importNewIndividual(), readFromFile(), and writeToFile(). |
|
Definition at line 449 of file SIG_GPPopulation.cpp. |
|
This function imports a new individual. A new individual will be created automatically before. Hence, the population size will be increased. Definition at line 265 of file SIG_GPPopulation.cpp. |
|
This operation accepts a qtextstream is an input, to build a new population.
Definition at line 213 of file SIG_GPPopulation.cpp. |
|
This function writes a complete population (including all individuals and their programs) to a text stream.
Definition at line 280 of file SIG_GPPopulation.cpp. Referenced by SIG_GPPopulation(), and loadPool(). |
|
Definition at line 443 of file SIG_GPPopulation.cpp. |
|
This operation returns a qtextstream, in which the data of the population is encoded.
Definition at line 219 of file SIG_GPPopulation.cpp. |
|
This operation sets an individual to the demanded position in the population.
Definition at line 131 of file SIG_GPPopulation.cpp. |
|
This operation sets a new identifier for an experiment. The operation is usefull in the terms of creating a new experiment.
Definition at line 198 of file SIG_GPPopulation.cpp. Referenced by SIG_GPPopulation(), and readFromFile(). |
|
This function sets the generation number of a pool.
Definition at line 208 of file SIG_GPPopulation.cpp. Referenced by SIG_GPPopulation(), and readFromFile(). |
|
This function sets a randomizer for all random operations.
Definition at line 249 of file SIG_GPPopulation.cpp. Referenced by SIG_GPPopulation(). |
|
The operation sorts the pool, due to the value of the fitness of the individuals. The individuals with the highest fitness value is placed on top of the pool, which means position zero, and so on.
Definition at line 109 of file SIG_GPPopulation.cpp. |
|
This function reads a complete population out of a given text stream.
Definition at line 393 of file SIG_GPPopulation.cpp. Referenced by savePool(). |
|
This attribute contains the next free name for a new individual. It is assembled from the experiment name, an continuos number at the end and other characters, which are needed to build funny individual names. Definition at line 51 of file SIG_GPPopulation.h. |
|
This is the main datastructure in the SIG_GPPopulation. This QVector holds the individual objects, which contains the robot control program. Definition at line 34 of file SIG_GPPopulation.h. |
|
The value, which indicates how old a population is. A generation change occurs after a special number of played tournaments, default is the half of the individuals. Is the number of tournaments reached, the generation value of the population is increased by one and all ages of the individuals are increased by one too. Definition at line 61 of file SIG_GPPopulation.h. |
|
The is a refernce of the SIG_Randomizer object of the GPManager. It is used for the randomly individual creation and the use of the genetic generation. Definition at line 42 of file SIG_GPPopulation.h. |