| java.lang.Object org.jgap.FitnessFunction examples.supergene.AbstractChangeFitnessFunction
All known Subclasses: examples.supergene.SupergeneChangeFitnessFunction,
AbstractChangeFitnessFunction | abstract public class AbstractChangeFitnessFunction extends FitnessFunction (Code) | | Sample fitness function for the MakeChange example, including supergenes.
author: Neil Rotstan author: Klaus Meffert author: Audrius Meskauskas since: 2.0 |
Method Summary | |
public 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 int | getNumberOfCoinsAtGene(IChromosome a_potentialSolution, int a_code) Retrieves the number of coins represented by the given potential
solution at the given gene position. | abstract public Gene | getResponsibleGene(IChromosome a_chromosome, int a_code) Get the gene, responsible for the number of coins, corresponding
this code. | public int | getTotalNumberOfCoins(IChromosome a_potentialsolution) Returns the total number of coins represented by all of the genes in
the given potential solution. |
AbstractChangeFitnessFunction | public AbstractChangeFitnessFunction(int a_targetAmount)(Code) | | |
amountOfChange | public 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 potential 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 positive integer reflecting the fitness rating of the givenChromosome since: 2.0 |
getNumberOfCoinsAtGene | public int getNumberOfCoinsAtGene(IChromosome a_potentialSolution, int a_code)(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_code - index of gene the number of coins represented by the potential solutionat the given gene position |
getResponsibleGene | abstract public Gene getResponsibleGene(IChromosome a_chromosome, int a_code)(Code) | | Get the gene, responsible for the number of coins, corresponding
this code.
Parameters: a_chromosome - Chromosome to evaluate Parameters: a_code - index of Gene responsible gene |
getTotalNumberOfCoins | public 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 |
|
|