Individuals
Class AbstractIndividual

java.lang.Object
  extended by Individuals.AbstractIndividual
All Implemented Interfaces:
Individual, java.lang.Cloneable, java.lang.Comparable<Individual>
Direct Known Subclasses:
GEIndividual

public abstract class AbstractIndividual
extends java.lang.Object
implements Individual

An Abstract individual. An abstract individual class implements a couple of the get/set patterns and adds a fitness data member.

Author:
Blip

Field Summary
protected  int age
           
protected  boolean evaluated
           
protected  Fitness fitness
           
protected  java.util.List<java.lang.Integer> parentUIDs
           
 
Method Summary
abstract  Individual clone()
          Clone the individual
 int compareTo(Individual o)
          Compare the indivdual
 int getAge()
          The age of the individual, counted as how many iterations it has survived.
 Fitness getFitness()
          Get fitness of individuals
abstract  Genotype getGenotype()
          Get the genotype
abstract  Mapper getMapper()
          Get the map use to map input and output
 java.util.List<java.lang.Integer> getParentUIDs()
          Get the parentUIDs
abstract  Phenotype getPhenotype()
          Get phenotype
abstract  java.lang.String getPhenotypeString(int map)
          Get a String representation of the output(Phenotype)
 int getUID()
          Use: @{inheritDoc}
 int increaseUIDCounter()
          Increase the unique id counter and return the new counter value
 boolean isEvaluated()
          Has the individual been evaluated
abstract  void map(int map)
          Map the input(Genotype) to output(Phenotype) using a grammar as a map
 void setAge(int age)
          Age is how long the individual has existed
 void setEvaluated(boolean b)
          Indicate if the individual should be evaluated or not
 void setFitness(Fitness f)
          Set fitness
abstract  void setGenotype(Genotype g)
          Set genotype
abstract  void setMapper(Mapper m)
          Set mapper
 void setParentUIDs(java.util.List<java.lang.Integer> _parentUIDs)
          Set the parentUIDs
abstract  void setPhenotype(Phenotype p)
          Set phenotype
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Individuals.Individual
isValid, setValid
 

Field Detail

fitness

protected Fitness fitness

evaluated

protected boolean evaluated

age

protected int age

parentUIDs

protected java.util.List<java.lang.Integer> parentUIDs
Method Detail

map

public abstract void map(int map)
Description copied from interface: Individual
Map the input(Genotype) to output(Phenotype) using a grammar as a map

Specified by:
map in interface Individual
Parameters:
map - which input to map if there are multiple

getPhenotypeString

public abstract java.lang.String getPhenotypeString(int map)
Description copied from interface: Individual
Get a String representation of the output(Phenotype)

Specified by:
getPhenotypeString in interface Individual
Parameters:
map - which output to get if there are multiple
Returns:
string of output

getMapper

public abstract Mapper getMapper()
Description copied from interface: Individual
Get the map use to map input and output

Specified by:
getMapper in interface Individual
Returns:
map used

getGenotype

public abstract Genotype getGenotype()
Description copied from interface: Individual
Get the genotype

Specified by:
getGenotype in interface Individual
Returns:
genotype

setMapper

public abstract void setMapper(Mapper m)
Description copied from interface: Individual
Set mapper

Specified by:
setMapper in interface Individual
Parameters:
m - mapper

setGenotype

public abstract void setGenotype(Genotype g)
Description copied from interface: Individual
Set genotype

Specified by:
setGenotype in interface Individual
Parameters:
g - genotype

setPhenotype

public abstract void setPhenotype(Phenotype p)
Description copied from interface: Individual
Set phenotype

Specified by:
setPhenotype in interface Individual
Parameters:
p - phenotype

getPhenotype

public abstract Phenotype getPhenotype()
Description copied from interface: Individual
Get phenotype

Specified by:
getPhenotype in interface Individual
Returns:
phenotype

clone

public abstract Individual clone()
Description copied from interface: Individual
Clone the individual

Specified by:
clone in interface Individual
Overrides:
clone in class java.lang.Object
Returns:
a clone of the individual

compareTo

public int compareTo(Individual o)
Compare the indivdual

Specified by:
compareTo in interface java.lang.Comparable<Individual>
Parameters:
o - individual to compare to
Returns:
-1,0,-1

getAge

public int getAge()
Description copied from interface: Individual
The age of the individual, counted as how many iterations it has survived.

Specified by:
getAge in interface Individual
Returns:
number of iterations survived

setAge

public void setAge(int age)
Description copied from interface: Individual
Age is how long the individual has existed

Specified by:
setAge in interface Individual
Parameters:
age - How long the individual has existed

getFitness

public Fitness getFitness()
Description copied from interface: Individual
Get fitness of individuals

Specified by:
getFitness in interface Individual
Returns:
individual fitness

setFitness

public void setFitness(Fitness f)
Description copied from interface: Individual
Set fitness

Specified by:
setFitness in interface Individual
Parameters:
f - fitness

isEvaluated

public boolean isEvaluated()
Description copied from interface: Individual
Has the individual been evaluated

Specified by:
isEvaluated in interface Individual
Returns:
boolean of evaluation status

setEvaluated

public void setEvaluated(boolean b)
Description copied from interface: Individual
Indicate if the individual should be evaluated or not

Specified by:
setEvaluated in interface Individual
Parameters:
b - set if individual should be evaluated

getUID

public int getUID()
Use: @{inheritDoc}


increaseUIDCounter

public int increaseUIDCounter()
Increase the unique id counter and return the new counter value

Returns:
int value of the unique id counter

setParentUIDs

public void setParentUIDs(java.util.List<java.lang.Integer> _parentUIDs)
Set the parentUIDs

Parameters:
_parentUIDs - List of parent UIDs

getParentUIDs

public java.util.List<java.lang.Integer> getParentUIDs()
Get the parentUIDs

Returns:
List List of parent UIDs