ECF 1.5
Public Member Functions | Public Attributes | Protected Attributes | List of all members

Mutation class - handles mutation of individuals (as opposed to MutationOp class that mutates genotypes). More...

#include <Mutation.h>

Public Member Functions

bool mutate (IndividualP ind)
 Mutate an individual. More...
 
uint mutation (const std::vector< IndividualP > &)
 Perform mutation on a pool of individuals. More...
 
void registerParameters (StateP)
 Register mutation related but Genotype unrelated parameters. More...
 
bool initialize (StateP)
 Initialize all mutation operators of all active genotypes. More...
 
double getIndMutProb ()
 Return current individual mutation probability. More...
 
double setIndMutProb (double)
 Set new individual mutation probability (ignored if not [0, 1]) More...
 

Public Attributes

std::vector< std::vector< MutationOpP > > operators
 vectors of mutation operators for each genotype More...
 
std::vector< std::vector< double > > opProb
 usage probabilities for each MutationOp operator More...
 
IndividualP currentInd
 

Protected Attributes

StateP state_
 
double indMutProb_
 mutation probability of an individual More...
 
uint mutateGenotypes_
 what genotypes (if more than one) to mutate (random, all) More...
 
std::vector< bool > protectedGenotypes_
 protected (non-mutatable) genotypes flags More...
 

Detailed Description

Mutation class - handles mutation of individuals (as opposed to MutationOp class that mutates genotypes).

Mutation class is in fact a repository of every mutation operator (MutationOp) for every active Genotype (the genotypes used in individuals). Determines which MutationOp will be used for each genotype. (every operator for every genotype has a usage probability)

Definition at line 54 of file Mutation.h.

Member Function Documentation

◆ getIndMutProb()

double Mutation::getIndMutProb ( )

Return current individual mutation probability.

Definition at line 10 of file Mutation.cpp.

◆ initialize()

bool Mutation::initialize ( StateP  state)

Initialize all mutation operators of all active genotypes.

Definition at line 45 of file Mutation.cpp.

◆ mutate()

bool Mutation::mutate ( IndividualP  ind)

Mutate an individual.

May mutate one or more genotypes in given individual. Determines which MutationOp to use on each genotype.

Definition at line 153 of file Mutation.cpp.

◆ mutation()

uint Mutation::mutation ( const std::vector< IndividualP > &  pool)

Perform mutation on a pool of individuals.

Mutation probability may be defined with 2 parameters:

  • (not implemented!) if geneMutProb_ is defined in config, use that parameter with genotype's genome size
  • otherwise use indMutProb_

Called by: Algorithm::advanceGeneration

Returns
number of mutated individuals

Definition at line 133 of file Mutation.cpp.

◆ registerParameters()

void Mutation::registerParameters ( StateP  state)

Register mutation related but Genotype unrelated parameters.

Definition at line 30 of file Mutation.cpp.

◆ setIndMutProb()

double Mutation::setIndMutProb ( double  newProb)

Set new individual mutation probability (ignored if not [0, 1])

Definition at line 19 of file Mutation.cpp.

Member Data Documentation

◆ currentInd

IndividualP Mutation::currentInd

Definition at line 67 of file Mutation.h.

◆ indMutProb_

double Mutation::indMutProb_
protected

mutation probability of an individual

Definition at line 71 of file Mutation.h.

◆ mutateGenotypes_

uint Mutation::mutateGenotypes_
protected

what genotypes (if more than one) to mutate (random, all)

Definition at line 72 of file Mutation.h.

◆ operators

std::vector< std::vector<MutationOpP> > Mutation::operators

vectors of mutation operators for each genotype

Definition at line 64 of file Mutation.h.

◆ opProb

std::vector< std::vector<double> > Mutation::opProb

usage probabilities for each MutationOp operator

Definition at line 65 of file Mutation.h.

◆ protectedGenotypes_

std::vector<bool> Mutation::protectedGenotypes_
protected

protected (non-mutatable) genotypes flags

Definition at line 73 of file Mutation.h.

◆ state_

StateP Mutation::state_
protected

Definition at line 70 of file Mutation.h.


The documentation for this class was generated from the following files: