#include <GLBaseBreeder.h>
Public Member Functions | |
GLBaseBreeder (GLBaseCrossover *crossover) | |
virtual | ~GLBaseBreeder () |
virtual int | breedOrganisms (GLBasePopulation *population, GLBaseOrganismStorage *potential_parents, GLBaseOrganismStorage *offsprings, GLConstants::TStorageFilling fill=GLConstants::APPEND, GLConstants::TTwinsFlags twins=GLConstants::NO_TWINS, int size_limits=-1)=0 |
GLBaseCrossover * | getCrossover () |
const GLBaseCrossover * | getCrossover () const |
virtual void | reset () |
Definition at line 12 of file GLBaseBreeder.h.
GLBaseBreeder::GLBaseBreeder | ( | GLBaseCrossover * | crossover | ) |
Simple constructor. Assigns the crossover which will be used for breeding.
Definition at line 8 of file GLBaseBreeder.cpp.
GLBaseBreeder::~GLBaseBreeder | ( | ) | [virtual] |
Destructor, destroys everything, including crossover.
Definition at line 19 of file GLBaseBreeder.cpp.
virtual int GLBaseBreeder::breedOrganisms | ( | GLBasePopulation * | population, | |
GLBaseOrganismStorage * | potential_parents, | |||
GLBaseOrganismStorage * | offsprings, | |||
GLConstants::TStorageFilling | fill = GLConstants::APPEND , |
|||
GLConstants::TTwinsFlags | twins = GLConstants::NO_TWINS , |
|||
int | size_limits = -1 | |||
) | [pure virtual] |
Breeds organisms -- produces the offsprings from parents based on certain criteria using the crossover owned by this breeder.
population | population to which parents belong -- mainly to be able to check the uniqueness of the new offsprings. | |
potential_parents | organisms to be bred. | |
offsprings | storage place to store the children. | |
fill | when true adds the organisms to the storage. | |
twins | when true all the offsprings will be checked for uniqueness with the parent's population before being added to the storage of offsprings. | |
size_limits | limit number of produced offsprings. When < 0 all the offsprings generated by the algorithm will be returned. |
Implemented in GLBreederStandard.
const GLBaseCrossover* GLBaseBreeder::getCrossover | ( | ) | const [inline] |
Returns the crossover which is used by the breeder.
Definition at line 61 of file GLBaseBreeder.h.
GLBaseCrossover* GLBaseBreeder::getCrossover | ( | ) | [inline] |
Returns the crossover which is used by the breeder.
Definition at line 54 of file GLBaseBreeder.h.
void GLBaseBreeder::reset | ( | ) | [virtual] |
Resets breeder (e.g. sets counter, if any, to zero etc.) and its crossover.
Definition at line 29 of file GLBaseBreeder.cpp.