|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.rubecula.darwin.domain.fitness.Fitness_
public abstract class Fitness_
This type represents the fitness of a Trait/EcoFactor combination.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
LOG
The logger for this class. |
Constructor Summary | |
---|---|
protected |
Fitness_()
|
protected |
Fitness_(FitnessFunction fitnessFunction,
FunctionListener functionListener)
|
Method Summary | |
---|---|
protected abstract double |
bandwidth(java.lang.String key)
Concrete sub-classes must implement this method to indicate how sharp the fitness curve should be with respect to the possible values of the variate. |
protected double |
calculateFitness(double t,
double f,
java.lang.String keyT,
java.lang.String keyF)
Calculate and return the value of the probability density function corresponding to the variate value t * sT of a continuous
distribution with mean: f * sF and standard deviation: the
value of bandwidth(String) . |
int |
compare(double fitness1,
double fitness2)
Compare fitness 1 with fitness 2 (fitter values are higher values). |
boolean |
equals(java.lang.Object obj)
|
java.lang.Number |
getEnvironmentFactor()
|
java.lang.String |
getExpression()
|
com.rubecula.jexpression.Term[] |
getExpressionTerms()
|
protected FitnessFunction |
getFitnessFunction()
|
protected double |
getTolerance()
|
int |
hashCode()
|
void |
resetAdjustment(java.lang.Number factor,
java.lang.String trait)
By default, this method returns null. |
void |
resetEnvironmentFactor(java.lang.String trait,
EcoFactor factor)
|
protected double |
scaleFactor(java.lang.String key)
|
protected double |
scaleTrait(java.lang.String key)
|
protected void |
setTolerance(double tolerance)
TODO consider making this public |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.rubecula.darwin.domain.helper.Fitness |
---|
getFitness, getWeight |
Field Detail |
---|
protected static final org.apache.commons.logging.Log LOG
Constructor Detail |
---|
protected Fitness_()
protected Fitness_(FitnessFunction fitnessFunction, FunctionListener functionListener)
fitnessFunction
- functionListener
- a listener to function changesMethod Detail |
---|
public int compare(double fitness1, double fitness2)
compare
in interface Fitness
fitness1
- fitness2
-
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public java.lang.Number getEnvironmentFactor()
getEnvironmentFactor
in interface Fitness
Fitness.getEnvironmentFactor()
public java.lang.String getExpression()
getExpression
in interface com.rubecula.jexpression.EvalExpression
EvalExpression.getExpression()
public com.rubecula.jexpression.Term[] getExpressionTerms()
getExpressionTerms
in interface com.rubecula.jexpression.EvalExpression
EvalExpression.getExpressionTerms()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public void resetAdjustment(java.lang.Number factor, java.lang.String trait)
resetAdjustment
in interface Fitness
factor
- if 1 is passed in then nothing changes.trait
- XXXFitness.resetAdjustment(java.lang.Number,
java.lang.String)
public void resetEnvironmentFactor(java.lang.String trait, EcoFactor factor)
resetEnvironmentFactor
in interface Fitness
trait
- XXXfactor
- XXXFitness.resetEnvironmentFactor(String,
com.rubecula.darwin.domain.helper.EcoFactor)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
protected abstract double bandwidth(java.lang.String key)
key
- the key which determines which bandwidth to get (trait or
ecofactor).
protected double calculateFitness(double t, double f, java.lang.String keyT, java.lang.String keyF) throws FitnessException
t * sT
of a continuous
distribution with mean: f * sF
and standard deviation: the
value of bandwidth(String)
. The actual continuous distribution
used is defined the the _fitnessFunction
.
Implementers of Fitness may override this method if they need something
different.
XXX consider renaming some of the parameters (trait -> variant)
t
- the trait valuef
- the eco factor valuekeyT
- the trait key (identifier) used to determine which scale
factor to use, using scaleTrait(String)
keyF
- the eco factor key (identifier) used to determine which scale
factor to use, using scaleFactor(String)
FitnessFunction.getFitness(double, double, double)
where
the mean is f * sF
and the value is
t * sT
and the standardDeviation is given by
bandwidth(String)
and where sT is the value returned
from the method scaleTrait(String)
and sF is the value
returned from the method scaleFactor(String)
.
FitnessException
protected FitnessFunction getFitnessFunction()
protected double getTolerance()
protected double scaleFactor(java.lang.String key)
key
- the key (identifier) of the ecoFactor
protected double scaleTrait(java.lang.String key)
key
- the key (identifier) of the trait
protected void setTolerance(double tolerance)
tolerance
- the tolerance to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |