|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectec.Fitness
ec.gp.koza.KozaFitness
public class KozaFitness
KozaFitness is a Fitness which stores an individual's fitness as described in Koza I. Well, almost. In KozaFitness, standardized fitness and raw fitness are considered the same (there are different methods for them, but they return the same thing). Standardized fitness ranges from 0.0 inclusive (the best) to infinity exclusive (the worst). Adjusted fitness converts this, using the formula adj_f = 1/(1+f), into a scale from 0.0 exclusive (worst) to 1.0 inclusive (best). While it's the standardized fitness that is stored, it is the adjusted fitness that is printed out. This is all just convenience stuff anyway; selection methods generally don't use these fitness values but instead use the betterThan and equalTo methods.
Default Base
gp.koza.fitness
Field Summary | |
---|---|
protected float |
fitness
This ranges from 0 (best) to infinity (worst). |
int |
hits
This auxillary measure is used in some problems for additional information. |
static java.lang.String |
P_KOZAFITNESS
|
Fields inherited from class ec.Fitness |
---|
FITNESS_PREAMBLE, P_FITNESS |
Constructor Summary | |
---|---|
KozaFitness()
|
Method Summary | |
---|---|
float |
adjustedFitness()
Returns the adjusted fitness metric, which recasts the fitness to the half-open interval (0,1], where 1 is ideal and 0 is worst. |
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. |
Parameter |
defaultBase()
Returns the default base for this prototype. |
boolean |
equivalentTo(Fitness _fitness)
Should return true if this fitness is in the same equivalence class as _fitness, that is, neither is clearly better or worse than the other. |
float |
fitness()
Returns the adjusted fitness metric, which recasts the fitness to the half-open interval (0,1], where 1 is ideal and 0 is worst. |
java.lang.String |
fitnessToString()
Print to a string the fitness in a fashion intended to be parsed in again via readFitness(...). |
java.lang.String |
fitnessToStringForHumans()
Print to a string the fitness in a fashion readable by humans, and not intended to be parsed in again. |
boolean |
isIdealFitness()
Should return true if this is a good enough fitness to end the run |
float |
rawFitness()
Returns the raw fitness metric. |
void |
readFitness(EvolutionState state,
java.io.DataInput dataInput)
Reads the binary form of an individual from a DataInput. |
void |
readFitness(EvolutionState state,
java.io.LineNumberReader reader)
Reads in the fitness from a form outputted by fitnessToString() and thus printFitnessForHumans(...). |
void |
setFitness(EvolutionState state,
float _f)
Deprecated. |
void |
setStandardizedFitness(EvolutionState state,
float _f)
Set the standardized fitness in the half-open interval [0.0,infinity) which is defined (NOTE: DIFFERENT FROM fitness()!!!) as 0.0 being the IDEAL and infinity being worse than the worst possible. |
void |
setup(EvolutionState state,
Parameter base)
Sets up the object by reading it from the parameters stored in state, built off of the parameter base base. |
float |
standardizedFitness()
Returns the standardized fitness metric, which is the same as the raw fitness metric in this scheme. |
void |
writeFitness(EvolutionState state,
java.io.DataOutput dataOutput)
Writes the binary form of an individual out to a DataOutput. |
Methods inherited from class ec.Fitness |
---|
clone, printFitness, printFitness, printFitnessForHumans |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String P_KOZAFITNESS
protected float fitness
public int hits
Constructor Detail |
---|
public KozaFitness()
Method Detail |
---|
public Parameter defaultBase()
Prototype
public final void setFitness(EvolutionState state, float _f)
public final void setStandardizedFitness(EvolutionState state, float _f)
public final float fitness()
fitness
in class Fitness
public final float rawFitness()
public final float standardizedFitness()
public final float adjustedFitness()
public void setup(EvolutionState state, Parameter base)
Prototype
For prototypes, setup(...) is typically called once for the prototype instance; cloned instances do not receive the setup(...) call. setup(...) may be called more than once; the only guarantee is that it will get called at least once on an instance or some "parent" object from which it was ultimately cloned.
setup
in interface Prototype
setup
in interface Setup
setup
in class Fitness
public final boolean isIdealFitness()
Fitness
isIdealFitness
in class Fitness
public boolean equivalentTo(Fitness _fitness)
Fitness
equivalentTo
in class Fitness
public boolean betterThan(Fitness _fitness)
Fitness
betterThan
in class Fitness
public java.lang.String fitnessToString()
Fitness
fitnessToString
in class Fitness
public java.lang.String fitnessToStringForHumans()
Fitness
fitnessToStringForHumans
in class Fitness
public final void readFitness(EvolutionState state, java.io.LineNumberReader reader) throws java.io.IOException
Fitness
readFitness
in class Fitness
java.io.IOException
public void writeFitness(EvolutionState state, java.io.DataOutput dataOutput) throws java.io.IOException
Fitness
writeFitness
in class Fitness
java.io.IOException
public void readFitness(EvolutionState state, java.io.DataInput dataInput) throws java.io.IOException
Fitness
readFitness
in class Fitness
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |