evSOLve.JEvolution
Class PermChromosome

java.lang.Object
  |
  +--evSOLve.JEvolution.Chromosome
        |
        +--evSOLve.JEvolution.PermChromosome
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
SubsetPermChromosome

public class PermChromosome
extends Chromosome

Permutation encoding. The bases are implemented as a Vector of Integers having permutation property. Integer values range form 0 to length-1. Mutation is implemented as swapping of bases, crossover is PMX (the number of crossover points is always 2).

Version:
0.4
Author:
Helmut A. Mayer
See Also:
Serialized Form

Field Summary
protected  java.util.Vector bases
           
protected  int indexA
           
protected  int indexB
           
 
Fields inherited from class evSOLve.JEvolution.Chromosome
BIASED, crossoverPoints, crossoverRate, JA, LAPLACE, length, mutationRate, soupType, utils
 
Constructor Summary
PermChromosome()
          The standard constructor.
 
Method Summary
 java.lang.Object clone()
          A proper clone.
protected  void doCrossover(Chromosome father)
          PMX Crossover.
protected  void doMutation()
          Mutate by swapping two bases saving the permutation property.
protected  void doSwap(java.util.Vector b)
          Exchange two bases of the chromosome.
 boolean equals(java.lang.Object o)
          An efficient check for equality.
 java.lang.Object getBases()
          Return the genetic information.
 int hashCode()
          An efficient hash code.
 java.lang.String toString()
          Convert chromosome to string.
 
Methods inherited from class evSOLve.JEvolution.Chromosome
getCrossoverPoints, getCrossoverRate, getLength, getMutationRate, getSoupType, setCrossoverPoints, setCrossoverRate, setLength, setMutationRate, setSoupType
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

bases

protected java.util.Vector bases

indexA

protected int indexA

indexB

protected int indexB
Constructor Detail

PermChromosome

public PermChromosome()
The standard constructor.
Parameters:
GA - With all parameters.
Method Detail

clone

public java.lang.Object clone()
A proper clone.
Overrides:
clone in class Chromosome

equals

public boolean equals(java.lang.Object o)
An efficient check for equality. It only checks the bases, first, if the number of bases is equal, and then if the base values are the same.
Overrides:
equals in class Chromosome

hashCode

public int hashCode()
An efficient hash code. Uses Vector.hashCode().
Overrides:
hashCode in class Chromosome

doMutation

protected void doMutation()
Mutate by swapping two bases saving the permutation property.
Overrides:
doMutation in class Chromosome

doCrossover

protected void doCrossover(Chromosome father)
PMX Crossover.
Overrides:
doCrossover in class Chromosome
Parameters:
father - A parent Chromosome.

getBases

public java.lang.Object getBases()
Return the genetic information.

toString

public java.lang.String toString()
Convert chromosome to string. The first base (the rightmost) has index 0.
Overrides:
toString in class Chromosome

doSwap

protected void doSwap(java.util.Vector b)
Exchange two bases of the chromosome. Uses protected variables. 'indexA' and 'indexB' must point to the bases to be exchanged!
Parameters:
b - The Vector of bases.