|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgap.Genotype
Genotypes are fixed-length populations of chromosomes. As an instance of a
Genotype
is evolved, all of its Chromosome
objects are also
evolved. A Genotype
may be constructed normally, whereby an array of
Chromosome
objects must be provided, or the static
randomInitialGenotype()
method can be used to generate a Genotype
with a randomized Chromosome
population. Changes made by Tucker and James for
ANJI :
evolve()
addChromosome*()
methods
Field Summary | |
protected Configuration |
m_activeConfiguration
The current active Configuration instance. |
protected java.util.List |
m_chromosomes
Chromosomes that makeup thie Genotype's population. |
protected java.util.List |
m_species
Species that makeup this Genotype's population. |
Constructor Summary | |
Genotype(Configuration a_activeConfiguration,
java.util.List a_initialChromosomes)
This constructor is used for random initial Genotypes. |
Method Summary | |
protected void |
addChromosome(Chromosome chrom)
add chromosome to population and to appropriate specie |
protected void |
addChromosomeFromMaterial(ChromosomeMaterial cMat)
|
protected void |
addChromosomes(java.util.Collection chromosomes)
|
protected void |
addChromosomesFromMaterial(java.util.Collection chromosomeMaterial)
|
boolean |
equals(java.lang.Object other)
Compares this Genotype against the specified object. |
void |
evolve()
Performs one generation cycle, evaluating fitness, selecting survivors, repopulting with offspring, and mutating new population. |
java.util.List |
getChromosomes()
|
Chromosome |
getFittestChromosome()
Retrieves the Chromosome in the population with the highest fitness value. |
java.util.List |
getSpecies()
|
static Genotype |
randomInitialGenotype(Configuration a_activeConfiguration)
Convenience method that returns a newly constructed Genotype instance configured according to the given Configuration instance. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Configuration m_activeConfiguration
protected java.util.List m_species
protected java.util.List m_chromosomes
Constructor Detail |
public Genotype(Configuration a_activeConfiguration, java.util.List a_initialChromosomes) throws InvalidConfigurationException
a_activeConfiguration
- The current active Configuration object.a_initialChromosomes
- List
contains Chromosome objects: The Chromosome
population to be managed by this Genotype instance.
java.lang.IllegalArgumentException
- if either the given Configuration object or the array of
Chromosomes is null, or if any of the Genes in the array of Chromosomes is null.
InvalidConfigurationException
- if the given Configuration object is in an invalid
state.Method Detail |
protected void addChromosomes(java.util.Collection chromosomes)
chromosomes
- Collection
contains Chromosome objectsaddChromosome(Chromosome)
protected void addChromosomesFromMaterial(java.util.Collection chromosomeMaterial)
chromosomeMaterial
- Collection
contains ChromosomeMaterial objectsaddChromosomeFromMaterial(ChromosomeMaterial)
protected void addChromosomeFromMaterial(ChromosomeMaterial cMat)
cMat
- chromosome material from which to construct new chromosome objectaddChromosome(Chromosome)
protected void addChromosome(Chromosome chrom)
chrom
- public java.util.List getChromosomes()
public java.util.List getSpecies()
public Chromosome getFittestChromosome()
public void evolve()
GeneticOperator
into
ReproductionOperator
and MutationOperator
. New order of
operations:
BulkFitnessFunction
or FitnessFunction
GeneticEvent.GENOTYPE_EVALUATED_EVENT
is fired between steps 2
and 3. Genetic event GeneticEvent.GENOTYPE_EVOLVED_EVENT
is fired after step
4.
public java.lang.String toString()
String
representation of this Genotype
instance.public static Genotype randomInitialGenotype(Configuration a_activeConfiguration) throws InvalidConfigurationException
Note that the given Configuration instance must be in a valid state at the time this method is invoked, or an InvalidConfigurationException will be thrown.
a_activeConfiguration
-
InvalidConfigurationException
- if the given Configuration instance not in a valid
state.public boolean equals(java.lang.Object other)
other
- The object to compare against.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |