FitnessEvaluation.RoyalTree
Class RoyalTree

java.lang.Object
  extended by FitnessEvaluation.RoyalTree.RoyalTree
All Implemented Interfaces:
FitnessFunction, ParameterI

public class RoyalTree
extends java.lang.Object
implements FitnessFunction


Constructor Summary
RoyalTree()
          Creates a new instance of RoyalTree
 
Method Summary
 boolean canCache()
          Return true if it is ok to cache the results of the fitness function
 double evaluate(java.lang.String s)
          Given a string, calculate its fitness.
 double evaluateString(Phenotype p)
          The phenotype will be a tree in lisp-syntax.
 void getFitness(Individual i)
          Creates a new instance of FitnessEvaluator
static void main(java.lang.String[] args)
           
 void setProperties(java.util.Properties p)
          Set properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoyalTree

public RoyalTree()
Creates a new instance of RoyalTree

Method Detail

setProperties

public void setProperties(java.util.Properties p)
Description copied from interface: ParameterI
Set properties

Specified by:
setProperties in interface ParameterI
Parameters:
p - object containing properties

evaluateString

public double evaluateString(Phenotype p)
The phenotype will be a tree in lisp-syntax. Its nonterminals will be A, B, C, etc (of increasing arity), and its only terminal is x. eg: ( C ( A x ) ( A x ) ( B ( A x ) x ) ).

Parameters:
p - The candidate phenotype
Returns:
double fitness

evaluate

public double evaluate(java.lang.String s)
Given a string, calculate its fitness. It's useful to have a method which takes a String (rather than a Phenotype) for testing porpoises.

Parameters:
s - string describing the candidate tree.
Returns:
fitness (in classical royal-tree maximising format)

getFitness

public void getFitness(Individual i)
Description copied from interface: FitnessFunction
Creates a new instance of FitnessEvaluator

Specified by:
getFitness in interface FitnessFunction
Parameters:
i - Evaluated individual

canCache

public boolean canCache()
Description copied from interface: FitnessFunction
Return true if it is ok to cache the results of the fitness function

Specified by:
canCache in interface FitnessFunction

main

public static void main(java.lang.String[] args)