dlife.ga
Class ConstantFitnessFunction
java.lang.Object
dlife.ga.ConstantFitnessFunction
- All Implemented Interfaces:
- FitnessFunction, IndividualFitnessFunction, Serializable
public class ConstantFitnessFunction
- extends Object
- implements IndividualFitnessFunction
A FitnessFunction that returns a constant value. This FitnessFunction
evaluates the fitness of every Individual to be the same constant value. The
constant value is specified when the ConstantFitnessFunction is constructed.
- Version:
- Jan 7, 2007
- Author:
- Grant Braught, Dickinson College
- See Also:
- Serialized Form
|
Constructor Summary |
ConstantFitnessFunction(double value)
Create a new ConstantFitnessFunction that will return the specified value
as the fitness of every Individual. |
|
Method Summary |
double |
evaluate(Individual ind)
Return the constant fitness value as the fitness of the specified
Individual. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConstantFitnessFunction
public ConstantFitnessFunction(double value)
- Create a new ConstantFitnessFunction that will return the specified value
as the fitness of every Individual.
- Parameters:
value - the fitness value to use.
evaluate
public double evaluate(Individual ind)
- Return the constant fitness value as the fitness of the specified
Individual.
- Specified by:
evaluate in interface IndividualFitnessFunction
- Parameters:
ind - the Individual to be evaluated.
- Returns:
- the fitness of the Individual.