Orbital library

orbital.algorithm.evolutionary
Class Gene.Number

java.lang.Object
  extended by java.lang.Number
      extended by orbital.algorithm.evolutionary.Gene.Number
All Implemented Interfaces:
java.io.Serializable, Gene
Direct Known Subclasses:
Gene.Float, Gene.Integer
Enclosing interface:
Gene

public abstract static class Gene.Number
extends java.lang.Number
implements Gene, java.io.Serializable

Numeric gene data.

This class is the base class for gene data with a numeric interpretation.

Note however, that all numeric genes could as well be encoded with a mere bit string. Although default uniform mutations and recombination would then have a dramatic effect on these bit string encoded values. This is the reason for introducing explicit genes with numeric interpretations.

Author:
André Platzer
See Also:
Serialized Form

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.Number()
           
 
Method Summary
abstract  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)
          Checks two gene numbers for equality according to their doubleValue.
 float floatValue()
           
 int hashCode()
          Calculates a hash code according to the doubleValue.
 int intValue()
           
 Gene inverse()
          Get an inverted version of this Gene.
 long longValue()
           
 Gene mutate(double probability)
          Get a mutated version of this Gene.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Number
byteValue, doubleValue, shortValue
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface orbital.algorithm.evolutionary.Gene
get, recombine, set
 

Constructor Detail

Gene.Number

public Gene.Number()
Method Detail

clone

public abstract java.lang.Object clone()
Description copied from interface: Gene
Returns a clone of this gene.

Specified by:
clone in interface Gene
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Checks two gene numbers for equality according to their doubleValue.

Specified by:
equals in interface Gene
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Calculates a hash code according to the doubleValue.

Specified by:
hashCode in interface Gene
Overrides:
hashCode in class java.lang.Object

intValue

public int intValue()
Specified by:
intValue in class java.lang.Number

longValue

public long longValue()
Specified by:
longValue in class java.lang.Number

floatValue

public float floatValue()
Specified by:
floatValue in class java.lang.Number

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

inverse

public Gene inverse()
Description copied from interface: Gene
Get an inverted version of this Gene.

Used in Population.create(Population, Genome, int) to form a balanced and least biased initial population.

Specified by:
inverse in interface Gene
Returns:
the complementary inverted Gene.

mutate

public Gene mutate(double probability)
Description copied from interface: Gene
Get a mutated version of this Gene.

Specified by:
mutate in interface Gene
Parameters:
probability - the probability rating of mutation level. f.ex. probability with that each bit of the Gene mutates.
Returns:
a new gene that is a mutation of this one.

distanceMeasure

public Metric distanceMeasure()
Description copied from interface: Gene
Get the distance measure for this class.

Used to determine how different two genes are.

Specified by:
distanceMeasure in interface Gene
Returns:
a distance measure whose deviation is 1 such that it can easily be used as a measure for similarity. Additionally, only positive numbers should be returned. So this distance measure only has values in [0,1].

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.