|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.algorithm.evolutionary.Gene.BitSet
public static class Gene.BitSet
Bit string gene.
Much like DNA, this implementation uses a boolean-array as Gene data. However, the interpretation of this bit string is, of course, problem specific.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface orbital.algorithm.evolutionary.Gene |
---|
Gene.BitSet, Gene.BoundedFloat, Gene.BoundedInteger, Gene.Fixed, Gene.Float, Gene.Integer, Gene.List, Gene.Number |
Constructor Summary | |
---|---|
Gene.BitSet(int length)
Create a Gene of a certain length. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a clone of this gene. |
Metric |
distanceMeasure()
Get the distance measure for this class. |
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
get()
Get the gene interpretation value. |
boolean |
get(int index)
Get the boolean value at index. |
int |
hashCode()
|
Gene |
inverse()
Get an inverted version of this Gene. |
int |
length()
Get the length of the boolean data. |
Gene |
mutate(double probability)
Get a mutated version of this Gene. |
Gene[] |
recombine(Gene[] parents,
int childrenCount,
double recombinationProbability)
Genetically recombine gene data of parents to their children via reproduction.. |
void |
set(int index,
boolean value)
Set the boolean value at index. |
void |
set(java.lang.Object n)
Set the gene value. |
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Gene.BitSet(int length)
length
- the number of boolean data flags in this Gene.Method Detail |
---|
public java.lang.Object clone()
Gene
clone
in interface Gene
clone
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in interface Gene
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface Gene
hashCode
in class java.lang.Object
public final int length()
public boolean get(int index)
public void set(int index, boolean value)
Consider setting fitness to Double.NaN
due to the change to remind evaluator.
value
- the boolean value to be set at index.public java.lang.Object get()
Gene
Useful for interpreting a gene for fitness evaluation and interpretation of solutions.
get
in interface Gene
public void set(java.lang.Object n)
Gene
Consider setting fitness to Double.NaN
due to the change to remind evaluator.
set
in interface Gene
n
- the Object this gene should represent.
Encodes the value such that this gene represents the given object.public Gene mutate(double probability)
Implemented as uniform mutation. Each bit of Gene data will be flipped with a specified probability.
mutate
in interface Gene
probability
- the probability with that each bit of the Gene mutates.
public Gene[] recombine(Gene[] parents, int childrenCount, double recombinationProbability)
a a = direct ancestors to be used n * --- ; n = number of children to be produced p p = probability for each part of parent's Gene to be inherited a/p = elongation of Gene length n/a = growth of population size if n/a < 1 the population is contracting. if n/a = 1 the population size is fixed. if n/a > 1 the population is growing.Usually it is p=n/a..
Implemented as uniform recombination.
recombine
in interface Gene
parents
- the Genes to be used as parents for the children.
a
is the number of parents (direct ancestors).
parents are readonly.childrenCount
- the number of Gene children to produce and return.
n
is the number of children to be produced.recombinationProbability
- the probability with that parts of the inherited gene data
is recombined.
This does not necessarily imply an exchange of data, Genes might as well
realign or repair at random. But it makes a data recombination possible.
childrenCount
children produced.public Gene inverse()
inverse
in interface Gene
public Metric distanceMeasure()
Gene
Used to determine how different two genes are.
distanceMeasure
in interface Gene
public java.lang.String toString()
toString
in class java.lang.Object
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |