#include <D:/Temp/vs/gal/source/Chromosome.h>
Inherits Common::GaParameters.
Inherited by Chromosome::Representation::GaBinaryChromosomeParams.
Public Member Functions | |
GaChromosomeParams (float mutationProbability, int mutationSize, bool improvingOnlyMutations, float crossoverProbability, int numberOfCrossoverPoints) | |
This constructor initializes parameters with user-defined values. | |
GaChromosomeParams () | |
This constructor initializes parameters with default values. 1. mutation probability: 3% 2. mutation size: 1 (only one value is mutated) 3. only improving mutations are accepted: yes 4. crossover probability: 80% 5. number of crossover points: 1. | |
virtual GaParameters *GACALL | Clone () const |
More details are given in specification of GaParameters::Clone method. | |
void GACALL | SetMutationProbability (float probability) |
SetMutationProbability method sets probability of mutation operation being performed during coupling of selected parents. | |
float GACALL | GetMutationProbability () const |
This method is not thread-safe. | |
void GACALL | SetMutationSize (int size) |
SetMutationSize method sets maximal number of affected values in chromosome's code by mutation operation. | |
int | GetMutationSize () const |
This method is not thread-safe. | |
void GACALL | SetImprovingMutationsFlag (bool improvingOnly) |
SetImprovingMutationsFlag method sets improving-mutation flag. | |
bool GACALL | GetImprovingMutationsFlag () const |
This method is not thread-safe. | |
void GACALL | SetCrossoverProbability (float probability) |
SetCrossoverProbability method sets probability of crossover operation being performed during coupling of selected parents. | |
float GACALL | GetCrossoverProbability () const |
This method is not thread-safe. | |
void GACALL | SetNumberOfCrossoverPoints (int numberOfPoints) |
SetNumberOfCrossoverPoints method sets number of crossover points. | |
int GACALL | GetNumberOfCrossoverPoints () const |
This method is not thread-safe. | |
Protected Attributes | |
float | _mutationProbability |
Mutation probability in interval (0, 1) of mutation operation being performed during coupling of selected parents. | |
int | _mutationSize |
Maximal number of affected values in chromosome�s code by mutation operation. | |
bool | _improvingOnlyMutations |
This flag if set, instructs that only mutations which lead to improvement of fitness value should be accepted. If it isn't set, then all mutation should be accepted. | |
float | _crossoverProbability |
probability in interval (0, 1) of crossover operation being performed during coupling of selected parents. | |
int | _numberOfCrossoverPoints |
Number of crossover points between two parents when crossover operation is performed. |
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::GaChromosomeParams::GaChromosomeParams | ( | float | mutationProbability, | |
int | mutationSize, | |||
bool | improvingOnlyMutations, | |||
float | crossoverProbability, | |||
int | numberOfCrossoverPoints | |||
) | [inline] |
This constructor initializes parameters with user-defined values.
mutationProbability | mutation probability in interval (0, 1). | |
mutationSize | maximal number of affected values in chromosome's code by mutation operation. | |
improvingOnlyMutations | state of improving only mutation flag. | |
crossoverProbability | crossover probability in interval (0, 1). | |
numberOfCrossoverPoints | number of crossover points. |
Chromosome::GaChromosomeParams::GaChromosomeParams | ( | ) | [inline] |
This constructor initializes parameters with default values.
1. mutation probability: 3%
2. mutation size: 1 (only one value is mutated)
3. only improving mutations are accepted: yes
4. crossover probability: 80%
5. number of crossover points: 1.
virtual GaParameters* GACALL Chromosome::GaChromosomeParams::Clone | ( | ) | const [inline, virtual] |
More details are given in specification of GaParameters::Clone method.
This method is not thread-safe.
Implements Common::GaParameters.
void GACALL Chromosome::GaChromosomeParams::SetMutationProbability | ( | float | probability | ) | [inline] |
SetMutationProbability method sets probability of mutation operation being performed during coupling of selected parents.
This method is not thread-safe.
probability | new probability of mutation operation. Value is in interval (0, 1). |
float GACALL Chromosome::GaChromosomeParams::GetMutationProbability | ( | ) | const [inline] |
This method is not thread-safe.
void GACALL Chromosome::GaChromosomeParams::SetMutationSize | ( | int | size | ) | [inline] |
SetMutationSize
method sets maximal number of affected values in chromosome's code by mutation operation.
This method is not thread-safe.
size | maximal number of affected values in chromosome's code. |
int Chromosome::GaChromosomeParams::GetMutationSize | ( | ) | const [inline] |
This method is not thread-safe.
void GACALL Chromosome::GaChromosomeParams::SetImprovingMutationsFlag | ( | bool | improvingOnly | ) | [inline] |
SetImprovingMutationsFlag
method sets improving-mutation flag.
This method is not thread-safe.
improvingOnly | if this parameter is set to true , then only the mutations which lead to improvement of fitness value should be accepted. If this parameter is set to false , all mutations are accepted. |
bool GACALL Chromosome::GaChromosomeParams::GetImprovingMutationsFlag | ( | ) | const [inline] |
This method is not thread-safe.
true
if only the mutations which lead to improvement of fitness value should be accepted. If all mutation should be accepted, then this method return false
.void GACALL Chromosome::GaChromosomeParams::SetCrossoverProbability | ( | float | probability | ) | [inline] |
SetCrossoverProbability
method sets probability of crossover operation being performed during coupling of selected parents.
This method is not thread-safe.
probability | new probability of crossover operation. Value is in interval (0, 1). |
float GACALL Chromosome::GaChromosomeParams::GetCrossoverProbability | ( | ) | const [inline] |
This method is not thread-safe.
void GACALL Chromosome::GaChromosomeParams::SetNumberOfCrossoverPoints | ( | int | numberOfPoints | ) | [inline] |
SetNumberOfCrossoverPoints
method sets number of crossover points.
This method is not thread-safe.
numberOfPoints | new number of crossover points. |
int GACALL Chromosome::GaChromosomeParams::GetNumberOfCrossoverPoints | ( | ) | const [inline] |
This method is not thread-safe.
float Chromosome::GaChromosomeParams::_mutationProbability [protected] |
Mutation probability in interval (0, 1) of mutation operation being performed during coupling of selected parents.
int Chromosome::GaChromosomeParams::_mutationSize [protected] |
Maximal number of affected values in chromosome�s code by mutation operation.
bool Chromosome::GaChromosomeParams::_improvingOnlyMutations [protected] |
This flag if set, instructs that only mutations which lead to improvement of fitness value should be accepted. If it isn't set, then all mutation should be accepted.
float Chromosome::GaChromosomeParams::_crossoverProbability [protected] |
probability in interval (0, 1) of crossover operation being performed during coupling of selected parents.
int Chromosome::GaChromosomeParams::_numberOfCrossoverPoints [protected] |
Number of crossover points between two parents when crossover operation is performed.