mutationRules
Class MutateStrategy

java.lang.Object
  |
  +--mutationRules.MutateStrategy
All Implemented Interfaces:
MutationRule

public class MutateStrategy
extends java.lang.Object
implements MutationRule

This mutates strategies based on a mutation matrix

Author:
Kevin J.S. Zollman

Constructor Summary
MutateStrategy(double[][] m)
          The constructor which takes a mutation matrix
MutateStrategy(double m, int s)
          Sets the mutation matrix as uniform based on m
 
Method Summary
 double getMutationRate()
          Because there is no single mutation rate this is undefined.
 void mutate(Individual i)
          This function mutates based on the mutation matrix already established by the constructor.
 void setMutationRate(double[][] m)
          Same as constructor
 void setMutationRate(double m, int s)
          Sets the mutation rate (equivalent to the constructor)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutateStrategy

public MutateStrategy(double[][] m)
               throws ModelError
The constructor which takes a mutation matrix

Parameters:
m - The mutation matrix where [i][j] is the probability that strategy i mutates to strategy j.
Throws:
ModelError

MutateStrategy

public MutateStrategy(double m,
                      int s)
               throws ModelError
Sets the mutation matrix as uniform based on m

Parameters:
m - The mutation rate (the probability that a given strategy switches to any other strategy)
s - The number of strategies
Throws:
ModelError
Method Detail

mutate

public void mutate(Individual i)
            throws ModelError
This function mutates based on the mutation matrix already established by the constructor. It changes Individual.strategy without setting LastStrategy

Specified by:
mutate in interface MutationRule
Parameters:
i - The Calling Individual
ModelError

setMutationRate

public void setMutationRate(double m,
                            int s)
                     throws ModelError
Sets the mutation rate (equivalent to the constructor)

Specified by:
setMutationRate in interface MutationRule
ModelError

setMutationRate

public void setMutationRate(double[][] m)
                     throws ModelError
Same as constructor

Parameters:
m - The mutation matrix where [i][j] is the probability that strategy i mutates to strategy j.
Throws:
ModelError

getMutationRate

public double getMutationRate()
Because there is no single mutation rate this is undefined.

Specified by:
getMutationRate in interface MutationRule