GaScaledChromosome
cannot be located in multiple populations.
More...
#include <D:/Temp/vs/gal/source/Chromosome.h>
Public Member Functions | |
GaScaledChromosome (GaChromosomePtr chromosome, GaPopulation *population, int index) | |
This constructor fully initializes binding object (chromosome, population and index). | |
GaScaledChromosome (GaPopulation *population) | |
This constructor only specifies binding population. | |
GaChromosomePtr GACALL | GetChromosome () const |
This method is not thread-safe. | |
void GACALL | SetChromosome (GaChromosomePtr chromosome) |
SetChromosome sets pointer to bound chromosome. | |
float GACALL | GetScaledFitness () const |
This method is not thread-safe. | |
void GACALL | SetScaledFitness (float fitness) |
SetScaledFitness method sets scaled (transformed) value of bound chromosome. | |
GAL_API float GACALL | GetFitnessForComparison () const |
This method is not thread-safe. | |
GAL_API void GACALL | Rescale () |
Rescale method recalculates scaled (transformed) fitness value of chromosome. | |
int GACALL | CompareFitnesses (const GaScaledChromosome &c) const |
This method compares fitness values of two chromosomes (this and c ). Which fitness value (scaled or original) is going to be used depends on flag set in population to which chromosomes are bound. NOTE: Comparison doesn't have to be arithmetical comparison. | |
GAL_API int GACALL | CompareFitnesses (float c) const |
This method compares fitness values of two chromosomes (this and c ). Which fitness value (scaled or original) is going to be used depends on flag set in population to which chromosomes are bound. NOTE: Comparison doesn't have to be arithmetical comparison. | |
void GACALL | ClearGroupFlags (GaSortedGroupType groups) |
ClearGroupFlag method clears chromosome's membership flag for specified sorted group of population. | |
void GACALL | SetGroupFlags (GaSortedGroupType groups) |
SetGroupFlag method sets chromosome's membership flag for specified sorted group of population. | |
bool GACALL | GetGroupFlag (GaSortedGroupType groups, bool all=false) |
Method returns state of desired membership flag(s). | |
void GACALL | SetGroups (GaSortedGroupType groups) |
SetGroups sets all flags of sorted group membership. | |
GaSortedGroupType GACALL | GetGroups () const |
This method is not thread-safe. | |
GAL_API void GACALL | SetIndex (int index) |
SetIndex method sets index of bound chromosome in population. | |
int GACALL | GetIndex () const |
This method is not thread-safe. | |
GaPopulation &GACALL | GetPopulation () const |
This method is not thread-safe. | |
GACALL | operator GaChromosomePtr () const |
This operator is not thread-safe. | |
GACALL | operator float () const |
This operator is not thread-safe. | |
Private Attributes | |
float | _scaledFitness |
Scaled (transformed) fitness value of the chromosome. | |
GaPopulation * | _population |
Pointer to population in which the chromosome is located. | |
GaChromosomePtr | _chromosome |
Smart pointer to chromosome which is bound to population with this object. | |
GaSortedGroupType | _groups |
Flags od memberships in sorted groups of population. | |
int | _index |
Index of chromosome in population. |
GaScaledChromosome
cannot be located in multiple populations.
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.
Chromosome::GaScaledChromosome::GaScaledChromosome | ( | GaChromosomePtr | chromosome, | |
GaPopulation * | population, | |||
int | index | |||
) |
This constructor fully initializes binding object (chromosome, population and index).
chromosome | smart pointer to bound chromosome. | |
population | pointer to population to which chromosome is bound. | |
index | index of chromosome in population. |
Chromosome::GaScaledChromosome::GaScaledChromosome | ( | GaPopulation * | population | ) |
This constructor only specifies binding population.
population | pointer to population to which chromosome is bound. |
GaChromosomePtr GACALL Chromosome::GaScaledChromosome::GetChromosome | ( | ) | const [inline] |
This method is not thread-safe.
NULL
pointer if object doesn't bind chromosome.void GACALL Chromosome::GaScaledChromosome::SetChromosome | ( | GaChromosomePtr | chromosome | ) | [inline] |
SetChromosome
sets pointer to bound chromosome.
This method is not thread-safe.
chromosome | smart pointer to bound chromosome. |
float GACALL Chromosome::GaScaledChromosome::GetScaledFitness | ( | ) | const [inline] |
This method is not thread-safe.
void GACALL Chromosome::GaScaledChromosome::SetScaledFitness | ( | float | fitness | ) | [inline] |
SetScaledFitness
method sets scaled (transformed) value of bound chromosome.
This method is not thread-safe.
fitness | new fitness value. |
float Chromosome::GaScaledChromosome::GetFitnessForComparison | ( | ) | const |
This method is not thread-safe.
void GACALL Chromosome::GaScaledChromosome::Rescale | ( | ) |
Rescale
method recalculates scaled (transformed) fitness value of chromosome.
int GACALL Chromosome::GaScaledChromosome::CompareFitnesses | ( | const GaScaledChromosome & | c | ) | const [inline] |
This method compares fitness values of two chromosomes (this
and c
). Which fitness value (scaled or original) is going to be used depends on flag set in population to which chromosomes are bound. NOTE: Comparison doesn't have to be arithmetical comparison.
This method is not thread-safe.
c | second chromosome for comparison with this . |
this
is lower then value of c
. this
is greater then value of c
. int Chromosome::GaScaledChromosome::CompareFitnesses | ( | float | c | ) | const |
This method compares fitness values of two chromosomes (this
and c
). Which fitness value (scaled or original) is going to be used depends on flag set in population to which chromosomes are bound. NOTE: Comparison doesn't have to be arithmetical comparison.
This method is not thread-safe.
c | second chromosome for comparison with this . |
this
is lower then value of c
. this
is greater then value of c
. void GACALL Chromosome::GaScaledChromosome::ClearGroupFlags | ( | GaSortedGroupType | groups | ) | [inline] |
ClearGroupFlag
method clears chromosome's membership flag for specified sorted group of population.
groups | flags of sorted groups that will be set. |
void GACALL Chromosome::GaScaledChromosome::SetGroupFlags | ( | GaSortedGroupType | groups | ) | [inline] |
SetGroupFlag
method sets chromosome's membership flag for specified sorted group of population.
This method is not thread-safe.
groups | flags of sorted groups that will be set. |
bool GACALL Chromosome::GaScaledChromosome::GetGroupFlag | ( | GaSortedGroupType | groups, | |
bool | all = false | |||
) | [inline] |
Method returns state of desired membership flag(s).
This method is not thread-safe.
groups | desired flags of sorted groups which state is queried. Flags are cmbined with operator |. | |
all | parameter tells method how the states of flag are combined into result. It this parameter is set to true , method returns true only if all flags is set, otherwise if this parameter is set to false , method returns true if any of flags is set. |
true
if any of desired flags is set and all parameter is set to false
. If all parameter is set to true
, method returns true
only if all desired flags are set.void GACALL Chromosome::GaScaledChromosome::SetGroups | ( | GaSortedGroupType | groups | ) | [inline] |
SetGroups
sets all flags of sorted group membership.
This method is not thread-safe.
groups | new values of flags of sorted groups membership. |
GaSortedGroupType GACALL Chromosome::GaScaledChromosome::GetGroups | ( | ) | const [inline] |
This method is not thread-safe.
void Chromosome::GaScaledChromosome::SetIndex | ( | int | index | ) |
SetIndex
method sets index of bound chromosome in population.
index | new index of bound chromosome. |
int GACALL Chromosome::GaScaledChromosome::GetIndex | ( | ) | const [inline] |
This method is not thread-safe.
GaPopulation& GACALL Chromosome::GaScaledChromosome::GetPopulation | ( | ) | const [inline] |
This method is not thread-safe.
GACALL Chromosome::GaScaledChromosome::operator GaChromosomePtr | ( | ) | const [inline] |
This operator is not thread-safe.
NULL
pointer if object isn't bound to chromosome.GACALL Chromosome::GaScaledChromosome::operator float | ( | ) | const [inline] |
This operator is not thread-safe.
float Chromosome::GaScaledChromosome::_scaledFitness [private] |
Scaled (transformed) fitness value of the chromosome.
Pointer to population in which the chromosome is located.
Smart pointer to chromosome which is bound to population with this object.
Flags od memberships in sorted groups of population.
int Chromosome::GaScaledChromosome::_index [private] |
Index of chromosome in population.