jaga.pj.circuits.experiment
Class  SimpleOscillatorExperiment
java.lang.Object
  |
  +--jaga.pj.circuits.experiment.SimpleOscillatorExperiment
- All Implemented Interfaces: 
 - Experiment, java.io.Serializable
 
- public class SimpleOscillatorExperiment
- extends java.lang.Object
- implements Experiment
   
- See Also: 
 - Serialized Form
 
 
 
| Methods inherited from class java.lang.Object | 
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
 
SimpleOscillatorExperiment
public SimpleOscillatorExperiment(int period)
- Creates new SimpleOscillatorExperiment
- Parameters:
 period - how often we want a rising edge to appear in the output measured in sampleData elements (the smallest simulator time slice)
 
 
SimpleOscillatorExperiment
public SimpleOscillatorExperiment(int period,
                                  int periodsToTest,
                                  int testChunks,
                                  int logicThreshold)
- Creates new SimpleOscillatorExperiment
- Parameters:
 period - how often we want a rising edge to appear in the output measured in sampleData elementsperiodsToTest - sample enough so that we try and achieve what number of rising edges: ie. if we are looking for 1 rising edge every 10 samples then we have to generate a test of 200 samples to expect to find 20 rising edges.testChunks - defines in how many pieces we will subdivide our test.  If the pieces are too large then we may have a lot of edges at beginning and none at end and we don't want that!how - long output has to stay stable for it to count as a 1 or 0 horter glitches will be punished..
 
 
getFitness
public double getFitness(SampleData[] in,
                         SampleData[] out)
- 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.
 
 There should be periodsToTest rising edges in the output because of the length it
 has been set to in the generateInput function.  So now a good fitness
 function looks like:
 fitness = 1 / ( abs( risingEdges - periodsToTest ) + 1 )
 
 which looks like a big circus tent with its roof at (periodsToTest, 1)
 This is calculated for each chunks and their average fitness taken.
 Rising edges which result around 1s and 0s that don't meet the
 logicThreshold criteria are counted as bad edges and they contribute
 to a penalty which is multiplied to the fitness:
 penalty = 1 / ( badEdges + 1 )
- Specified by: 
 getFitness in interface Experiment
 
- Parameters:
 in - array of inputsout - array of outputs
 
 
generateInput
public SampleData[] generateInput()
- generates an array of inputs suitable for this experiment
 using default input sample separation.
- 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.
 
 
getNumOfInputs
public int getNumOfInputs()
- Specified by: 
 getNumOfInputs in interface Experiment
 
getNumOfOutputs
public int getNumOfOutputs()
- Specified by: 
 getNumOfOutputs in interface Experiment
 
toString
public java.lang.String toString()
- Overrides:
 toString in class java.lang.Object