|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgap.ChromosomeMaterial
This is the guts of the original Chromosome object, pulled out so the genes can be modified by genetic operators before creating the Chromosome object. Also enables us to handle special cases, like sample chromosome, where you don't need a Configuration or fitness value. Also, made methods not synchronized, since only Genotype.evolve() should be modifying this object.
Constructor Summary | |
ChromosomeMaterial(java.util.Collection a_initialAlleles)
Create chromosome with no parents. |
|
ChromosomeMaterial(java.util.Collection a_initialGenes,
java.lang.Long aPrimaryParentId)
Create chromosome with one parents. |
|
ChromosomeMaterial(java.util.Collection a_initialAlleles,
java.lang.Long aPrimaryParentId,
java.lang.Long aSecondaryParentId)
Create chromosome with two parents. |
Method Summary | |
ChromosomeMaterial |
clone(java.lang.Long parentId)
Returns a copy of this ChromosomeMaterial. |
int |
compareTo(java.lang.Object other)
Compares the given Chromosome to this Chromosome. |
double |
distance(ChromosomeMaterial target,
SpeciationParms speciationParms)
Calculates compatibility distance between this and target according to NEAT speciation
methodology. |
boolean |
equals(java.lang.Object other)
Compares this Chromosome against the specified object. |
java.util.SortedSet |
getAlleles()
Retrieves the set of genes. |
java.lang.Long |
getPrimaryParentId()
|
java.lang.Long |
getSecondaryParentId()
|
static ChromosomeMaterial |
randomInitialChromosomeMaterial(Configuration a_activeConfiguration)
Convenience method that returns a new Chromosome instance with its genes values (alleles) randomized. |
void |
setSecondaryParentId(java.lang.Long id)
|
java.lang.String |
toString()
Returns a string representation of this Chromosome, useful for some display purposes. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ChromosomeMaterial(java.util.Collection a_initialAlleles, java.lang.Long aPrimaryParentId, java.lang.Long aSecondaryParentId)
a_initialAlleles
- aPrimaryParentId
- aSecondaryParentId
- public ChromosomeMaterial(java.util.Collection a_initialGenes, java.lang.Long aPrimaryParentId)
a_initialGenes
- aPrimaryParentId
- ChromosomeMaterial(Collection, Long, Long)
public ChromosomeMaterial(java.util.Collection a_initialAlleles)
a_initialAlleles
- ChromosomeMaterial(Collection, Long, Long)
Method Detail |
public ChromosomeMaterial clone(java.lang.Long parentId)
parentId
- represents ID of chromosome that was cloned. If this is initial chromosome
material without a parent, or is the clone of material only (e.g., before the it has become a
Chromosome), parentId == null.
public java.util.SortedSet getAlleles()
public java.lang.String toString()
public static ChromosomeMaterial randomInitialChromosomeMaterial(Configuration a_activeConfiguration) throws InvalidConfigurationException
a_activeConfiguration
- The current active configuration.
ChromosomeMaterial
InvalidConfigurationException
- if the given Configuration instance is invalid.
java.lang.IllegalArgumentException
- if the given Configuration instance is null.public boolean equals(java.lang.Object other)
other
- The object to compare against.
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
other
- The Chromosome against which to compare this chromosome.
Comparable.compareTo(java.lang.Object)
public java.lang.Long getPrimaryParentId()
public java.lang.Long getSecondaryParentId()
public void setSecondaryParentId(java.lang.Long id)
id
- ID of recessive parentpublic double distance(ChromosomeMaterial target, SpeciationParms speciationParms)
target
according to NEAT speciation
methodology. Made it generic enough that the genes do not have to be nodes and connections.
target
- speciationParms
-
target
Allele.distance(Allele)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |