GaPopulationParameters
class represents parameters of population.
More...
#include <D:/Temp/vs/gal/source/Population.h>
Inherits Common::GaParameters.
Public Member Functions | |
GAL_API | GaPopulationParameters (int populationSize, bool resizable, bool sorting, bool useScaldeFitness, int bestTrackCount, int worstTrackCount) |
This constructor initializes population parameters with user-defined values. | |
virtual GaParameters *GACALL | Clone () const |
More details are given in specification of GaParameters::Clone method. | |
int GACALL | GetPopulationSize () const |
This method is not thread-safe. | |
void GACALL | SetPopulationSize (int size) |
SetPopulationSize method sets maximal population size. | |
bool GACALL | GetResizable () const |
This method is not thread-safe. | |
void GACALL | SetResizable (bool resizable) |
SetResizable method sets capability of population to accept changes of number of chromosomes in it. | |
bool GACALL | GetSorting () const |
This method is not thread-safe. | |
void GACALL | SetSorting (bool sorting) |
SetSorting method sets capability of population to sort chromosomes by their fitness value. | |
bool GACALL | GetUsingScaledFitness () const |
This method is not thread-safe. | |
void GACALL | SetUsingScaledFitness (bool useScaledFitness) |
SetUseScaledFitness method sets capability of population to use scaled fitness values of chromosomes for sorting them. | |
int GACALL | GetBestTrackCount () const |
This method is not thread-safe. | |
GAL_API void GACALL | SetBestTrackCount (int count) |
SetBestTrackCount method sets number of best chromosomes of which population keeps track | |
int GACALL | GetWorstTrackCount () const |
This method is not thread-safe. | |
GAL_API void GACALL | SetWorstTrackCount (int count) |
SetWorstTrackCount method sets number of worst chromosomes of which population keeps track. | |
Private Attributes | |
int | _populationSize |
Maximal population size (number of chromosomes in population). | |
bool | _resizable |
This attribute indicate if number of chromosomes in population can change. If it is set to true number of chromosomes can vary. If this attribute is set to false , number of chromosomes in population is equal to maximal number. | |
bool | _sorting |
If this attribute is set to true , chromosomes in population is sorted by their fitness value (original or scaled). | |
bool | _usingScaledFitness |
If this attribute is set to true , scaled fitness values are used for sorting chromosomes in population. If it is set to false , original (non-scaled) fitness values are used. | |
int | _bestTrackCount |
This attribute stores number of best chromosomes of which population keeps track. This attribute is ignored if population is sorted. | |
int | _worstTrackCount |
This attribute stores number of worst chromosomes of which population keeps track. This attribute is ignored if population is sorted. |
GaPopulationParameters
class represents parameters of population.
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::GaPopulationParameters::GaPopulationParameters | ( | int | populationSize, | |
bool | resizable, | |||
bool | sorting, | |||
bool | useScaldeFitness, | |||
int | bestTrackCount, | |||
int | worstTrackCount | |||
) |
This constructor initializes population parameters with user-defined values.
populationSize | size of population (maximal number of chromosomes in population). | |
resizable | instructs population that number of chromosomes can change. | |
sorting | instructs population to sort chromosomes according to their fitness values. | |
useScaldeFitness | instructs population to use scaled (transformed) fitness value for sorting chromosomes. | |
bestTrackCount | number of best chromosomes of which track is being kept. | |
worstTrackCount | number of worst chromosomes of which track is being kept. |
virtual GaParameters* GACALL Population::GaPopulationParameters::Clone | ( | ) | const [inline, virtual] |
More details are given in specification of GaParameters::Clone method.
This method is not thread-safe.
Implements Common::GaParameters.
int GACALL Population::GaPopulationParameters::GetPopulationSize | ( | ) | const [inline] |
This method is not thread-safe.
void GACALL Population::GaPopulationParameters::SetPopulationSize | ( | int | size | ) | [inline] |
SetPopulationSize
method sets maximal population size.
This method is not thread-safe.
size | size of population. |
bool GACALL Population::GaPopulationParameters::GetResizable | ( | ) | const [inline] |
This method is not thread-safe.
true
if number of chromosomes can change, otherwise it returns false
.void GACALL Population::GaPopulationParameters::SetResizable | ( | bool | resizable | ) | [inline] |
SetResizable
method sets capability of population to accept changes of number of chromosomes in it.
This method is not thread-safe.
resizable | instructs population that number of chromosomes can change. |
bool GACALL Population::GaPopulationParameters::GetSorting | ( | ) | const [inline] |
This method is not thread-safe.
true
if chromosomes in population is sorted by their fitness value (original or scaled), otherwise it returns false
.void GACALL Population::GaPopulationParameters::SetSorting | ( | bool | sorting | ) | [inline] |
SetSorting
method sets capability of population to sort chromosomes by their fitness value.
This method is not thread-safe.
sorting | instructs population to sort chromosomes according to their fitness values. |
bool GACALL Population::GaPopulationParameters::GetUsingScaledFitness | ( | ) | const [inline] |
This method is not thread-safe.
true
if population use scaled fitness value to sort chromosomes, otherwise if non-scaled fitness values are used it returns false
.void GACALL Population::GaPopulationParameters::SetUsingScaledFitness | ( | bool | useScaledFitness | ) | [inline] |
SetUseScaledFitness
method sets capability of population to use scaled fitness values of chromosomes for sorting them.
This method is not thread-safe.
useScaledFitness | instructs population to use scaled (transformed) fitness value for sorting chromosomes. |
int GACALL Population::GaPopulationParameters::GetBestTrackCount | ( | ) | const [inline] |
This method is not thread-safe.
void Population::GaPopulationParameters::SetBestTrackCount | ( | int | count | ) |
SetBestTrackCount
method sets number of best chromosomes of which population keeps track
This method is not thread-safe.
count | number of best chromosomes of which track is being kept. |
int GACALL Population::GaPopulationParameters::GetWorstTrackCount | ( | ) | const [inline] |
This method is not thread-safe.
void Population::GaPopulationParameters::SetWorstTrackCount | ( | int | count | ) |
SetWorstTrackCount
method sets number of worst chromosomes of which population keeps track.
This method is not thread-safe.
count | number of worst chromosomes of which track is being kept. |
int Population::GaPopulationParameters::_populationSize [private] |
Maximal population size (number of chromosomes in population).
bool Population::GaPopulationParameters::_resizable [private] |
This attribute indicate if number of chromosomes in population can change. If it is set to true
number of chromosomes can vary. If this attribute is set to false
, number of chromosomes in population is equal to maximal number.
bool Population::GaPopulationParameters::_sorting [private] |
If this attribute is set to true
, chromosomes in population is sorted by their fitness value (original or scaled).
bool Population::GaPopulationParameters::_usingScaledFitness [private] |
If this attribute is set to true
, scaled fitness values are used for sorting chromosomes in population. If it is set to false
, original (non-scaled) fitness values are used.
int Population::GaPopulationParameters::_bestTrackCount [private] |
This attribute stores number of best chromosomes of which population keeps track. This attribute is ignored if population is sorted.
int Population::GaPopulationParameters::_worstTrackCount [private] |
This attribute stores number of worst chromosomes of which population keeps track. This attribute is ignored if population is sorted.