sdt.ga
Class Organism

java.lang.Object
  |
  +--sdt.ga.Organism

public abstract class Organism
extends java.lang.Object
implements java.io.Serializable, Task

This is the base class which represents an individual in a GA. This is the class every Organism has to extend in order to implement its own GA. The Fitness class has to be extended also along with this.

See Also:
Serialized Form

Field Summary
protected  Fitness fitness
          Fitness class associated with this organism.
protected  GeneticAlgorithm ga
          Genetic Algorithm class associated with this organism.
 int id
          Organism id
static java.lang.Object initOrganism
          Instance of the organism created at startup.
 
Constructor Summary
Organism()
           
 
Method Summary
 java.lang.Object clone()
          Implementation of the clone method.
abstract  void crossover(Organism org)
          Specify the implementation of a crossover.
abstract  Fitness evaluate()
          Specify how the fitness is evaluated.
protected  void finalize()
          For garbage collection
 Fitness getFitness()
          Returns the fitness of the organism.
abstract  java.lang.Object getInitialOrganism()
          get the initial organism to serve as a template
abstract  double getPhenotypeComp(Organism lc)
          ??
 boolean hasFitness()
          Returns if the fitness is evaluated.
abstract  void mutate()
          Specify the implementation of mutation.
static Organism newInstance(GeneticAlgorithm ga)
          This is the preferred way to instantiate an organism, since it appropriately sets the ga field.
abstract  void randomize()
          Specify the randomize method.
abstract  java.lang.Object readSerializable(java.io.ObjectInputStream in)
          Specify the communication protocol to create the organism from the output stream.
protected  void setFitness(Fitness fitness)
          This methods assigns the calculated fitness to the organism.
protected  void setGA(GeneticAlgorithm ga)
          set the ga variable of this class
abstract  void writeSerializable(java.io.ObjectOutputStream out)
          Specify the communication protocol to write the organism to the output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ga

protected transient GeneticAlgorithm ga
Genetic Algorithm class associated with this organism.

fitness

protected Fitness fitness
Fitness class associated with this organism.

initOrganism

public static java.lang.Object initOrganism
Instance of the organism created at startup.

id

public int id
Organism id
Constructor Detail

Organism

public Organism()
Method Detail

newInstance

public static Organism newInstance(GeneticAlgorithm ga)
This is the preferred way to instantiate an organism, since it appropriately sets the ga field. Note that a default constructor required for any subclass of Organism that is intended to be instantiated.

getInitialOrganism

public abstract java.lang.Object getInitialOrganism()
get the initial organism to serve as a template

setGA

protected void setGA(GeneticAlgorithm ga)
set the ga variable of this class

readSerializable

public abstract java.lang.Object readSerializable(java.io.ObjectInputStream in)
Specify the communication protocol to create the organism from the output stream.

writeSerializable

public abstract void writeSerializable(java.io.ObjectOutputStream out)
Specify the communication protocol to write the organism to the output stream.

clone

public java.lang.Object clone()
Implementation of the clone method.
Overrides:
clone in class java.lang.Object

randomize

public abstract void randomize()
Specify the randomize method.

crossover

public abstract void crossover(Organism org)
Specify the implementation of a crossover.

mutate

public abstract void mutate()
Specify the implementation of mutation.

evaluate

public abstract Fitness evaluate()
Specify how the fitness is evaluated.

setFitness

protected final void setFitness(Fitness fitness)
This methods assigns the calculated fitness to the organism.

hasFitness

public boolean hasFitness()
Returns if the fitness is evaluated.

getFitness

public final Fitness getFitness()
Returns the fitness of the organism.

getPhenotypeComp

public abstract double getPhenotypeComp(Organism lc)
??

finalize

protected void finalize()
                 throws java.lang.Throwable
For garbage collection
Overrides:
finalize in class java.lang.Object