|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Genes represent the discrete components of a potential solution (the Chromosome). This interface exists so that custom gene implementations can be easily plugged-in, which can add a great deal of flexibility and convenience for many applications. Note that it's very important that implementations of this interface also implement the equals() method. Without a proper implementation of equals(), some genetic operations will fail to work properly.
| Field Summary | |
static java.lang.String |
CVS_REVISION
String containing the CVS revision. |
static java.lang.String |
PERSISTENT_FIELD_DELIMITER
Represents the delimiter that is used to separate fields in the persistent representation of DoubleGene instances. |
| Method Summary | |
void |
applyMutation(int index,
double a_percentage)
Applies a mutation of a given intensity (percentage) onto the atomic element at given index (NumberGenes only have one atomic element) |
void |
cleanup()
Executed by the genetic engine when this Gene instance is no longer needed and should perform any necessary resource cleanup. |
java.lang.Object |
getAllele()
Retrieves the value represented by this Gene. |
java.lang.String |
getPersistentRepresentation()
Retrieves a string representation of the value of this Gene instance that includes any information required to reconstruct it at a later time, such as its value and internal state. |
Gene |
newGene()
Provides an implementation-independent means for creating new Gene instances. |
void |
setAllele(java.lang.Object a_newValue)
Sets the value of this Gene to the new given value. |
void |
setToRandomValue(RandomGenerator a_numberGenerator)
Sets the value of this Gene to a random legal value for the implementation. |
void |
setValueFromPersistentRepresentation(java.lang.String a_representation)
Sets the value and internal state of this Gene from the string representation returned by a previous invocation of the getPersistentRepresentation() method. |
int |
size()
|
java.lang.String |
toString()
|
| Methods inherited from interface java.lang.Comparable |
compareTo |
| Field Detail |
public static final java.lang.String CVS_REVISION
public static final java.lang.String PERSISTENT_FIELD_DELIMITER
| Method Detail |
public Gene newGene()
It should be noted that nothing is guaranteed about the actual value of the returned Gene and it should therefore be considered to be undefined.
public void setAllele(java.lang.Object a_newValue)
a_newValue - the new value of this Gene instance.public java.lang.Object getAllele()
public java.lang.String getPersistentRepresentation()
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - to indicate that no implementation
is provided for this method.
public void setValueFromPersistentRepresentation(java.lang.String a_representation)
throws java.lang.UnsupportedOperationException,
UnsupportedRepresentationException
a_representation - the string representation retrieved from a
prior call to the getPersistentRepresentation()
method.
java.lang.UnsupportedOperationException - to indicate that no implementation
is provided for this method.
UnsupportedRepresentationException - if this Gene implementation
does not support the given string representation.public void setToRandomValue(RandomGenerator a_numberGenerator)
a_numberGenerator - The random number generator that should be
used to create any random values. It's important
to use this generator to maintain the user's
flexibility to configure the genetic engine
to use the random number generator of their
choice.public void cleanup()
public java.lang.String toString()
public int size()
public void applyMutation(int index,
double a_percentage)
index - index of atomic element, between 0 and size()-1a_percentage - percentage of mutation (greater than -1 and smaller
than 1).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||