|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.artoflife.gp.Chromosome
An element of an Individual
's genotype, has
a unique id to ensure compatibility during crossover,
and can be mutated. Should act upon a Phenotype
during expression. Can be serialized (as part of an Individual)
and cloned.
Constructor Summary | |
Chromosome(java.lang.String id)
|
Method Summary | |
java.lang.Object |
clone()
Must be able to clone an Individual's genome during clone of an Individual. |
boolean |
compatibleWith(Chromosome chromosome)
|
abstract void |
crossover(Chromosome chromosome2)
Subclasses should ensure compatibility before doing the crossover, throwing an IncompatibleGenotypeException
if not. |
java.lang.String |
getId()
|
abstract int |
getSize()
The size of this chromosome, used when selecting between two Individuals with the same Fitness, when the smallest is chosen. |
abstract void |
mutate(float probability)
Mutate the genes within this Individual's Chromosome s with a given probability. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Chromosome(java.lang.String id)
id
- a unique id that identifies the type of
this Chromosome. A Chromosome can only crossover
with others of the same type (id). Suggested naming
convention: "Individual_Type.Chromosome_Number",
for example "Mondrian.1". May not be null.
java.lang.IllegalArgumentException
- if if is nullMethod Detail |
public java.lang.String getId()
public boolean compatibleWith(Chromosome chromosome)
public abstract void mutate(float probability)
Chromosome
s with a given probability.
probability
- between 0 (never) and 1.0 (always)public abstract void crossover(Chromosome chromosome2) throws IncompatibleChromosomeException
IncompatibleGenotypeException
if not.
chromosome2
- the Chromosome to crossover this
one with
IncompatibleGenotypeException
- if the chromosomes
are not compatible
IncompatibleChromosomeException
public abstract int getSize()
public java.lang.Object clone()
clone
in class java.lang.Object
|
artoflife pre0.1.0-dev | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |