|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgap.FitnessFunction
examples.MinimizingMakeChangeFitnessFunction
Sample fitness function for the MakeChange example.
Constructor Summary | |
MinimizingMakeChangeFitnessFunction(int a_targetAmount)
ctor |
Method Summary | |
static int |
amountOfChange(Chromosome a_potentialSolution)
Calculates the total amount of change (in cents) represented by the given potential solution and returns that amount. |
int |
evaluate(Chromosome a_subject)
Determine the fitness of the given Chromosome instance. |
static int |
getNumberOfCoinsAtGene(Chromosome a_potentialSolution,
int a_position)
Retrieves the number of coins represented by the given potential solution at the given gene position. |
static int |
getTotalNumberOfCoins(Chromosome a_potentialsolution)
Returns the total number of coins represented by all of the genes in the given potential solution. |
void |
init(java.util.Properties newProps)
|
Methods inherited from class org.jgap.FitnessFunction |
getFitnessValue, getMaxFitnessValue, setMaxFitnessValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MinimizingMakeChangeFitnessFunction(int a_targetAmount)
a_targetAmount
- Method Detail |
public int evaluate(Chromosome a_subject)
evaluate
in class FitnessFunction
a_subject
- The Chromosome instance to evaluate.
public static int amountOfChange(Chromosome a_potentialSolution)
a_potentialSolution
- The pontential solution to evaluate.
public static int getNumberOfCoinsAtGene(Chromosome a_potentialSolution, int a_position)
a_potentialSolution
- The potential solution to evaluate.a_position
- The gene position to evaluate.
public static int getTotalNumberOfCoins(Chromosome a_potentialsolution)
a_potentialsolution
- The potential solution to evaluate.
public void init(java.util.Properties newProps)
init
in class FitnessFunction
newProps
- configuration parametersFitnessFunction.init(java.util.Properties)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |