Mutation Class Reference
Mutation Operator Interface. More...

Classes | |
struct | MutationRate |
The structure with information about the mutation rate for a genotype. | |
Public Member Functions | |
Mutation () | |
Constructor. | |
virtual | ~Mutation () |
Destructor. | |
virtual void | configure (ConfigurationParameters ¶ms, QString prefix) |
Configure the object using the ConfigurationParameters specified. | |
double | finalMutationRate (int bit) |
Returns the final mutation rate for the specified bit of the genotype. | |
GeneticAlgo * | GA () |
Return the GeneticAlgo used. | |
const Genome * | genome () |
Return the Genome. | |
double | initialMutationRate (int bit) |
Returns the initial mutation rate for the specified bit of the genotype. | |
virtual void | mutate (Genotype *)=0 |
Mutate the Genotype. | |
double | mutationRate (int bit) |
Returns the current mutation rate for the specified bit of the genotype. | |
virtual void | save (ConfigurationParameters ¶ms, QString prefix) |
Save the actual status of parameters into the ConfigurationParameters object passed. | |
void | setGA (GeneticAlgo *g) |
Set the GeneticAlgo used. | |
void | setGenome (const Genome *g) |
Set the Genome where Genotypes lives. | |
void | setMutationRate (double rate, int start=0, int length=-1) |
Set the mutation rate, i.e. | |
void | setMutationRate (double initialRate, double finalRate, double variation, int start=0, int length=-1) |
Like the other setMutationRate function, but this allows setting the initial rate, the final rate and the variation. | |
double | variationMutationRate (int bit) |
Returns the variation of the mutation rate for the specified bit of the genotype. | |
Static Public Member Functions | |
static void | describe (QString type) |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups. | |
Protected Attributes | |
GeneticAlgo * | ga |
GeneticAlgo used. | |
const Genome * | genomev |
Genome where Genotypes lives. |
Detailed Description
Mutation Operator Interface.
- Description
- Interface of the Mutation Operator. This allows setting different mutation rates for different genes (only programmatically) and also automatically decreasing mutation rates during generations.
- Warnings
- The sign of the variation for the mutation rate is modified so to tend to the final mutation rate. This means that if the initial mutation rate is greater than the final mutation rate, variation is made negative, otherwise it is positive.
Definition at line 47 of file mutation.h.
Constructor & Destructor Documentation
Mutation | ( | ) |
Constructor.
Definition at line 27 of file mutation.cpp.
References Mutation::ga, and Mutation::genomev.
~Mutation | ( | ) | [virtual] |
Destructor.
Definition at line 36 of file mutation.cpp.
Member Function Documentation
void configure | ( | ConfigurationParameters & | params, |
QString | prefix | ||
) | [virtual] |
Configure the object using the ConfigurationParameters specified.
- Parameters:
-
params the object with configuration parameters prefix the group in which parameters are expected to be (this is terminated by a separator character). We expect to receive as prefix the group with mutation parameters
Implements ParameterSettableWithConfigureFunction.
Reimplemented in GaussianFloat.
Definition at line 124 of file mutation.cpp.
References ConfigurationHelper::getDouble(), Mutation::mutationRate(), and Mutation::setMutationRate().
void describe | ( | QString | type | ) | [static] |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Reimplemented from ParameterSettable.
Reimplemented in FlipBit, GaussianFloat, RandomBit, and RandomFloat.
Definition at line 154 of file mutation.cpp.
References ParameterSettable::addTypeDescription(), ParameterSettable::RealDescriptor::def(), ParameterSettable::Descriptor::describeReal(), ParameterSettable::RealDescriptor::help(), ParameterSettable::IsMandatory, ParameterSettable::RealDescriptor::limits(), and ParameterSettable::RealDescriptor::props().
double finalMutationRate | ( | int | bit | ) |
Returns the final mutation rate for the specified bit of the genotype.
- Note:
- The argument is referencing bits in the genotype and not genes. Use the helper methods geneToBitIndex and bitToGeneIndex of the Genotype class to get the correct indices.
Definition at line 112 of file mutation.cpp.
Referenced by Mutation::save().
GeneticAlgo* GA | ( | ) | [inline] |
Return the GeneticAlgo used.
Definition at line 128 of file mutation.h.
const Genome* genome | ( | ) | [inline] |
Return the Genome.
Definition at line 118 of file mutation.h.
double initialMutationRate | ( | int | bit | ) |
Returns the initial mutation rate for the specified bit of the genotype.
- Note:
- The argument is referencing bits in the genotype and not genes. Use the helper methods geneToBitIndex and bitToGeneIndex of the Genotype class to get the correct indices.
Definition at line 108 of file mutation.cpp.
Referenced by Mutation::save().
virtual void mutate | ( | Genotype * | ) | [pure virtual] |
Mutate the Genotype.
- Warning:
- It modifies the Genotype passed
Implemented in FlipBit, GaussianFloat, RandomBit, and RandomFloat.
Referenced by StefanoSteadyStateGA::gaStep(), and FixedSize::reproduction().
double mutationRate | ( | int | bit | ) |
Returns the current mutation rate for the specified bit of the genotype.
This also modifies the current mutation rate if it has to
- Note:
- The argument is referencing bits in the genotype and not genes. Use the helper methods geneToBitIndex and bitToGeneIndex of the Genotype class to get the correct indices.
Definition at line 96 of file mutation.cpp.
References Mutation::ga, and GeneticAlgo::generation().
Referenced by Mutation::configure(), RandomFloat::mutate(), RandomBit::mutate(), GaussianFloat::mutate(), FlipBit::mutate(), and Mutation::save().
void save | ( | ConfigurationParameters & | params, |
QString | prefix | ||
) | [virtual] |
Save the actual status of parameters into the ConfigurationParameters object passed.
- Parameters:
-
params the configuration parameters object on which save actual parameters prefix the prefix to use to access the object configuration parameters.
Implements ParameterSettable.
Reimplemented in GaussianFloat.
Definition at line 140 of file mutation.cpp.
References ConfigurationParameters::createParameter(), Mutation::finalMutationRate(), Mutation::initialMutationRate(), Mutation::mutationRate(), and Mutation::variationMutationRate().
Referenced by FixedSize::save(), StefanoSteadyStateGA::save(), and LaralGA::save().
void setGA | ( | GeneticAlgo * | g | ) | [inline] |
Set the GeneticAlgo used.
Definition at line 123 of file mutation.h.
Referenced by FixedSize::setMutation(), StefanoSteadyStateGA::setMutation(), and LaralGA::setMutation().
void setGenome | ( | const Genome * | g | ) | [inline] |
Set the Genome where Genotypes lives.
Definition at line 113 of file mutation.h.
Referenced by StefanoSteadyStateGA::initialize(), and FixedSize::reproduction().
void setMutationRate | ( | double | rate, |
int | start = 0 , |
||
int | length = -1 |
||
) |
Set the mutation rate, i.e.
the probability to apply a mutation. The mutation rate can either be set for the whole genotype or for parts of it. If start and end are not given, the rate is set for the whole genotype. If start is given, then the rate is set from that bit on to end. If length is also given, the rate is set from the start for length number of bits. This sets both starting and ending mutation rates
- Note:
- The argument start and length are referencing bits in the genotype and not genes. Use the helper methods geneToBitIndex and bitToGeneIndex of the Genotype class to get the correct indices.
Definition at line 40 of file mutation.cpp.
Referenced by Mutation::configure().
void setMutationRate | ( | double | initialRate, |
double | finalRate, | ||
double | variation, | ||
int | start = 0 , |
||
int | length = -1 |
||
) |
Like the other setMutationRate function, but this allows setting the initial rate, the final rate and the variation.
Definition at line 45 of file mutation.cpp.
References Mutation::ga, and GeneticAlgo::generation().
double variationMutationRate | ( | int | bit | ) |
Returns the variation of the mutation rate for the specified bit of the genotype.
- Note:
- The argument is referencing bits in the genotype and not genes. Use the helper methods geneToBitIndex and bitToGeneIndex of the Genotype class to get the correct indices.
Definition at line 116 of file mutation.cpp.
Referenced by Mutation::save().
Member Data Documentation
GeneticAlgo* ga [protected] |
GeneticAlgo used.
Definition at line 155 of file mutation.h.
Referenced by Mutation::Mutation(), Mutation::mutationRate(), and Mutation::setMutationRate().
Genome where Genotypes lives.
Definition at line 152 of file mutation.h.
Referenced by Mutation::Mutation().
The documentation for this class was generated from the following files:
- ga/include/core/mutation.h
- ga/src/core/mutation.cpp