Mutation Operator Interface. More...

Inheritance diagram for Mutation:

List of all members.

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 &params, 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.
GeneticAlgoGA ()
 Return the GeneticAlgo used.
const Genomegenome ()
 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 &params, 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

GeneticAlgoga
 GeneticAlgo used.
const Genomegenomev
 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:
paramsthe object with configuration parameters
prefixthe 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]
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:
paramsthe configuration parameters object on which save actual parameters
prefixthe 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]
const Genome* genomev [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: