#include <D:/Temp/vs/gal/source/PopulationOperations.h>
Public Member Functions | |
GAL_API | GaCouplingResultSet (int numberOfOffsprings, GaSelectionResultSet *selectionResults) |
This constructor initializes coupling result set with maximum number of offspring which can be stored and selection result set which stores parents. | |
virtual GAL_API | ~GaCouplingResultSet () |
Destructor frees memory of array which stores parents' indices and array of smart pointers to offspring. | |
GAL_API bool GACALL | GetOffspringAt (int pos, GaChromosomePtr &offspring, int &parent) const |
GetOffspringAt method returns newly created chromosome and its parent's index at specified position in result set. | |
GAL_API bool GACALL | SetOffspringAt (int pos, GaChromosomePtr offspring, int parent) |
SetOffspringAt method sets smart pointer to new chromosome and index of its parent at specified position in result set. It can be used to insert new chromosomes in result set. | |
int GACALL | GetNumberOfOffsprings () const |
This method is not thread-safe. | |
GAL_API void GACALL | SetNumberOfOffsprings (int number) |
SetNumberOOffspring method changes size of arrays so they can store specified number of offspring. | |
GaChromosomePtr *GACALL | GetOffspringsBuffer () const |
This method is not thread-safe. | |
int *GACALL | GetParentsBuffer () const |
This method is not thread-safe. | |
GaSelectionResultSet &GACALL | GetSelectionResultSet () const |
This method is not thread-safe. | |
Private Attributes | |
GaChromosomePtr * | _offsprings |
Pointer to array of smart pointers which are point to newly produced offspring. | |
int * | _parents |
Array of parents' indices of newly created offspring. | |
int | _numberOfOffsprings |
Number of chromosomes which can be stored in this result set. | |
GaSelectionResultSet * | _selection |
Pointer to result set of selection operation. It contains chromosomes which are used as parents to produce offspring. |
This class has no built-in synchronizator, so LOCK_OBJECT
and LOCK_THIS_OBJECT
macros cannot be used with instances of this class. No public or private methods are thread-safe.
Population::GaCouplingResultSet::GaCouplingResultSet | ( | int | numberOfOffsprings, | |
GaSelectionResultSet * | selectionResults | |||
) |
This constructor initializes coupling result set with maximum number of offspring which can be stored and selection result set which stores parents.
numberOfOffsprings | maximum number of offspring which this result set can store. | |
selectionResults | pointer to selection results which stores parents. |
Population::GaCouplingResultSet::~GaCouplingResultSet | ( | ) | [virtual] |
Destructor frees memory of array which stores parents' indices and array of smart pointers to offspring.
bool Population::GaCouplingResultSet::GetOffspringAt | ( | int | pos, | |
GaChromosomePtr & | offspring, | |||
int & | parent | |||
) | const |
GetOffspringAt
method returns newly created chromosome and its parent's index at specified position in result set.
This method is not thread-safe.
pos | position of offspring chromosome. | |
offspring | reference to smart pointer to which is stored pointer to new chromosome. | |
parent | reference to variable to which is stored index of new chromosome's parent. |
true
if chromosome exists at the position.bool Population::GaCouplingResultSet::SetOffspringAt | ( | int | pos, | |
GaChromosomePtr | offspring, | |||
int | parent | |||
) |
SetOffspringAt
method sets smart pointer to new chromosome and index of its parent at specified position in result set. It can be used to insert new chromosomes in result set.
This method is not thread-safe.
pos | position in result set which is changed. | |
offspring | smart pointer to new chromosome which is inserted. | |
parent | index of parent's chromosome. |
true
if new chromosomes is inserted in result set.int GACALL Population::GaCouplingResultSet::GetNumberOfOffsprings | ( | ) | const [inline] |
This method is not thread-safe.
void Population::GaCouplingResultSet::SetNumberOfOffsprings | ( | int | number | ) |
SetNumberOOffspring
method changes size of arrays so they can store specified number of offspring.
This method is not thread-safe.
number | new number of chromosomes which can be stored in this result set. |
GaChromosomePtr* GACALL Population::GaCouplingResultSet::GetOffspringsBuffer | ( | ) | const [inline] |
This method is not thread-safe.
int* GACALL Population::GaCouplingResultSet::GetParentsBuffer | ( | ) | const [inline] |
This method is not thread-safe.
GaSelectionResultSet& GACALL Population::GaCouplingResultSet::GetSelectionResultSet | ( | ) | const [inline] |
This method is not thread-safe.
Pointer to array of smart pointers which are point to newly produced offspring.
int* Population::GaCouplingResultSet::_parents [private] |
Array of parents' indices of newly created offspring.
int Population::GaCouplingResultSet::_numberOfOffsprings [private] |
Number of chromosomes which can be stored in this result set.
Pointer to result set of selection operation. It contains chromosomes which are used as parents to produce offspring.