All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpsys.Gene

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

public abstract class Gene
extends Object
implements Serializable
A Gene is a node in a GP tree. A Gene can be either a function or a terminal, hence this abstract class has been subclassed to GeneFunction and GeneTerminal which are actually used.

Version:
1.1, 30th June '97
Author:
Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.

Variable Index

 o p
The primitive associated with this Gene which is either a Function or a Terminal.

Constructor Index

 o Gene()

Method Index

 o complexity()
Calculates the number of nodes (Genes) in the subtree starting at this node (Gene).
 o deepClone()
Makes a deep clone of this Gene, i.e.
 o depth()
Calculates the maximum depth of the subtree starting at this node (Gene).
 o evaluateBoolean(Individual)
Evaluate this Gene as a Gene that returns a boolean when evaluated.
 o evaluateByte(Individual)
Evaluate this Gene as a Gene that returns a byte when evaluated.
 o evaluateChar(Individual)
Evaluate this Gene as a Gene that returns a char when evaluated.
 o evaluateDouble(Individual)
Evaluate this Gene as a Gene that returns a double when evaluated.
 o evaluateFloat(Individual)
Evaluate this Gene as a Gene that returns a float when evaluated.
 o evaluateInt(Individual)
Evaluate this Gene as a Gene that returns a int when evaluated.
 o evaluateLong(Individual)
Evaluate this Gene as a Gene that returns a long when evaluated.
 o evaluateObject(Individual)
Evaluate this Gene as a Gene that returns an Object when evaluated.
 o evaluateShort(Individual)
Evaluate this Gene as a Gene that returns a short when evaluated.
 o toString()
Converts the Gene and its subtrees into a String.

Variables

 o p
 public Primitive p
The primitive associated with this Gene which is either a Function or a Terminal.

Constructors

 o Gene
 public Gene()

Methods

 o complexity
 public abstract int complexity()
Calculates the number of nodes (Genes) in the subtree starting at this node (Gene).

 o depth
 public abstract int depth()
Calculates the maximum depth of the subtree starting at this node (Gene).

 o evaluateObject
 public abstract Object evaluateObject(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns an Object when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
An Object which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o evaluateByte
 public abstract byte evaluateByte(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns a byte when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
A byte which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o evaluateShort
 public abstract short evaluateShort(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns a short when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
A short which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o evaluateInt
 public abstract int evaluateInt(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns a int when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
A int which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o evaluateLong
 public abstract long evaluateLong(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns a long when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
A long which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o evaluateFloat
 public abstract float evaluateFloat(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns a float when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
A float which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o evaluateDouble
 public abstract double evaluateDouble(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns a double when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
A double which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o evaluateChar
 public abstract char evaluateChar(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns a char when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
A char which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o evaluateBoolean
 public abstract boolean evaluateBoolean(Individual i) throws EvaluationException
Evaluate this Gene as a Gene that returns a boolean when evaluated.

Parameters:
i - the Individual being evaluated.
Returns:
A boolean which is the evaluation result.
Throws: EvaluationException
If there is an evaluation failure.
 o deepClone
 public abstract Gene deepClone()
Makes a deep clone of this Gene, i.e. the Gene and all of it's subtrees.

Returns:
A clone of the Gene and its subtrees.
 o toString
 public abstract String toString()
Converts the Gene and its subtrees into a String.

Returns:
A String representing the Gene and any subtrees.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index