org.jscience.computing.ai.evolutionary.geneticprogramming
Class Individual

java.lang.Object
  extended by org.jscience.computing.ai.evolutionary.geneticprogramming.Individual

public class Individual
extends java.lang.Object

This class combines a program and its computed fitness values.

Raw fitness is the measurement of fitness that is stated in the natural terminology of the problem itself. The most common definition of raw fitness is error: If the S-expression is boolean-valued or symbolic-valued, the sum of distances is equivalent to the number of mismatches. If the S-expression is real-valued or integer-valued, the square root of the sum of the squares of the distances can, alternatively, be used to measure the fitness. (therefore increasing the influence of more distant points)

Standardized fitness restates the raw fitness so that a lower numerical value is always a better value.

It is convenient and desirable to make the best value of standardized fitness equal 0. If this is not already the case, it can be made so by subtracting (or adding a constant).

If for a particular problem, a greater value of raw fitness is better, standardized fitness must be computed from raw fitness. In that situation, standardized fitness equals the maximum possible value of raw fitness(Rmax) minus the observed raw fitness. For ex. If the artifical ant finds 5 0f 89 pieces of food using a given computer program, the raw fitness is 5 and the standardized fitness is 84.

Adjusted fitness a(i,t) is computed from the standardized fitness s(i,t) as follows: --- a(i,t) = 1 / 1+s(i,t) --- where s(i,t) is the standardized fitness for individual i at time t.

The adjusted fitness lies between 0 and 1. The adjusted fitness is bigger for better individuals in the population. Note that for certain methods of selection other than fitness proportionate selection (e.g. tournament selection and rank selection), adjusted fitness is not relevant and not used.

Normalized fitness is also needed if the method of selection employed is fitness proportionate.

The normalized fitness n(i,t) is computed from the adjusted fitness a(i,t) as described in Koza's book (ISBN:0262111705)

Note that for certain methods of selection other than fitness proportionate selection (e.g. tournament selection and rank selection), normalized fitness is not relevant and not used.


Constructor Summary
Individual(Program program)
          Create an individual with given parameters.
 
Method Summary
 Individual copy()
          Create a deep copy of this individual
 double getAdjustedFitness()
          Returns adjusted fitness of this individual
 double getNormalizedFitness()
          Returns normalized fitness of this individual
 Program getProgram()
          Returns program of this individual
 double getStandardizedFitness()
          Returns standardized fitness of this individual
 void setAdjustedFitness(double newFitness)
          Changes adjusted fitness of this individual
 void setHits(int newHits)
          Changes hits of this individual
 void setNormalizedFitness(double newFitness)
          Changes normalized fitness of this individual
 void setProgram(Program program)
          Changes the program of this individual
 void setStandardizedFitness(double newFitness)
          Changes standardized fitness of this individual
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Individual

public Individual(Program program)
Create an individual with given parameters.

Parameters:
program - program of this individual
Method Detail

copy

public Individual copy()
Create a deep copy of this individual

Returns:
deep copy of the individual

getProgram

public Program getProgram()
Returns program of this individual

Returns:
program of this individual

setProgram

public void setProgram(Program program)
Changes the program of this individual

Parameters:
program - new program of this individual

getNormalizedFitness

public double getNormalizedFitness()
Returns normalized fitness of this individual

Returns:
normalized fitness of this individual

getAdjustedFitness

public double getAdjustedFitness()
Returns adjusted fitness of this individual

Returns:
adjusted fitness of this individual

getStandardizedFitness

public double getStandardizedFitness()
Returns standardized fitness of this individual

Returns:
standardized fitness of this individual

setNormalizedFitness

public void setNormalizedFitness(double newFitness)
Changes normalized fitness of this individual

Parameters:
newFitness - new fitness value

setAdjustedFitness

public void setAdjustedFitness(double newFitness)
Changes adjusted fitness of this individual

Parameters:
newFitness - new fitness value

setStandardizedFitness

public void setStandardizedFitness(double newFitness)
Changes standardized fitness of this individual

Parameters:
newFitness - new fitness value

setHits

public void setHits(int newHits)
Changes hits of this individual

Parameters:
newHits - new hits