| |
|
| java.lang.Object org.jgap.FitnessFunction examples.multidimension.KnapsackFitnessFunction
KnapsackFitnessFunction | public class KnapsackFitnessFunction extends FitnessFunction (Code) | | Fitness function for the multidimension knapsack example.
author: Klaus Meffert since: 3.0 |
Field Summary | |
final public static double | MAX_BOUND |
Method Summary | |
protected double | computeItemNumberPenalty(IChromosome a_potentialSolution, double a_maxFitness, int a_items) Calculates the penalty to apply to the fitness value based on the amount
of items in the solution. | public double | evaluate(IChromosome a_subject) Determine the fitness of the given Chromosome instance. | public static int | getNumberOfItemsAtGene(CompositeGene a_compositeGene) Retrieves the number of items represented by the given potential
solution at the given gene position. | public static int | getTotalNumberOfItems(IChromosome a_potentialSolution) Returns the total number of items represented by all of the genes in
the given potential solution. | public static double | getTotalVolume(IChromosome a_potentialSolution) Calculates the total amount of change (in cents) represented by
the given potential solution and returns that amount. | protected double | volumeDifferenceBonus(double a_maxFitness, double a_volumeDifference) Bonus calculation of fitness value. |
MAX_BOUND | final public static double MAX_BOUND(Code) | | |
KnapsackFitnessFunction | public KnapsackFitnessFunction(double a_knapsackVolume)(Code) | | |
computeItemNumberPenalty | protected double computeItemNumberPenalty(IChromosome a_potentialSolution, double a_maxFitness, int a_items)(Code) | | Calculates the penalty to apply to the fitness value based on the amount
of items in the solution.
Parameters: a_potentialSolution - the potential solution to evaluate Parameters: a_maxFitness - upper boundary for fitness value possible Parameters: a_items - number of items in the solution a penalty for the fitness value based on the number of items author: Klaus Meffert since: 3.0 |
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 double reflecting the fitness rating of the givenChromosome author: Klaus Meffert since: 3.0 |
getNumberOfItemsAtGene | public static int getNumberOfItemsAtGene(CompositeGene a_compositeGene)(Code) | | Retrieves the number of items represented by the given potential
solution at the given gene position.
Parameters: a_compositeGene - the composite gene to evaluate the number of items represented by the potential solutionat the given gene position author: Klaus Meffert since: 2.3 |
getTotalNumberOfItems | public static int getTotalNumberOfItems(IChromosome a_potentialSolution)(Code) | | Returns the total number of items represented by all of the genes in
the given potential solution.
Parameters: a_potentialSolution - the potential solution to evaluate the total number of items represented by the given Chromosome author: Klaus Meffert since: 2.3 |
getTotalVolume | public static double getTotalVolume(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 author: Klaus Meffert since: 2.3 |
volumeDifferenceBonus | protected double volumeDifferenceBonus(double a_maxFitness, double a_volumeDifference)(Code) | | Bonus calculation of fitness value.
Parameters: a_maxFitness - maximum fitness value appliable Parameters: a_volumeDifference - volume difference in ccm for the items problem bonus for given volume difference author: Klaus Meffert since: 3.0 |
|
|
|