evolution
Class BitChromosome

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

public class BitChromosome
extends java.lang.Object
implements ChromosomeModel

Chromosome with bit representation


Constructor Summary
BitChromosome(int chromosomeSize, double crossOverProbability, double mutationProbability, FitnessFunctionModel fitnessFunction)
          Creates a new instance of BitChromosome
BitChromosome(int chromosomeSize, FitnessFunctionModel fitnessFunction)
          Creates a new instance of BitChromosome with
Cross over probability - set to 1.0 Mutatation probability - set to 0
BitChromosome(java.lang.String chromosomeString, FitnessFunctionModel fitnessFunction)
          Creates a new instance of BitChromosome from Chromosome String where:
1 represent gene with true value 0 represent gene with falce value
 
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 chromosome where
1 - represent true
2 - represent false
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BitChromosome

public BitChromosome(int chromosomeSize,
                     FitnessFunctionModel fitnessFunction)
Creates a new instance of BitChromosome with
Cross over probability - set to 1.0 Mutatation probability - set to 0

Parameters:
chromosomeSize - size of chromosome
fitnessFunction - reference to fitness function

BitChromosome

public BitChromosome(int chromosomeSize,
                     double crossOverProbability,
                     double mutationProbability,
                     FitnessFunctionModel fitnessFunction)
Creates a new instance of BitChromosome

Parameters:
chromosomeSize - Chromosome size
crossOverProbability - cross over propability
mutationProbability - mutation propability
fitnessFunction - reference to fitness function

BitChromosome

public BitChromosome(java.lang.String chromosomeString,
                     FitnessFunctionModel fitnessFunction)
Creates a new instance of BitChromosome from Chromosome String where:
1 represent gene with true value 0 represent gene with falce value

Parameters:
chromosomeString - String representation of chromosome
fitnessFunction - reference to fitness function
Method Detail

setGene

public void setGene(int geneNumber,
                    java.lang.Object value)
Set gene with specified value. Value must be type of boolean

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

setMutationProbability

public void setMutationProbability(double mutationProbability)
Set mutation probability

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

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

getFitnessValue

public double getFitnessValue()
Return fitness value of the chromosome

Specified by:
getFitnessValue in interface ChromosomeModel
Returns:
fitness value

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 1 if gene was mutaded, 0 otehrwise

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

toString

public java.lang.String toString()
Return string representation of chromosome where
1 - represent true
2 - represent false

Specified by:
toString in interface ChromosomeModel
Overrides:
toString in class java.lang.Object
Returns:
String representation of 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