evolution
Class Chromosome

java.lang.Object
  extended by evolution.Chromosome
All Implemented Interfaces:
ChromosomeModel, java.lang.Cloneable

public class Chromosome
extends java.lang.Object
implements ChromosomeModel

Chromosome with bit representation


Constructor Summary
Chromosome(int chromosomeSize, double crossOverProbability, FitnessFunctionModel fitnessFunction, GeneToStringModel toStringFunction, java.lang.Object[] geneTypes)
          Creates a new instance of Chromosome
Chromosome(int chromosomeSize, FitnessFunctionModel fitnessFunction, GeneToStringModel toStringFunction, java.lang.Object[] geneTypes)
          Creates a new instance of Chromosome
 
Method Summary
 java.lang.Object clone()
          Return copy of the chromosome
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this network.
 int geneMutation(int geneNumber)
          Mutant gene specified by genNumber.
 int getChromosomeSize()
          Return size of the chromosome
 double getCrossOverProbability()
          Return cross over propability
 FitnessFunctionModel getFitnessFunciton()
          Return reference to fitness function
 double getFitnessValue()
          Return fitness value of the chromosome
 java.lang.Object getGene(int geneNumber)
          Return gene for with specified gene NUmber
 double getMutationProbability()
          Return mutation propability
 void setCrossOverProbability(double crossOverProbality)
          Set propability of cross over
 void setFitnessFunciton(FitnessFunctionModel fitnessFunction)
          Set fitness function
 void setGene(int geneNumber, java.lang.Object value)
          Set gene with specified value
 void setMutationProbability(double mutationProbability)
          Set mutation probability
 java.lang.String toString()
          Return string representation of the chromosome
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Chromosome

public Chromosome(int chromosomeSize,
                  FitnessFunctionModel fitnessFunction,
                  GeneToStringModel toStringFunction,
                  java.lang.Object[] geneTypes)
Creates a new instance of Chromosome

Parameters:
chromosomeSize - size of chromosome
fitnessFunction - reference to fitness function
toStringFunction - Reference to toStringFunction
geneTypes - Array of gene types

Chromosome

public Chromosome(int chromosomeSize,
                  double crossOverProbability,
                  FitnessFunctionModel fitnessFunction,
                  GeneToStringModel toStringFunction,
                  java.lang.Object[] geneTypes)
Creates a new instance of Chromosome

Parameters:
chromosomeSize - chromosome size
crossOverProbability - cross over propability
fitnessFunction - reference to fitness function
toStringFunction - Reference to toStringFunction
geneTypes - Array of gene types
Method Detail

setMutationProbability

public void setMutationProbability(double mutationProbability)
Set mutation probability

Specified by:
setMutationProbability in interface ChromosomeModel
Parameters:
mutationProbability - Mutation propability

setGene

public void setGene(int geneNumber,
                    java.lang.Object value)
Set gene with specified value

Specified by:
setGene in interface ChromosomeModel
Parameters:
geneNumber - Gene number
value - Gene value

getMutationProbability

public double getMutationProbability()
Return mutation propability

Specified by:
getMutationProbability in interface ChromosomeModel
Returns:
Mutation propability

getGene

public java.lang.Object getGene(int geneNumber)
Return gene for with specified gene NUmber

Specified by:
getGene in interface ChromosomeModel
Parameters:
geneNumber - Gene number
Returns:
Gene

getCrossOverProbability

public double getCrossOverProbability()
Return cross over propability

Specified by:
getCrossOverProbability in interface ChromosomeModel
Returns:
cross over propability

setCrossOverProbability

public void setCrossOverProbability(double crossOverProbality)
Set propability of cross over

Specified by:
setCrossOverProbability in interface ChromosomeModel
Parameters:
crossOverProbality - cross over propability

setFitnessFunciton

public void setFitnessFunciton(FitnessFunctionModel fitnessFunction)
Set fitness function

Specified by:
setFitnessFunciton in interface ChromosomeModel
Parameters:
fitnessFunction - referenct to fitness function

getFitnessFunciton

public FitnessFunctionModel getFitnessFunciton()
Return reference to fitness function

Specified by:
getFitnessFunciton in interface ChromosomeModel
Returns:
reference to fitnesss function
See Also:
FitnessFunctionModel

getChromosomeSize

public int getChromosomeSize()
Return size of the chromosome

Specified by:
getChromosomeSize in interface ChromosomeModel
Returns:
Size of the chromosome

geneMutation

public int geneMutation(int geneNumber)
Mutant gene specified by genNumber. Return information about mutation

Specified by:
geneMutation in interface ChromosomeModel
Parameters:
geneNumber - gene Number
Returns:
information about mutation

getFitnessValue

public double getFitnessValue()
Return fitness value of the chromosome

Specified by:
getFitnessValue in interface ChromosomeModel
Returns:
fitness value

toString

public java.lang.String toString()
Return string representation of the chromosome

Specified by:
toString in interface ChromosomeModel
Overrides:
toString in class java.lang.Object
Returns:
string representation of the chromosome

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this network.

Specified by:
equals in interface ChromosomeModel
Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object to compare with
Returns:
true if this chromosome is the same as the obj argument; false otherwise.

clone

public java.lang.Object clone()
Return copy of the chromosome

Specified by:
clone in interface ChromosomeModel
Overrides:
clone in class java.lang.Object
Returns:
Clone of chromosome