|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.FitnessFunction
examples.supergene.AbstractChangeFitnessFunction
public abstract class AbstractChangeFitnessFunction
Sample fitness function for the MakeChange example, including supergenes.
| Field Summary |
|---|
| Fields inherited from class org.jgap.FitnessFunction |
|---|
DELTA, NO_FITNESS_VALUE |
| Constructor Summary | |
|---|---|
AbstractChangeFitnessFunction(int a_targetAmount)
|
|
| Method Summary | |
|---|---|
int |
amountOfChange(IChromosome a_potentialSolution)
Calculates the total amount of change (in cents) represented by the given potential solution and returns that amount. |
double |
evaluate(IChromosome a_subject)
Determine the fitness of the given Chromosome instance. |
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 Gene |
getResponsibleGene(IChromosome a_chromosome,
int a_code)
Get the gene, responsible for the number of coins, corresponding this code. |
int |
getTotalNumberOfCoins(IChromosome a_potentialsolution)
Returns the total number of coins represented by all of the genes in the given potential solution. |
| Methods inherited from class org.jgap.FitnessFunction |
|---|
clone, getFitnessValue, getLastComputedFitnessValue |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractChangeFitnessFunction(int a_targetAmount)
| Method Detail |
|---|
public double evaluate(IChromosome a_subject)
evaluate in class FitnessFunctiona_subject - the Chromosome instance to evaluate
public int amountOfChange(IChromosome a_potentialSolution)
a_potentialSolution - the potential solution to evaluate
public int getNumberOfCoinsAtGene(IChromosome a_potentialSolution,
int a_code)
a_potentialSolution - the potential solution to evaluatea_code - index of gene
public int getTotalNumberOfCoins(IChromosome a_potentialsolution)
a_potentialsolution - the potential solution to evaluate
public abstract Gene getResponsibleGene(IChromosome a_chromosome,
int a_code)
a_chromosome - Chromosome to evaluatea_code - index of Gene
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||