gpsys
Class Individual

java.lang.Object
  |
  +--gpsys.Individual

public class Individual
extends java.lang.Object
implements java.io.Serializable

An Individual is an evolved GP program. It consists of a number of Chromosomes (which are automatically defined functions). An Individual has fitness which measures the suitability of the Individual for solving the problem for which it was evolved.

Version:
$Revision: 1.1 $, $Date: 2000/07/05 16:21:25 $
Author:
Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.
See Also:
Serialized Form

Field Summary
 Chromosome[] adf
          An Individual has a number of Chromosomes.
 int complexity
          The total number of Genes used across all Chromosomes.
 Fitness fitness
          An Individual has Fitness which is a measure of the suitability of the for solving the problem for which it was evolved.
 
Constructor Summary
Individual(GPParameters gpParameters)
          Create a completely new Individual.
Individual(GPParameters gpParameters, Individual mum, boolean mutate)
          Create a new Individual via reproduction or mutation of the mother.
Individual(GPParameters gpParameters, Individual mum, Individual dad)
          Create a new Individual via sexual reproduction (crossover).
 
Method Summary
 int complexity()
          Get the total number of Genes in this Individual.
 boolean evaluateBoolean()
          Evaluate this Individual as a program returning a boolean.
 byte evaluateByte()
          Evaluate this Individual as a program returning a byte.
 char evaluateChar()
          Evaluate this Individual as a program returning a char.
 double evaluateDouble()
          Evaluate this Individual as a program returning a double.
 float evaluateFloat()
          Evaluate this Individual as a program returning a float.
 int evaluateInt()
          Evaluate this Individual as a program returning an int.
 long evaluateLong()
          Evaluate this Individual as a program returning a long.
 java.lang.Object evaluateObject()
          Evaluate this Individual as a program returning an Object reference.
 short evaluateShort()
          Evaluate this Individual as a program returning a short.
 java.lang.String toString()
          Create a String representing this Individual.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

adf

public Chromosome[] adf
An Individual has a number of Chromosomes. The chromosome are Gene trees representing automatically defined functions.

fitness

public Fitness fitness
An Individual has Fitness which is a measure of the suitability of the for solving the problem for which it was evolved.

complexity

public int complexity
The total number of Genes used across all Chromosomes.
Constructor Detail

Individual

public Individual(GPParameters gpParameters)
Create a completely new Individual. This method creates Gene trees for each Chromosome (ADF), and then evaluates the individual's fitness.
Parameters:
gpParameters - the problem specific parameters.

Individual

public Individual(GPParameters gpParameters,
                  Individual mum,
                  boolean mutate)
Create a new Individual via reproduction or mutation of the mother. For reproduction, the new individual is a clone of the mother. For mutation the new individual is a muation of the mother. Mutation involves replacing one random subtree in one Chromosome (ADF) with a newly created type compatible one.
Parameters:
gpParameters - the problem specific parameters.
mum - the mother.
mutate - whether to mutate or just reproduce

Individual

public Individual(GPParameters gpParameters,
                  Individual mum,
                  Individual dad)
Create a new Individual via sexual reproduction (crossover). The mother is cloned and the clone is crossed with the father to create the child.
Parameters:
gpParameters - the problem specific parameters.
mum - the mother.
dad - the father.
Method Detail

evaluateObject

public java.lang.Object evaluateObject()
                                throws EvaluationException
Evaluate this Individual as a program returning an Object reference. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0].
Returns:
An Object which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

evaluateByte

public byte evaluateByte()
                  throws EvaluationException
Evaluate this Individual as a program returning a byte. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0].
Returns:
A byte which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

evaluateShort

public short evaluateShort()
                    throws EvaluationException
Evaluate this Individual as a program returning a short. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0].
Returns:
A short which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

evaluateInt

public int evaluateInt()
                throws EvaluationException
Evaluate this Individual as a program returning an int. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0].
Returns:
An int which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

evaluateLong

public long evaluateLong()
                  throws EvaluationException
Evaluate this Individual as a program returning a long. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0]. # @return A long which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

evaluateFloat

public float evaluateFloat()
                    throws EvaluationException
Evaluate this Individual as a program returning a float. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0].
Returns:
A float which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

evaluateDouble

public double evaluateDouble()
                      throws EvaluationException
Evaluate this Individual as a program returning a double. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0].
Returns:
A double which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

evaluateChar

public char evaluateChar()
                  throws EvaluationException
Evaluate this Individual as a program returning a char. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0].
Returns:
A char which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

evaluateBoolean

public boolean evaluateBoolean()
                        throws EvaluationException
Evaluate this Individual as a program returning a boolean. An Individual is evaluated by evaluating the root (or result producing Chromosome) which is alway assumed to adf[0].
Returns:
A boolean which is the result of the evaluation.
Throws:
EvaluationException - If there is an evaluation failure.

complexity

public int complexity()
Get the total number of Genes in this Individual.
Returns:
the number Genes in the Individual.

toString

public java.lang.String toString()
Create a String representing this Individual.
Returns:
A String representing this Individual.
Overrides:
toString in class java.lang.Object