|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Fitness is a prototype which describes the fitness of an individual. Every individual contains exactly one Fitness object. Fitness objects are compared to each other with the equivalentTo() and betterThan(), etc. methods.
Rules:
comparison | method |
a > b | a.betterThan(b) |
a >= b | a.betterThan(b) || a.equivalentTo(b) |
a = b | a.equivalentTo(b) |
Parameter bases
fit | default fitness base |
Field Summary | |
static java.lang.String |
P_FITNESS
|
Method Summary | |
boolean |
betterThan(Fitness _fitness)
Should return true if this fitness is clearly better than _fitness; You may assume that _fitness is of the same class as yourself. |
boolean |
equivalentTo(Fitness _fitness)
Should return true if this fitness is in the same equivalence class as _fitness, that is, neither is clearly bettter or worse than the other. |
float |
fitness()
Should return an absolute fitness value ranging from negative infinity to infinity, NOT inclusive (thus infinity, negative infinity, and NaN are NOT valid fitness values). |
boolean |
isIdealFitness()
Should return true if this is a good enough fitness to end the run |
void |
printFitness(EvolutionState state,
int log,
int verbosity)
Should print the fitness out in a computer-readable fashion, using state.output.println(...,verbosity,log). |
void |
printFitness(EvolutionState state,
java.io.PrintWriter writer)
Should print the fitness out in a computer-readable fashion, using state.output.println(...,verbosity,log). |
void |
printFitnessForHumans(EvolutionState state,
int log,
int verbosity)
Should print the fitness out in a pleasing way to humans, using state.output.println(...,verbosity,log) |
void |
readFitness(EvolutionState state,
java.io.LineNumberReader reader)
Reads in the fitness from a form printed by printFitness(). |
Methods inherited from interface ec.Prototype |
defaultBase, protoClone, protoCloneSimple, setup |
Field Detail |
public static final java.lang.String P_FITNESS
Method Detail |
public float fitness()
You are free to restrict this range any way you like: for example, your fitness values might fall in the range [-5.32, 2.3]
Selection methods relying on fitness proportionate information will assume the fitness is non-negative and should throw an error if it is not. Thus if you plan on using FitProportionateSelection, BestSelection, or GreedyOverselection, for example, your fitnesses should assume that 0 is the worst fitness and positive fitness are better. If you're using other selection methods (Tournament selection, various ES selection procedures, etc.) your fitness values can be anything.
Similarly, if you're writing a selection method and it needs positive fitnesses, you should check for negative values and issue an error; and if your selection method doesn't need an absolute fitness value, it should use the equivalentTo() and betterThan() methods instead.
If your fitness scheme does not use a metric quantifiable to a single positive value (for example, MultiObjectiveFitness), you should perform some reasonable translation.
public boolean isIdealFitness()
public boolean equivalentTo(Fitness _fitness)
public boolean betterThan(Fitness _fitness)
public void printFitnessForHumans(EvolutionState state, int log, int verbosity)
public void printFitness(EvolutionState state, int log, int verbosity)
public void printFitness(EvolutionState state, java.io.PrintWriter writer)
public void readFitness(EvolutionState state, java.io.LineNumberReader reader) throws java.io.IOException, java.lang.CloneNotSupportedException
java.io.IOException
java.lang.CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |