org.jgap
Interface FitnessFunction


public interface FitnessFunction

Fitness functions are used to determine how optimal a particular solution is relative to other solutions. This interface should be implemented by all concrete fitness functions. The fitness function is given a Chromosome to evaluate and should return its fitness value. The higher the value, the more fit the Chromosome. The actual range of fitness values isn't important (other than the fact that the values must be of type int): it's the relative difference as a percentage that matters. So in other words, two Chromosomes with respective fitness values of 1 and 100 have the same relative fitness to each other as two Chromosomes with respective fitness values of 10 and 1000 (in each case, the first is 1% as fit as the second).

Note: Two Chromosomes of the same size and with equivalent sets of genes should always be assigned the same fitness value by any implementation of this method.

Author:
Neil Rotstan (neil at bluesock.org)

Method Summary
 int evaluate(org.jgap.Chromosome subject)
          Determine the fitness of the given Chromosome instance.
 

Method Detail

evaluate

public int evaluate(org.jgap.Chromosome subject)
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.

Returns:
The fitness rating of the given Chromosome.