Orbital library

orbital.algorithm.evolutionary
Class Gene.Integer

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

public static class Gene.Integer
extends Gene.Number

Integer gene data.

This implementation uses an Integer as gene data.

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.Integer()
          Construct a non-initialized Integer.
Gene.Integer(int data)
           
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this gene.
 double doubleValue()
           
 java.lang.Object get()
          Get the gene interpretation value.
 int intValue()
           
 Gene[] recombine(Gene[] parents, int childrenCount, double recombinationProbability)
          Genetically recombine gene data of parents to their children via reproduction.
 void set(int n)
           
 void set(java.lang.Object n)
          Set the gene value.
 java.lang.String toString()
           
 
Methods inherited from class orbital.algorithm.evolutionary.Gene.Number
distanceMeasure, equals, floatValue, hashCode, inverse, longValue, mutate
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Gene.Integer

public Gene.Integer(int data)

Gene.Integer

public Gene.Integer()
Construct a non-initialized Integer.

Note: non-initialized (that is Integer.MIN_VALUE) Integers are no good starting-point for creating a population.

Method Detail

clone

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

Specified by:
clone in interface Gene
Specified by:
clone in class Gene.Number

get

public java.lang.Object get()
Description copied from interface: Gene
Get the gene interpretation value.

Useful for interpreting a gene for fitness evaluation and interpretation of solutions.

Returns:
the Object represented by this gene. Interprets gene by decoding its data.

intValue

public int intValue()
Overrides:
intValue in class Gene.Number

doubleValue

public double doubleValue()
Specified by:
doubleValue in class java.lang.Number

set

public void set(java.lang.Object n)
Description copied from interface: Gene
Set the gene value.

Consider setting fitness to Double.NaN due to the change to remind evaluator.

Parameters:
n - the Object this gene should represent. Encodes the value such that this gene represents the given object.

set

public void set(int n)

recombine

public Gene[] recombine(Gene[] parents,
                        int childrenCount,
                        double recombinationProbability)
Description copied from interface: Gene
Genetically recombine gene data of parents to their children via reproduction.
 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.

Parameters:
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.
Returns:
the new childrenCount children produced.

toString

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

Orbital library
1.3.0: 11 Apr 2009

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