All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpsys.symreg.SymRegFitness

java.lang.Object
   |
   +----gpsys.Fitness
           |
           +----gpsys.symreg.SymRegFitness

public class SymRegFitness
extends Fitness
The Fitness class for the symbolic regression problem. The fitness is measured using two values. The first is the error between the real function and the function generated by the GP system. The second value is the complexity of the GP program. The fitness of one GP is is deemed better than another if either the error is smaller or if the error is equal, but the complexity is smaller. The termination criteria is met when the error is zero. This problem involves finding the function :-
			x^3 + 2x^2 +3x + 5
 

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 from
The minimum value of x to be used for testing the evolved function.
 o samples
The number of samples used test the evolved function.
 o to
The maximum value of x to be used for testing the evolved function.

Constructor Index

 o SymRegFitness()
Construct a Fitness object with default Fitness.
 o SymRegFitness(GPParameters, Individual)
Constructs a Fitness object by evaluating an Individual.

Method Index

 o add(Fitness)
Adds a fitness value to this fitness value.
 o divide(int)
Divide the fitness by the specified integer.
 o equals(Fitness)
Tests if this fitness is equal to another fitness.
 o greaterThan(Fitness)
Tests if this fitness value is greater than another fitness value.
 o instance()
Creates a new instance of the Fitness object with a default fitness.
 o instance(GPParameters, Individual)
Creates a new instance of the Fitness object which represents the fitness of the specified individual.
 o lessThan(Fitness)
Tests if this fitness is less than another fitness.
 o terminationCondition()
Tests whether this fitness meets the termination criteria.
 o toString()
Converts the fitness into a String suitable for printing.

Variables

 o from
 public static float from
The minimum value of x to be used for testing the evolved function.

 o to
 public static float to
The maximum value of x to be used for testing the evolved function.

 o samples
 public static int samples
The number of samples used test the evolved function.

Constructors

 o SymRegFitness
 public SymRegFitness()
Construct a Fitness object with default Fitness.

 o SymRegFitness
 public SymRegFitness(GPParameters gpParameters,
                      Individual i)
Constructs a Fitness object by evaluating an Individual.

Parameters:
gpParameters - The GP parameters for this run.
i - The individual to be evaluated.

Methods

 o add
 public void add(Fitness f)
Adds a fitness value to this fitness value.

Parameters:
f - the fitness value to be added.
Overrides:
add in class Fitness
 o divide
 public void divide(int divisor)
Divide the fitness by the specified integer. This is used by the GP system to calculate the average fitness of the population.

Parameters:
divisor - the integer to divide the fitness by.
Overrides:
divide in class Fitness
 o greaterThan
 public boolean greaterThan(Fitness f)
Tests if this fitness value is greater than another fitness value.

Parameters:
f - the fitness with which to compare.
Returns:
true if f has higher fitness, false otherwise.
Overrides:
greaterThan in class Fitness
 o lessThan
 public boolean lessThan(Fitness f)
Tests if this fitness is less than another fitness.

Parameters:
f - the fitness with which to compare.
Returns:
true if f has less fitness, false otherwise.
Overrides:
lessThan in class Fitness
 o equals
 public boolean equals(Fitness f)
Tests if this fitness is equal to another fitness.

Parameters:
f - the fitness with which to compare.
Returns:
true if f has the same fitness, false otherwise.
Overrides:
equals in class Fitness
 o instance
 public Fitness instance()
Creates a new instance of the Fitness object with a default fitness.

Returns:
an instance of a Fitness object with default fitness.
Overrides:
instance in class Fitness
 o instance
 public Fitness instance(GPParameters gpParameters,
                         Individual i)
Creates a new instance of the Fitness object which represents the fitness of the specified individual.

Parameters:
gpParameters - the parameters for this GP run.
i - the individual to be evaluated.
Returns:
The Fitness of the specified individual.
Overrides:
instance in class Fitness
 o terminationCondition
 public boolean terminationCondition()
Tests whether this fitness meets the termination criteria.

Returns:
true if the termination criteria has been met, false otherwise.
Overrides:
terminationCondition in class Fitness
 o toString
 public String toString()
Converts the fitness into a String suitable for printing.

Returns:
A String representing the fitness.
Overrides:
toString in class Fitness

All Packages  Class Hierarchy  This Package  Previous  Next  Index