Mutation Operator Interface. More...
![Inheritance graph](classfarsa_1_1Mutation__inherit__graph.png)
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. | |
![]() | |
void | addObserver (RuntimeParameterObserver *obs) |
T | getRuntimeParameter (QString paramName) |
virtual ParameterSettableUI * | getUIManager () |
ParameterSettable () | |
virtual void | postConfigureInitialization () |
void | removeObserver (RuntimeParameterObserver *obs) |
void | setRuntimeParameter (QString paramName, T newvalue) |
QString | typeName () const |
![]() | |
void | addObserver (RuntimeParameterObserver *obs) |
T | getRuntimeParameter (QString paramName) |
void | removeObserver (RuntimeParameterObserver *obs) |
void | setRuntimeParameter (QString paramName, T newvalue) |
QString | typeName () const |
Static Public Member Functions | |
static void | describe (QString type) |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups. | |
![]() | |
static void | describe (QString type) |
static QString | fullParameterDescriptionPath (QString type, QString param) |
static QString | fullSubgroupDescriptionPath (QString type, QString sub) |
![]() | |
static void | describe (QString type) |
static QString | fullParameterDescriptionPath (QString type, QString param) |
static QString | fullSubgroupDescriptionPath (QString type, QString sub) |
Protected Attributes | |
GeneticAlgo * | ga |
GeneticAlgo used. | |
const Genome * | genomev |
Genome where Genotypes lives. | |
Additional Inherited Members | |
![]() | |
enum | Property |
![]() | |
AllowMultiple | |
Default | |
IsList | |
IsMandatory | |
![]() | |
static const double | Infinity |
static const int | MaxInteger |
static const int | MinInteger |
![]() | |
void | notifyChangesToParam (QString paramName) |
![]() | |
static Descriptor | addTypeDescription (QString type, QString shortHelp, QString longHelp=QString("")) |
static void | setGraphicalEditor (QString type) |
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.
|
virtual |
Destructor.
Definition at line 36 of file mutation.cpp.
Member Function Documentation
|
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().
Referenced by GaussianFloat::configure().
|
static |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Definition at line 154 of file mutation.cpp.
References ParameterSettableWithConfigureFunction::addTypeDescription(), ParameterSettable::RealDescriptor::def(), ParameterSettable::Descriptor::describeReal(), ParameterSettable::RealDescriptor::help(), ParameterSettableWithConfigureFunction::IsMandatory, ParameterSettable::RealDescriptor::limits(), and ParameterSettable::RealDescriptor::props().
Referenced by FlipBit::describe(), RandomFloat::describe(), RandomBit::describe(), and GaussianFloat::describe().
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().
|
inline |
Return the GeneticAlgo used.
Definition at line 128 of file mutation.h.
|
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().
|
pure virtual |
Mutate the Genotype.
- Warning
- It modifies the Genotype passed
Implemented in RandomBit, GaussianFloat, RandomFloat, and FlipBit.
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(), FlipBit::mutate(), RandomFloat::mutate(), GaussianFloat::mutate(), RandomBit::mutate(), and Mutation::save().
|
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 ParameterSettableWithConfigureFunction.
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 GaussianFloat::save(), FixedSize::save(), StefanoSteadyStateGA::save(), and LaralGA::save().
|
inline |
Set the GeneticAlgo used.
Definition at line 123 of file mutation.h.
Referenced by FixedSize::setMutation(), StefanoSteadyStateGA::setMutation(), and LaralGA::setMutation().
|
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
|
protected |
GeneticAlgo used.
Definition at line 155 of file mutation.h.
Referenced by Mutation::Mutation(), Mutation::mutationRate(), and Mutation::setMutationRate().
|
protected |
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