| |
|
| java.lang.Object org.jgap.FitnessFunction examples.audit.CoinsExampleFitnessFunction
CoinsExampleFitnessFunction | public class CoinsExampleFitnessFunction extends FitnessFunction (Code) | | Sample fitness function for the coins example.
author: Klaus Meffert since: 2.2 |
Field Summary | |
final public static int | MAX_BOUND |
Method Summary | |
public static int | amountOfChange(IChromosome a_potentialSolution) Calculates the total amount of change (in cents) represented by
the given potential solution and returns that amount. | protected double | computeCoinNumberBonus(int a_coins) | public double | evaluate(IChromosome a_subject) Determine the fitness of the given Chromosome instance. | public static int | getNumberOfCoinsAtGene(IChromosome a_potentialSolution, int a_position) Retrieves the number of coins represented by the given potential
solution at the given gene position. | public static int | getTotalNumberOfCoins(IChromosome a_potentialsolution) Returns the total number of coins represented by all of the genes in
the given potential solution.
Parameters: a_potentialsolution - The potential solution to evaluate. |
MAX_BOUND | final public static int MAX_BOUND(Code) | | |
CoinsExampleFitnessFunction | public CoinsExampleFitnessFunction(int a_targetAmount)(Code) | | |
amountOfChange | public static int amountOfChange(IChromosome a_potentialSolution)(Code) | | Calculates the total amount of change (in cents) represented by
the given potential solution and returns that amount.
Parameters: a_potentialSolution - the pontential solution to evaluate the total amount of change (in cents) represented by thegiven solution author: Klaus Meffert since: 2.2 |
computeCoinNumberBonus | protected double computeCoinNumberBonus(int a_coins)(Code) | | |
evaluate | public double evaluate(IChromosome a_subject)(Code) | | 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.
Parameters: a_subject - the Chromosome instance to evaluate a positive integer reflecting the fitness rating of the givenChromosome author: Klaus Meffert since: 2.2 |
getNumberOfCoinsAtGene | public static int getNumberOfCoinsAtGene(IChromosome a_potentialSolution, int a_position)(Code) | | Retrieves the number of coins represented by the given potential
solution at the given gene position.
Parameters: a_potentialSolution - the potential solution to evaluate Parameters: a_position - the gene position to evaluate the number of coins represented by the potential solutionat the given gene position. author: Klaus Meffert since: 2.2 |
getTotalNumberOfCoins | public static int getTotalNumberOfCoins(IChromosome a_potentialsolution)(Code) | | Returns the total number of coins represented by all of the genes in
the given potential solution.
Parameters: a_potentialsolution - The potential solution to evaluate. The total number of coins represented by the given Chromosome. since: 2.2 |
|
|
|