Population::GaCouplingResultSet Class Reference

This class is used as storage for coupling operation (result set). Result set contains pointer to selection result set which stores parent chromosomes. It also contains array of newly produced chromosomes and array of their parents' indices. More...

#include <D:/Temp/vs/gal/source/PopulationOperations.h>

List of all members.

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.


Detailed Description

This class is used as storage for coupling operation (result set). Result set contains pointer to selection result set which stores parent chromosomes. It also contains array of newly produced chromosomes and array of their parents' indices.

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.


Constructor & Destructor Documentation

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.

Parameters:
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.


Member Function Documentation

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.

Parameters:
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.
Returns:
Method returns 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.

Parameters:
pos position in result set which is changed.
offspring smart pointer to new chromosome which is inserted.
parent index of parent's chromosome.
Returns:
Method returns true if new chromosomes is inserted in result set.

int GACALL Population::GaCouplingResultSet::GetNumberOfOffsprings (  )  const [inline]

This method is not thread-safe.

Returns:
Method returns maximal number of offspring which this result can store.

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.

Parameters:
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.

Returns:
Method returns pointer to array of smart pointers to newly created chromosomes.

int* GACALL Population::GaCouplingResultSet::GetParentsBuffer (  )  const [inline]

This method is not thread-safe.

Returns:
Method returns pointer to array of parent's indices.

GaSelectionResultSet& GACALL Population::GaCouplingResultSet::GetSelectionResultSet (  )  const [inline]

This method is not thread-safe.

Returns:
Method returns reference to selection which stores parent chromosomes.


Member Data Documentation

Pointer to array of smart pointers which are point to newly produced offspring.

Array of parents' indices of newly created offspring.

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.


The documentation for this class was generated from the following files:

Genetic Algorithm Library
Coolsoft Software Development