JGAP

examples.config
Class MaximizingFunctionFitnessFunction

java.lang.Object
  extended by org.jgap.FitnessFunction
      extended by examples.config.MaximizingFunctionFitnessFunction
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ICloneable

public class MaximizingFunctionFitnessFunction
extends FitnessFunction

Sample Fitness function for the MaximizingFunction problem.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jgap.FitnessFunction
DELTA, NO_FITNESS_VALUE
 
Constructor Summary
MaximizingFunctionFitnessFunction()
           
 
Method Summary
 double evaluate(IChromosome a_chromosome)
          Determine the fitness of the given Chromosome instance.
 
Methods inherited from class org.jgap.FitnessFunction
clone, getFitnessValue, getLastComputedFitnessValue
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaximizingFunctionFitnessFunction

public MaximizingFunctionFitnessFunction()
Method Detail

evaluate

public double evaluate(IChromosome a_chromosome)
Determine the fitness of the given Chromosome instance. The higher the return value, the more fit the instance. This method should always return the same fitness value for two equivalent Chromosome instances.

Specified by:
evaluate in class FitnessFunction
Parameters:
a_chromosome - the Chromosome instance to evaluate
Returns:
a positive integer reflecting the fitness rating of the given Chromosome

JGAP