|
Orbital library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorbital.util.DelegateCollection
orbital.util.DelegateList
orbital.algorithm.evolutionary.Gene.List
public static class Gene.List
Represents a container gene that contains a list of other genes.
This list is especially useful for aggregating a collection of correlated genes into a single logical gene.
| 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.List()
|
|
Gene.List(java.lang.Class geneType,
int size)
new list of Genes. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Returns a deep copy of this exact type of gene. |
Metric |
distanceMeasure()
Get the distance measure for this class. |
protected Gene[] |
elementwiseRecombine(Gene[] parents,
int childrenCount,
double recombinationProbability)
Implemented as element-wise recombination, each gene does recombine, separately. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this collection for equality. |
java.lang.Object |
get()
Get the gene interpretation value. |
int |
hashCode()
Returns the hash code value for this collection. |
Gene |
inverse()
Get an inverted version of this Gene. |
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(java.lang.Object list)
Set the gene value. |
java.lang.String |
toString()
|
protected Gene[] |
uniformRecombine(Gene[] parents,
int childrenCount,
double recombinationProbability)
Implemented as uniform recombination, uniformly distributes genes to the children. |
| Methods inherited from class orbital.util.DelegateList |
|---|
add, addAll, get, indexOf, lastIndexOf, listIterator, listIterator, remove, set, setDelegatee, setDelegatee, subList |
| Methods inherited from class orbital.util.DelegateCollection |
|---|
add, addAll, clear, contains, containsAll, getDelegatee, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Constructor Detail |
|---|
public Gene.List(java.lang.Class geneType,
int size)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
geneType - the type of the member genes.size - the initial size of this list. i.e. the initial number of Genes.
java.lang.InstantiationException
java.lang.IllegalAccessExceptionpublic Gene.List()
| Method Detail |
|---|
public java.lang.Object clone()
clone in interface Geneclone in class java.lang.Objectpublic boolean equals(java.lang.Object o)
DelegateCollectionWhile the Collection interface adds no stipulations to the general contract for the Object.equals, programmers who implement the Collection interface "directly" (in other words, create a class that is a Collection but is not a Set or a List) must exercise care if they choose to override the Object.equals. It is not necessary to do so, and the simplest course of action is to rely on Object's implementation, but the implementer may wish to implement a "value comparison" in place of the default "reference comparison." (The List and Set interfaces mandate such value comparisons.)
The general contract for the Object.equals method states that equals must be symmetric (in other words, a.equals(b) if and only if b.equals(a)). The contracts for List.equals and Set.equals state that lists are only equal to other lists, and sets to other sets. Thus, a custom equals method for a collection class that implements neither the List nor Set interface must return false when this collection is compared to any list or set. (By the same logic, it is not possible to write a class that correctly implements both the Set and List interfaces.)
equals in interface java.util.Collectionequals in interface java.util.Listequals in interface Geneequals in class DelegateCollectiono - Object to be compared for equality with this collection.
Object.equals(Object),
Set.equals(Object),
List.equals(Object)public int hashCode()
DelegateCollection
hashCode in interface java.util.CollectionhashCode in interface java.util.ListhashCode in interface GenehashCode in class DelegateCollectionObject.hashCode(),
Object.equals(Object)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 list)
Gene
Consider setting fitness to Double.NaN due to the change to remind evaluator.
set in interface Genelist - the Object this gene should represent.
Encodes the value such that this gene represents the given object.public Gene mutate(double probability)
Implemented as Element-wise mutation.
mutate in interface Geneprobability - the probability rating of mutation level.
f.ex. 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..
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.elementwiseRecombine(Gene[],int,double)
protected Gene[] elementwiseRecombine(Gene[] parents,
int childrenCount,
double recombinationProbability)
Implemented as element-wise recombination, each gene does recombine, separately.
protected Gene[] uniformRecombine(Gene[] parents,
int childrenCount,
double recombinationProbability)
Implemented as uniform recombination, uniformly distributes genes to the children.
public Gene inverse()
Gene
Used in Population.create(Population, Genome, int) to form a balanced
and least biased initial population.
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 | |||||||||