examples.gp
Class MathProblem.FormulaFitnessFunction
java.lang.Object
org.jgap.gp.GPFitnessFunction
examples.gp.MathProblem.FormulaFitnessFunction
- All Implemented Interfaces:
- java.io.Serializable
- Enclosing class:
- MathProblem
public static class MathProblem.FormulaFitnessFunction
- extends GPFitnessFunction
Fitness function for evaluating the produced fomulas, represented as GP
programs. The fitness is computed by calculating the result (Y) of the
function/formula for integer inputs 0 to 20 (X). The sum of the differences
between expected Y and actual Y is the fitness, the lower the better (as
it is a defect rate here).
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MathProblem.FormulaFitnessFunction
public MathProblem.FormulaFitnessFunction()
evaluate
protected double evaluate(IGPProgram a_subject)
- Description copied from class:
GPFitnessFunction
- Determine the fitness of the given GPProgram instance. The higher the
return value, the more fit the instance. This method should always
return the same fitness value for two equivalent GPProgram instances.
- Specified by:
evaluate
in class GPFitnessFunction
- Parameters:
a_subject
- the GPProgram instance to evaluate
- Returns:
- positive double reflecting the fitness rating of the given
GPProgram. Note that if a non-positive double is returned, a
RuntimeException should be generated
computeRawFitness
public double computeRawFitness(IGPProgram ind)