Orbital library

orbital.algorithm.evolutionary
Interface Gene

All Known Implementing Classes:
Gene.BitSet, Gene.BoundedFloat, Gene.BoundedInteger, Gene.Fixed, Gene.Float, Gene.Integer, Gene.List, Gene.Number, Genome

public interface Gene

Base interface for a gene data model in a genome.

A gene provides the following operators and functions:

Author:
André Platzer

Nested Class Summary
static class Gene.BitSet
          Bit string gene.
static class Gene.BoundedFloat
          Bounded floating point gene data.
static class Gene.BoundedInteger
          Bounded integer gene data.
static class Gene.Fixed
          Fixed point gene data.
static class Gene.Float
          Floating point gene data.
static class Gene.Integer
          Integer gene data.
static class Gene.List
          Represents a container gene that contains a list of other genes.
static class Gene.Number
          Numeric gene data.
 
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.
 int hashCode()
           
 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 value)
          Set the gene value.
 

Method Detail

clone

java.lang.Object clone()
Returns a clone of this gene.

Postconditions:
RES.equals(this) ∧ RES≠OLD(RES)

equals

boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

int hashCode()
Overrides:
hashCode in class java.lang.Object

get

java.lang.Object get()
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.

set

void set(java.lang.Object value)
Set the gene value.

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

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

mutate

Gene mutate(double probability)
Get a mutated version of this 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.

recombine

Gene[] recombine(Gene[] parents,
                 int childrenCount,
                 double recombinationProbability)
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.
Preconditions:
∃i parents[i] == this, and parents are allels
Postconditions:
RES.length == childrenCount

inverse

Gene inverse()
Get an inverted version of this Gene.

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

Returns:
the complementary inverted Gene.

distanceMeasure

Metric distanceMeasure()
Get the distance measure for this class.

Used to determine how different two genes are.

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.