JGAP

org.jgap.impl.salesman
Class SalesmanFitnessFunction

java.lang.Object
  extended by org.jgap.FitnessFunction
      extended by org.jgap.impl.salesman.SalesmanFitnessFunction
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ICloneable

public class SalesmanFitnessFunction
extends FitnessFunction

The fitness function to solve the Travelling Salesman problem. The function returned by this method calls distance(Object from, Object to)

Since:
2.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jgap.FitnessFunction
DELTA, NO_FITNESS_VALUE
 
Constructor Summary
SalesmanFitnessFunction(Salesman a_salesman)
           
 
Method Summary
protected  double evaluate(IChromosome a_subject)
          Computes the distance by calling salesman Salesman.distance(org.jgap.Gene, org.jgap.Gene)
 
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

SalesmanFitnessFunction

public SalesmanFitnessFunction(Salesman a_salesman)
Method Detail

evaluate

protected double evaluate(IChromosome a_subject)
Computes the distance by calling salesman Salesman.distance(org.jgap.Gene, org.jgap.Gene)

Specified by:
evaluate in class FitnessFunction
Parameters:
a_subject - chromosome representing cities
Returns:
distance of the journey thru the cities represented in the given chromosome
Since:
2.0

JGAP