|
Orbital library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorbital.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 Geneclone in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in interface Geneequals in class java.lang.Objectpublic int hashCode()
hashCode in interface GenehashCode in class java.lang.Objectpublic 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()
GeneUseful for interpreting a gene for fitness evaluation and interpretation of solutions.
get in interface Genepublic void set(java.lang.Object n)
Gene
Consider setting fitness to Double.NaN due to the change to remind evaluator.
set in interface Genen - 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 Geneprobability - 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 Geneparents - 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 Genepublic Metric distanceMeasure()
GeneUsed to determine how different two genes are.
distanceMeasure in interface Genepublic java.lang.String toString()
toString in class java.lang.Object
|
Orbital library 1.2.0: 23 Apr 2008 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||