|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.rubecula.darwin.domain.fitness.FitnessEngine_
public abstract class FitnessEngine_
Defines the base methods and fields for an implementation of
FitnessEngine
interface. Contains no fields, methods or constructors.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
LOG
The logger for this class. |
Constructor Summary | |
---|---|
protected |
FitnessEngine_()
No-evaluator form of constructor. |
protected |
FitnessEngine_(com.rubecula.jexpression.Evaluator evaluator,
Realm realm)
Protected Primary Constructor |
Method Summary | |
---|---|
double |
calculateFitness(Phenotype phenotype,
Environment environment)
The base implementation of this method (which should normally be appropriate for all usage) simply goes through all possible pairings of trait/ecofactor (the traits belonging to the phenotype and the ecofactors belonging to the environment) and calculates the weighted product of all fitnesses. |
protected int |
countFitnesses()
|
boolean |
equals(java.lang.Object obj)
|
protected java.util.Set<java.lang.String> |
fitnessKeys()
|
ExpressionMap |
getExpressions()
|
protected Fitness |
getFitness(java.lang.String key)
|
protected java.util.Collection<Fitness> |
getFitnesses()
|
protected Realm |
getRealm()
|
java.lang.String |
getSignature()
|
int |
hashCode()
|
void |
onEnvironmentChange(java.util.Collection<java.lang.String> characterKeys,
Environment environment)
The base implementation of this method (which should normally be appropriate for all usage) simply goes through all possible pairings of trait/ecofactor (from the given traits and the ecofactors belonging to the environment) and gets the appropriate setup. |
void |
onFunctionChange(Function function)
Method to notify a Listener that a function has changed. |
Fitness |
putFitness(java.lang.String key,
Fitness fitness)
Register a fitness pair with this fitness engine. |
protected abstract void |
registerFitnesses(com.rubecula.jexpression.Evaluator evaluator)
|
void |
setFitnessAdjustment(java.util.Collection<java.lang.String> characterKeys,
java.lang.Number adjustment)
The base implementation of this method (which should normally be appropriate for all usage) simply goes through all possible pairings of trait/ecofactor (from the given traits and the ecofactors belonging to the environment) and gets the appropriate setup. |
void |
setFitnessCache(FitnessCache fitnessCache)
TODO consider renaming this to addListener(FitnessEngineListener ...) Register the cache for this fitness engine. |
java.lang.String |
toString()
|
Fitness |
unregisterFitness(java.lang.String key)
Remove the fitness identified by key |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log LOG
Constructor Detail |
---|
protected FitnessEngine_()
protected FitnessEngine_(com.rubecula.jexpression.Evaluator evaluator, Realm realm)
evaluator
- the expression evaluator (or null)realm
- the realm this fitness engine operates in.Method Detail |
---|
public double calculateFitness(Phenotype phenotype, Environment environment) throws FitnessException
TraitMap
.
calculateFitness
in interface FitnessEngine
FitnessException
FitnessEngine.calculateFitness(com.rubecula.darwin.domain.helper.Phenotype,
com.rubecula.darwin.domain.helper.Environment)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public ExpressionMap getExpressions()
getExpressions
in interface HasExpressions
String
/ EvalExpressionMutable
pairs.
The String key for each EvalExpressionMutable
is the name
by which that expression will be known in the user interface.HasExpressions.getExpressions()
public java.lang.String getSignature()
getSignature
in interface CacheSignature
CacheSignature.getSignature()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public void onEnvironmentChange(java.util.Collection<java.lang.String> characterKeys, Environment environment)
onEnvironmentChange
in interface FitnessEngine
environment
- characterKeys
- XXXFitnessEngine.onEnvironmentChange(java.util.Collection,
com.rubecula.darwin.domain.helper.Environment)
public void onFunctionChange(Function function)
FunctionListener
onFunctionChange
in interface FunctionListener
FunctionListener.onFunctionChange(com.rubecula.darwin.foundation.Function)
public Fitness putFitness(java.lang.String key, Fitness fitness)
FitnessEngine
putFitness
in interface FitnessEngine
key
- a key by which the fitness may be retrievedfitness
- the fitness evaluator
FitnessEngine.putFitness(java.lang.String,
com.rubecula.darwin.domain.helper.Fitness)
public void setFitnessAdjustment(java.util.Collection<java.lang.String> characterKeys, java.lang.Number adjustment)
setFitnessAdjustment
in interface FitnessEngine
characterKeys
- adjustment
- the object to be passed in to the setup method.FitnessEngine.calculateFitness(com.rubecula.darwin.domain.helper.Phenotype,
com.rubecula.darwin.domain.helper.Environment)
public void setFitnessCache(FitnessCache fitnessCache)
FitnessEngine
setFitnessCache
in interface FitnessEngine
FitnessEngine.setFitnessCache(com.rubecula.darwin.domain.helper.FitnessCache)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public Fitness unregisterFitness(java.lang.String key)
FitnessEngine
unregisterFitness
in interface FitnessEngine
FitnessEngine.unregisterFitness(java.lang.String)
protected int countFitnesses()
protected java.util.Set<java.lang.String> fitnessKeys()
protected Fitness getFitness(java.lang.String key)
protected java.util.Collection<Fitness> getFitnesses()
protected Realm getRealm()
protected abstract void registerFitnesses(com.rubecula.jexpression.Evaluator evaluator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |