com.rubecula.darwin.examples.travelingsalesman
Class Mutator_TS
java.lang.Object
net.sf.tostring0.AToString
com.rubecula.darwin.domain.genetics.Mutator_
com.rubecula.darwin.domain.genetics.Mutator_Random
com.rubecula.darwin.examples.travelingsalesman.Mutator_TS
- All Implemented Interfaces:
- Chancy, Mutator, net.sf.tostring0.Identifiable, net.sf.tostring0.IToString
public class Mutator_TS
- extends Mutator_Random
- Author:
- Robin Hillyard
Fields inherited from class com.rubecula.darwin.domain.genetics.Mutator_ |
LOG |
Fields inherited from interface net.sf.tostring0.IToString |
ANGBR_OPEN, ANGBRA_CLSE, BRA_CLSE, BRA_OPEN, BRCE_OPEN, BRCS_CLSE, COLON, LIST_SEPARATOR, MAX_ELEMENTS_DEFAULT, S_MT, S_PERCENT, SEPARATOR, SPACE |
Constructor Summary |
Mutator_TS(org.apache.commons.math.random.RandomGenerator random)
|
Mutator_TS(org.apache.commons.math.random.RandomGenerator random,
int odds)
|
Mutator_TS(org.apache.commons.math.random.RandomGenerator random,
int[] bands)
|
Methods inherited from class net.sf.tostring0.AToString |
toString, toString, toStringBrief, toStringId |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Mutator_TS
public Mutator_TS(org.apache.commons.math.random.RandomGenerator random)
- Parameters:
random
-
Mutator_TS
public Mutator_TS(org.apache.commons.math.random.RandomGenerator random,
int odds)
- Parameters:
random
- odds
-
Mutator_TS
public Mutator_TS(org.apache.commons.math.random.RandomGenerator random,
int[] bands)
- Parameters:
random
- bands
-
mutate
public Allele mutate(Allele allele)
- Description copied from class:
Mutator_
- By default, the allele is returned unchanged.
TEST
- Specified by:
mutate
in interface Mutator
- Overrides:
mutate
in class Mutator_Random
- Parameters:
allele
- the original allele
- Returns:
- either the original allele or a mutated version of it.
TODO it seems to me now that this mutation should operate on a
Gene, not on an Allele, but there again we have to remember that
the word "gene" is used in two different ways in common parlance.
- See Also:
Mutator_Random.mutate(com.rubecula.darwin.domain.helper.Allele)
mutate
public Genome mutate(Genome genome)
- Mutate the given genome. If the randomizer gets a hit (i.e. a mutation is
called for), the next value from the randomizer determines whether to add
a new gene (values 0-3) or to remove the current gene (value 4).
- Specified by:
mutate
in interface Mutator
- Overrides:
mutate
in class Mutator_
- Parameters:
genome
- the original genome
- Returns:
- either the original genome or a mutated version of it.
- See Also:
Mutator_.mutate(com.rubecula.darwin.domain.helper.Genome)
simplify
public boolean simplify(Genome genome)
- Iterate through the genome, removing pairs of complementary genes.
Normally, the caller will invoke the method again if this method returns
true, otherwise, it will consider that all work has been performed and no
further simplification is possible.
- Specified by:
simplify
in interface Mutator
- Overrides:
simplify
in class Mutator_
- Parameters:
genome
- TODO consider narrowing to Genotype
- Returns:
- true if the genome has been simplified.
- See Also:
Mutator_.simplify(com.rubecula.darwin.domain.helper.Genome)
Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.