examples.dlife.ga.maxones
Class MaxOnesFitnessFunction
java.lang.Object
examples.dlife.ga.maxones.MaxOnesFitnessFunction
- All Implemented Interfaces:
- FitnessFunction, IndividualFitnessFunction, Serializable
public class MaxOnesFitnessFunction
- extends Object
- implements IndividualFitnessFunction
A FitnessFunction for the "Max Ones" problem. This
FitnessFunction that evaluates an Individual's fitness as the number of 1
genes that it has.
The source code for this class is contained in the file:
- Version:
- Jan 7, 2007
- Author:
- Grant Braught, Dickinson College
- See Also:
- Serialized Form
|
Method Summary |
double |
evaluate(Individual ind)
The fitness of an Individual is given by the number of 1 genes that it
contains. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MaxOnesFitnessFunction
public MaxOnesFitnessFunction()
evaluate
public double evaluate(Individual ind)
- The fitness of an Individual is given by the number of 1 genes that it
contains.
- Specified by:
evaluate in interface IndividualFitnessFunction
- Parameters:
ind - the individual to evaluate.
- Returns:
- the number of 1's in the provided individual.