| |
|
| java.lang.Object org.jgap.FitnessFunction org.jgap.perf.TestOverallPerformanceFitnessFunc
TestOverallPerformanceFitnessFunc | public class TestOverallPerformanceFitnessFunc extends FitnessFunction (Code) | | Sample fitness function for the MakeChange example.
author: Klaus Meffert since: 2.0 |
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. | 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. |
TestOverallPerformanceFitnessFunc | public TestOverallPerformanceFitnessFunc(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.
Here we use "fantasy" coins just to have more genes and bloat the time
consumed for test performance test
Parameters: a_potentialSolution - the pontential solution to evaluate the total amount of change (in cents) represented by thegiven solution |
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 |
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 |
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 |
|
|
|