public final class Genotype<G extends Gene<?,G>> extends Object implements Factory<Genotype<G>>, Iterable<Chromosome<G>>, Verifiable, XMLSerializable, Realtime, Immutable
Genotype. It is the
structural representative of an individual. This class is the encoded problem
solution with one to many Chromosome.
final Genotype〈Float64Gene〉 genotype = Genotype.valueOf(
new Float64Chromosome(0.0, 1.0, 8),
new Float64Chromosome(1.0, 2.0, 10),
new Float64Chromosome(0.0, 10.0, 9),
new Float64Chromosome(0.1, 0.9, 5)
);Float64Gene has been chosen as
gene type.| Modifier and Type | Method and Description |
|---|---|
static <T extends Gene<?,T>> |
Chromosome()
Return a converter which access the first chromosome of this genotype.
|
static <T extends Gene<?,T>> |
Chromosome(int index)
Return a converter which access the chromosome with the given index of
this genotype.
|
static <T extends Gene<?,T>> |
Chromosomes()
Return a converter which access the chromosome array of this genotype.
|
boolean |
equals(Object o) |
Chromosome<G> |
getChromosome()
Return the first chromosome.
|
Chromosome<G> |
getChromosome(int index)
Return the chromosome at the given index.
|
G |
getGene()
|
int |
getNumberOfGenes()
Return the number of genes this genotype consists of.
|
int |
hashCode() |
boolean |
isValid()
Test if this genotype is valid.
|
Iterator<Chromosome<G>> |
iterator() |
int |
length()
Getting the number of chromosomes of this genotype.
|
Genotype<G> |
newInstance()
Return a new, random genotype by creating new, random chromosomes (calling
the
Factory.newInstance() method) from the chromosomes of this
genotype. |
ISeq<Chromosome<G>> |
toSeq() |
String |
toString() |
Text |
toText() |
static <G extends Gene<?,G>> |
valueOf(Chromosome<G>... chromosomes)
Create a new Genotype from a given array of
Chromosomes. |
static <G extends Gene<?,G>> |
valueOf(ISeq<? extends Chromosome<G>> chromosomes)
Create a new Genotype from a given array of
Chromosomes. |
public Chromosome<G> getChromosome(int index)
index - Chromosome index.IndexOutOfBoundsException - if (index < 0 || index >= _length).public Chromosome<G> getChromosome()
final Genotype〈Float64Gene〉 gt = ...
final Chromosome〈Float64Gene〉 chromosome = gt.getChromosome(0);public G getGene()
Gene of the first Chromosome of this
Genotype. This is a shortcut for
final Genotype〈Float64Gene〉 gt = ...
final Float64Gene gene = gt.getChromosome(0).getGene(0);Gene of the first Chromosome of this
Genotype.public ISeq<Chromosome<G>> toSeq()
public Iterator<Chromosome<G>> iterator()
public int length()
public int getNumberOfGenes()
public boolean isValid()
Chromosomes are valid.isValid in interface Verifiablepublic Genotype<G> newInstance()
Factory.newInstance() method) from the chromosomes of this
genotype.public static <T extends Gene<?,T>> Function<Genotype<T>,ISeq<Chromosome<T>>> Chromosomes()
public static <T extends Gene<?,T>> Function<Genotype<T>,Chromosome<T>> Chromosome(int index)
public static <T extends Gene<?,T>> Function<Genotype<T>,Chromosome<T>> Chromosome()
public static <G extends Gene<?,G>> Genotype<G> valueOf(ISeq<? extends Chromosome<G>> chromosomes)
Chromosomes.chromosomes - The Chromosome array the Genotype
consists of.NullPointerException - if chromosomes is null or one of its
element.IllegalArgumentException - if chromosome.length == 0.@SafeVarargs public static <G extends Gene<?,G>> Genotype<G> valueOf(Chromosome<G>... chromosomes)
Chromosomes.chromosomes - The Chromosome array the Genotype
consists of.NullPointerException - if chromosomes is null or one of its
element.IllegalArgumentException - if chromosome.length == 0.© 2007-2013 Franz Wilhelmstötter (2013-12-18 20:17)