|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.BaseGene
org.jgap.impl.NumberGene
org.jgap.impl.MutipleIntegerGene
public class MutipleIntegerGene
Extension of IntegerGene. The only difference is that this gene allele has to be a multiple of a specific significance, ie Gene gene = new MutipleIntegerGene(configuration, -100,100,3); The genes allele must be between -100 and 100 and be a multiple of 3.
| Field Summary | |
|---|---|
protected static long |
INTEGER_RANGE
Represents the constant range of values supported by integers. |
| Fields inherited from class org.jgap.BaseGene |
|---|
DELTA, S_APPLICATION_DATA |
| Fields inherited from interface org.jgap.Gene |
|---|
PERSISTENT_FIELD_DELIMITER |
| Constructor Summary | |
|---|---|
MutipleIntegerGene()
|
|
MutipleIntegerGene(Configuration a_config)
Constructs a new IntegerGene with default settings. |
|
MutipleIntegerGene(Configuration a_config,
int a_lowerBound,
int a_upperBound,
int a_significance)
Constructs a new IntegerGene with the specified lower and upper bounds for values (alleles) of this Gene instance. |
|
| Method Summary | |
|---|---|
void |
applyMutation(int a_index,
double a_percentage)
See interface Gene for description. |
protected int |
compareToNative(java.lang.Object a_o1,
java.lang.Object a_o2)
Compares to objects by first casting them into their expected type (e.g. |
int |
getLowerBounds()
|
java.lang.String |
getPersistentRepresentation()
Retrieves a string representation of this Gene that includes any information required to reconstruct it at a later time, such as its value and internal state. |
int |
getSignificance()
|
int |
getUpperBounds()
|
int |
hashCode()
Modified hashCode() function to return different hashcodes for differently ordered genes in a chromosome. |
protected void |
mapValueToWithinBounds()
Maps the value of this IntegerGene to within the bounds specified by the m_upperBounds and m_lowerBounds instance variables. |
protected Gene |
newGeneInternal()
Provides implementation-independent means for creating new Gene instances. |
void |
setToRandomValue(RandomGenerator a_numberGenerator)
Sets the value (allele) of this Gene to a random Integer value between the lower and upper bounds (if any) of this Gene. |
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. |
java.lang.String |
toString()
Retrieves a string representation of this Gene's value that may be useful for display purposes. |
| Methods inherited from class org.jgap.impl.NumberGene |
|---|
compareTo, getInternalValue, setAllele |
| Methods inherited from class org.jgap.BaseGene |
|---|
cleanup, compareApplicationData, decode, encode, equals, getAllele, getApplicationData, getBusinessKey, getConfiguration, getConstraintChecker, getEnergy, getUniqueID, getUniqueIDTemplate, isCompareApplicationData, newGene, setApplicationData, setCompareApplicationData, setConstraintChecker, setEnergy, setUniqueIDTemplate, size |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final long INTEGER_RANGE
| Constructor Detail |
|---|
public MutipleIntegerGene()
throws InvalidConfigurationException
InvalidConfigurationException
public MutipleIntegerGene(Configuration a_config)
throws InvalidConfigurationException
a_config - the configuration to use
InvalidConfigurationException
public MutipleIntegerGene(Configuration a_config,
int a_lowerBound,
int a_upperBound,
int a_significance)
throws InvalidConfigurationException
a_config - the configuration to usea_lowerBound - the lowest value that this Gene may possess,
inclusivelya_upperBound - the highest value that this Gene may possess,
inclusively
InvalidConfigurationException| Method Detail |
|---|
protected Gene newGeneInternal()
newGeneInternal in class BaseGenepublic java.lang.String getPersistentRepresentation()
getPersistentRepresentation in interface GenegetPersistentRepresentation in interface IPersistentRepresentation
public void setValueFromPersistentRepresentation(java.lang.String a_representation)
throws UnsupportedRepresentationException
setValueFromPersistentRepresentation in interface GenesetValueFromPersistentRepresentation in interface IPersistentRepresentationa_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 representationpublic void setToRandomValue(RandomGenerator a_numberGenerator)
setToRandomValue in interface Genea_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
protected int compareToNative(java.lang.Object a_o1,
java.lang.Object a_o2)
compareToNative in class NumberGenea_o1 - first object to be compared, always is not nulla_o2 - second object to be compared, always is not null
protected void mapValueToWithinBounds()
mapValueToWithinBounds in class NumberGene
public void applyMutation(int a_index,
double a_percentage)
applyMutation in interface Genea_index - ignored (because there is only 1 atomic element)a_percentage - percentage of mutation (greater than -1 and smaller
than 1)public int hashCode()
hashCode in class BaseGenepublic java.lang.String toString()
BaseGene
toString in interface GenetoString in class BaseGenepublic int getLowerBounds()
public int getUpperBounds()
public int getSignificance()
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||