org.vizzini.ai.geneticalgorithm
Class ChromosomeDouble

java.lang.Object
  extended by org.vizzini.ai.geneticalgorithm.AbstractChromosome
      extended by org.vizzini.ai.geneticalgorithm.ChromosomeDouble
All Implemented Interfaces:
Cloneable, Comparable, IChromosome
Direct Known Subclasses:
ChromosomeNeuralNetwork

public class ChromosomeDouble
extends AbstractChromosome

Provides a chromosome which contains double s.

Since:
v0.1
Version:
v0.3
Author:
Jeffrey M. Thompson

Field Summary
 
Fields inherited from interface org.vizzini.ai.geneticalgorithm.IChromosome
UNKNOWN_FITNESS
 
Constructor Summary
ChromosomeDouble(int size)
          Construct this object using the given parameter.
 
Method Summary
 Object clone()
          Return a clone of this instance.
 void copy(IChromosome another)
          Copy the given chromosome into this.
 boolean equals(Object object)
          Return true if the given object is equal to this.
 double get(int index)
          Return the gene at the given index.
 int hashCode()
          Returns a hash code value for the object.
 void mix(IChromosome c1, IChromosome c2, boolean[] mask)
          Mix the genes of the given chromosomes into this using the given mask.
 void mix(IChromosome c1, IChromosome c2, double fraction)
          Mix the genes of the given chromosomes into this using the given fraction.
 void mutate(double mutationRate, double mutationMagnitude)
          Mutate this chromosome's genes using the given parameters.
 void randomlyInitialize()
          Initialize the genes with random values.
 void set(int index, double value)
          Set the gene at index to the given value.
 void setRandomMax(double max)
          Set the maximum used for random initialization.
 void setRandomMin(double min)
          Set the minimum used for random initialization.
 int size()
          Return the number of genes.
 void splice(IChromosome c1, IChromosome c2, int cut)
          Splice the given chromosomes into this using the given cut index.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class org.vizzini.ai.geneticalgorithm.AbstractChromosome
addFitness, compareTo, getDescription, getFitness, isFitnessUnknown, setDescription, setFitness, setFitnessUnknown
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChromosomeDouble

public ChromosomeDouble(int size)
Construct this object using the given parameter.

Since:
v0.1
Method Detail

clone

public Object clone()
Return a clone of this instance. Extend the super method to clone the genes array.

Specified by:
clone in interface IChromosome
Overrides:
clone in class AbstractChromosome
Since:
v0.2

copy

public void copy(IChromosome another)
Copy the given chromosome into this.

Specified by:
copy in interface IChromosome
Overrides:
copy in class AbstractChromosome
Since:
v0.1

equals

public boolean equals(Object object)
Return true if the given object is equal to this.

Specified by:
equals in interface IChromosome
Overrides:
equals in class AbstractChromosome
Parameters:
object - The object to compare.
Since:
v0.1

get

public double get(int index)
Return the gene at the given index.

Since:
v0.1

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class AbstractChromosome
Since:
v0.1

mix

public void mix(IChromosome c1,
                IChromosome c2,
                boolean[] mask)
Mix the genes of the given chromosomes into this using the given mask.

Since:
v0.1

mix

public void mix(IChromosome c1,
                IChromosome c2,
                double fraction)
Mix the genes of the given chromosomes into this using the given fraction.

Specified by:
mix in interface IChromosome
Overrides:
mix in class AbstractChromosome
Since:
v0.3

mutate

public void mutate(double mutationRate,
                   double mutationMagnitude)
Mutate this chromosome's genes using the given parameters.

Parameters:
mutationRate - Probability of a gene being mutated.
mutationMagnitude - The maximum allowed magnitude of the mutation.
Since:
v0.1

randomlyInitialize

public void randomlyInitialize()
Initialize the genes with random values.

Since:
v0.1

set

public void set(int index,
                double value)
Set the gene at index to the given value.


setRandomMax

public void setRandomMax(double max)
Set the maximum used for random initialization.

Since:
v0.1

setRandomMin

public void setRandomMin(double min)
Set the minimum used for random initialization.

Since:
v0.1

size

public int size()
Return the number of genes.

Since:
v0.1

splice

public void splice(IChromosome c1,
                   IChromosome c2,
                   int cut)
Splice the given chromosomes into this using the given cut index.

Since:
v0.1

toString

public String toString()
Return a string representation of this object.

Overrides:
toString in class AbstractChromosome
Since:
v0.1


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02