com.anji.integration
Class TargetFitnessFunction

java.lang.Object
  extended bycom.anji.integration.TargetFitnessFunction
All Implemented Interfaces:
BulkFitnessFunction, Configurable, java.io.Serializable
Direct Known Subclasses:
ExponentialTargetFitnessFunction, NeatTargetFitnessFunction

public abstract class TargetFitnessFunction
extends java.lang.Object
implements BulkFitnessFunction, Configurable

Determines fitness based on how close Activator output is to a target.

Author:
Philip Tucker
See Also:
Serialized Form

Field Summary
static java.lang.String STIMULI_FILE_NAME_KEY
          properties key, file containing strimuli
static java.lang.String TARGETS_FILE_NAME_KEY
          properties key, file containing output targets
 
Constructor Summary
TargetFitnessFunction()
           
 
Method Summary
protected abstract  int calculateErrorFitness(double[][] responses, double minResponse, double maxResponse)
           
 void evaluate(java.util.List genotypes)
          Iterates through chromosomes.
 int getMaxFitnessValue()
           
protected  double[][] getStimuli()
           
protected  double getTargetRange()
           
protected  double[][] getTargets()
           
 void init(Properties props)
          See Parameter Details for specific property settings.
protected  void setMaxFitnessValue(int aMaxFitnessValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STIMULI_FILE_NAME_KEY

public static final java.lang.String STIMULI_FILE_NAME_KEY
properties key, file containing strimuli

See Also:
Constant Field Values

TARGETS_FILE_NAME_KEY

public static final java.lang.String TARGETS_FILE_NAME_KEY
properties key, file containing output targets

See Also:
Constant Field Values
Constructor Detail

TargetFitnessFunction

public TargetFitnessFunction()
Method Detail

init

public void init(Properties props)
See Parameter Details for specific property settings.

Specified by:
init in interface Configurable
Parameters:
props - configuration parameters

setMaxFitnessValue

protected void setMaxFitnessValue(int aMaxFitnessValue)
Parameters:
aMaxFitnessValue - maximum raw fitness this function will return

evaluate

public final void evaluate(java.util.List genotypes)
Iterates through chromosomes. For each, transcribe it to an Activator and present the stimuli to the activator. The stimuli are presented in random order to ensure the underlying network is not memorizing the sequence of inputs. Calculation of the fitness based on error is delegated to the subclass. This method adjusts fitness for network size, based on configuration.

Specified by:
evaluate in interface BulkFitnessFunction
Parameters:
genotypes - List contains Chromosome objects.
See Also:
calculateErrorFitness(double[][], double, double)

calculateErrorFitness

protected abstract int calculateErrorFitness(double[][] responses,
                                             double minResponse,
                                             double maxResponse)
Parameters:
responses -
minResponse -
maxResponse -
Returns:
fitness based on error.
See Also:
evaluate(List)

getTargetRange

protected double getTargetRange()
Returns:
if response is within this range of the target, error is 0

getStimuli

protected double[][] getStimuli()
Returns:
sequence of stimuli activation patterns

getTargets

protected double[][] getTargets()
Returns:
sequence of target values

getMaxFitnessValue

public int getMaxFitnessValue()
Specified by:
getMaxFitnessValue in interface BulkFitnessFunction
Returns:
maximum possible fitness value for this function