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
- Author:
- Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.
-
complexity
- The complexity of the GP i.e.
-
fitness
- The error between the ideal function and the GP.
-
from
- The minimum value of x to be used for testing the evolved function.
-
samples
- The number of samples used test the evolved function.
-
to
- The maximum value of x to be used for testing the evolved function.
-
SymRegFitness()
- Construct a Fitness object with default Fitness.
-
SymRegFitness(GPParameters, Individual)
- Constructs a Fitness object by evaluating an Individual.
-
add(Fitness)
- Adds a fitness value to this fitness value.
-
divide(int)
- Divide the fitness by the specified integer.
-
equals(Fitness)
- Tests if this fitness is equal to another fitness.
-
greaterThan(Fitness)
- Tests if this fitness value is greater than another fitness value.
-
instance()
- Creates a new instance of the Fitness object with a default fitness.
-
instance(GPParameters, Individual)
- Creates a new instance of the Fitness object which represents the
fitness of the specified individual.
-
lessThan(Fitness)
- Tests if this fitness is less than another fitness.
-
terminationCondition()
- Tests whether this fitness meets the termination criteria.
-
toString()
- Converts the fitness into a String suitable for printing.
fitness
double fitness
- The error between the ideal function and the GP.
complexity
int complexity
- The complexity of the GP i.e. the number of Genes it contains.
from
public static float from
- The minimum value of x to be used for testing the evolved function.
to
public static float to
- The maximum value of x to be used for testing the evolved function.
samples
public static int samples
- The number of samples used test the evolved function.
SymRegFitness
public SymRegFitness()
- Construct a Fitness object with default Fitness.
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.
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
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
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
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
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
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
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
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
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