com.rubecula.darwin.domain.helper
Interface FitnessEngine

All Superinterfaces:
CacheSignature, HasExpressions
All Known Implementing Classes:
FitnessEngine_, FitnessEngine_PepperedMoth, FitnessEngine_Simple, FitnessEngine_TS

public interface FitnessEngine
extends HasExpressions, CacheSignature

Registry for fitness functions for Taxon (Evolutionary Computation) Systems.

Version:
$Revision: 1.15 $
Author:
Robin Hillyard

Method Summary
 double calculateFitness(Phenotype phenotype, Environment environment)
           
 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.
 Fitness putFitness(java.lang.String key, Fitness fitness)
          Register a fitness pair with this fitness engine.
 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.
 Fitness unregisterFitness(java.lang.String key)
          Remove the fitness identified by key
 
Methods inherited from interface com.rubecula.darwin.foundation.HasExpressions
getExpressions
 
Methods inherited from interface com.rubecula.darwin.domain.helper.CacheSignature
getSignature
 

Method Detail

calculateFitness

double calculateFitness(Phenotype phenotype,
                        Environment environment)
                        throws FitnessException
Parameters:
phenotype -
environment -
Returns:
the fitness for this phenotype in the context of environment TODO consider narrowing type of phenotype to TraitMap
Throws:
FitnessException

onEnvironmentChange

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. If the setup is non-null, we invoke it with the object that is passed in to this method.

Parameters:
characterKeys - XXX
environment -
See Also:
calculateFitness(com.rubecula.darwin.domain.helper.Phenotype, com.rubecula.darwin.domain.helper.Environment)

putFitness

Fitness putFitness(java.lang.String key,
                   Fitness fitness)
Register a fitness pair with this fitness engine.

Parameters:
key - a key by which the fitness may be retrieved
fitness - the fitness evaluator
Returns:
true if registration was successful.

setFitnessAdjustment

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. If the setup is non-null, we invoke it with the object that is passed in to this method.

Parameters:
characterKeys - XXX
adjustment - the object to be passed in to the setup method.
See Also:
calculateFitness(com.rubecula.darwin.domain.helper.Phenotype, com.rubecula.darwin.domain.helper.Environment)

setFitnessCache

void setFitnessCache(FitnessCache fitnessCache)
TODO consider renaming this to addListener(FitnessEngineListener ...) Register the cache for this fitness engine.

Parameters:
fitnessCache -

unregisterFitness

Fitness unregisterFitness(java.lang.String key)
Remove the fitness identified by key

Parameters:
key -
Returns:
the old value of Fitness for the key


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.