jaga.pj.circuits.experiment
Class ArbitraryFunctionExperiment

java.lang.Object
  |
  +--jaga.pj.circuits.experiment.ArbitraryFunctionExperiment
All Implemented Interfaces:
ConfigurableExperiment, ConfigurableRandomInputExperiment, Experiment, java.io.Serializable

public class ArbitraryFunctionExperiment
extends java.lang.Object
implements ConfigurableRandomInputExperiment

Experiment which evaluates behaviour as a given Boolean Function. GetDesiredOutputs not working currently!

See Also:
Serialized Form

Constructor Summary
ArbitraryFunctionExperiment(BooleanFunction function, double tSetup)
           
ArbitraryFunctionExperiment(BooleanFunction function, double tSetup, FitnessFunction fitnessFunction)
           
 
Method Summary
 SampleData[] generateInput()
          Generate input using default parameters
 SampleData[] generateInput(int inputSampleSeparation)
          generates an array of inputs suitable for this experiment.
 SampleData[] generateInput(int inputSampleSeparation, int inputDataLength)
          Generate input suitable for testing this experiment using custom parameters
 java.lang.Object get(java.lang.Object param)
           
 double getFitness(SampleData[] in, SampleData[] out)
          returns a fitness associated to a given input/output pair for this experiment.
 int getNumOfInputs()
           
 int getNumOfOutputs()
           
 void set(java.lang.Object param)
          Sets the random number generator seed.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArbitraryFunctionExperiment

public ArbitraryFunctionExperiment(BooleanFunction function,
                                   double tSetup,
                                   FitnessFunction fitnessFunction)
Parameters:
function - The Boolean Function to evaluate behaviour as.
tSetup - Proportion of output data per input cycle to ignore.
fitnessFunction - Algorithm to determine fitness from inputs, outputs and desired ouptputs.

ArbitraryFunctionExperiment

public ArbitraryFunctionExperiment(BooleanFunction function,
                                   double tSetup)
Method Detail

getNumOfInputs

public int getNumOfInputs()
Specified by:
getNumOfInputs in interface Experiment

getNumOfOutputs

public int getNumOfOutputs()
Specified by:
getNumOfOutputs in interface Experiment

generateInput

public SampleData[] generateInput()
Generate input using default parameters
Specified by:
generateInput in interface Experiment

generateInput

public SampleData[] generateInput(int inputSampleSeparation)
generates an array of inputs suitable for this experiment.
Specified by:
generateInput in interface Experiment
Parameters:
inputSampleSeparation - relative frequency of input to output samples. If this is n, then n outputs will be sampled for every change in inputs.

generateInput

public SampleData[] generateInput(int inputSampleSeparation,
                                  int inputDataLength)
Generate input suitable for testing this experiment using custom parameters
Parameters:
inputDataLength - how long the input data should be
inputSampleSeparation - how often the input samples should change in time. Greater value -> less often

getFitness

public double getFitness(SampleData[] in,
                         SampleData[] out)
Description copied from interface: Experiment
returns a fitness associated to a given input/output pair for this experiment. The fitness is a double and is in adjusted fitness format. From 0 to 1, 1 being perfectly fit.
Specified by:
getFitness in interface Experiment
Following copied from interface: jaga.experiment.Experiment
Parameters:
in - array of inputs
out - array of outputs

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

set

public void set(java.lang.Object param)
Sets the random number generator seed.
Specified by:
set in interface ConfigurableExperiment

get

public java.lang.Object get(java.lang.Object param)
Specified by:
get in interface ConfigurableExperiment