Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)

org.uncommons.watchmaker.framework.operators
Class BitStringMutation

java.lang.Object
  extended by org.uncommons.watchmaker.framework.operators.BitStringMutation
All Implemented Interfaces:
EvolutionaryOperator<BitString>

public class BitStringMutation
extends Object
implements EvolutionaryOperator<BitString>

Mutation of individual bits in a BitString according to some probability.

Author:
Daniel Dyer
See Also:
BitString

Constructor Summary
BitStringMutation(NumberGenerator<Probability> mutationProbability, NumberGenerator<Integer> mutationCount)
          Creates a mutation operator for bit strings, with the probability that any given bit will be flipped governed by the specified number generator.
BitStringMutation(Probability mutationProbability)
          Creates a mutation operator for bit strings with the specified probability that a given bit string will be mutated, with exactly one bit being flipped.
 
Method Summary
 List<BitString> apply(List<BitString> selectedCandidates, Random rng)
          Apply the operation to each entry in the list of selected candidates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitStringMutation

public BitStringMutation(Probability mutationProbability)
Creates a mutation operator for bit strings with the specified probability that a given bit string will be mutated, with exactly one bit being flipped.

Parameters:
mutationProbability - The probability of a candidate being mutated.

BitStringMutation

public BitStringMutation(NumberGenerator<Probability> mutationProbability,
                         NumberGenerator<Integer> mutationCount)
Creates a mutation operator for bit strings, with the probability that any given bit will be flipped governed by the specified number generator.

Parameters:
mutationProbability - The (possibly variable) probability of a candidate bit string being mutated at all.
mutationCount - The (possibly variable) number of bits that will be flipped on any candidate bit string that is selected for mutation.
Method Detail

apply

public List<BitString> apply(List<BitString> selectedCandidates,
                             Random rng)
Description copied from interface: EvolutionaryOperator

Apply the operation to each entry in the list of selected candidates. It is important to note that this method operates on the list of candidates returned by the selection strategy and not on the current population. Each entry in the list (not each individual - the list may contain the same individual more than once) must be operated on exactly once.

Implementing classes should not assume any particular ordering (or lack of ordering) for the selection. If ordering or shuffling is required, it should be performed by the implementing class. The implementation should not re-order the list provided but instead should make a copy of the list and re-order that. The ordering of the selection should be totally irrelevant for operators that process each candidate in isolation, such as mutation. It should only be an issue for operators, such as cross-over, that deal with multiple candidates in a single operation.

The operator should not modify any of the candidates passed in. Instead it should return a list that contains evolved copies of those candidates (umodified candidates can be included in the results without having to be copied).

Specified by:
apply in interface EvolutionaryOperator<BitString>
Parameters:
selectedCandidates - The individuals to evolve.
rng - A source of randomness for stochastic operators (most operators will be stochastic).
Returns:
The evolved individuals.

Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)