JGAP

org.jgap.audit
Class Evaluator

java.lang.Object
  extended by org.jgap.audit.Evaluator
All Implemented Interfaces:
java.io.Serializable

public class Evaluator
extends java.lang.Object
implements java.io.Serializable

Gathers statistical data and returns them on request.

Since:
2.2
See Also:
Serialized Form

Nested Class Summary
 class Evaluator.ChromosomeData
           
 class Evaluator.GenotypeData
          Genotype data for one single run
 class Evaluator.GenotypeDataAvg
          Averaged genotype data (computed over all runs of a permutation)
 
Constructor Summary
Evaluator(PermutingConfiguration a_conf)
           
 
Method Summary
protected  void addRunNumber(int a_permutation, int a_run)
           
 KeyedValues2D calcAvgFitness(int a_permutation)
          Calculates the average fitness value curve for a given permutation.
protected  void calcAvgFitnessHelper(int a_permutation, KeyedValues2D result)
           
 KeyedValues2D calcAvgFitnessImpr(int a_permutation)
          Calculates average fitness value improvement per generation.
 Evaluator.GenotypeDataAvg calcPerformance(int a_permutation)
          Calculates performance metrics for a given permutation and run stored before with storeGenotype, like: average fitness, maximum fitness...
protected  java.lang.Object createKey(int a_permutation, int a_run)
           
 KeyedValues2D getData()
           
 java.util.List<Evaluator.GenotypeDataAvg> getGenotypeAverageData()
           
 int getNumberOfRuns(int a_permutation)
           
 java.lang.Number getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
           
 java.lang.Number getValue(int a_permutation, int a_run, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
           
 boolean hasNext()
           
 Configuration next()
           
 Evaluator.GenotypeData retrieveGenotype(int a_permutation, int a_run)
           
 void setValue(double a_value, java.lang.Comparable a_rowKey, java.lang.Comparable a_columnKey)
           
 void setValue(int a_permutation, int a_run, double a_value, java.lang.Comparable a_rowKey, java.lang.Comparable a_columnKey)
          Sets a specific value.
 void storeGenotype(int a_permutation, int a_run, Genotype a_genotype)
          Stores information contained in the given genotype.
 void storePopulation(int a_permutation, int a_run, Population a_pop)
          Stores information contained in the given genotype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Evaluator

public Evaluator(PermutingConfiguration a_conf)
Method Detail

hasNext

public boolean hasNext()

next

public Configuration next()
                   throws InvalidConfigurationException
Throws:
InvalidConfigurationException

setValue

public void setValue(double a_value,
                     java.lang.Comparable a_rowKey,
                     java.lang.Comparable a_columnKey)

getValue

public java.lang.Number getValue(java.lang.Comparable rowKey,
                                 java.lang.Comparable columnKey)

setValue

public void setValue(int a_permutation,
                     int a_run,
                     double a_value,
                     java.lang.Comparable a_rowKey,
                     java.lang.Comparable a_columnKey)
Sets a specific value.

Parameters:
a_permutation - int
a_run - int
a_value - double
a_rowKey - Comparable
a_columnKey - Comparable
Since:
2.2

addRunNumber

protected void addRunNumber(int a_permutation,
                            int a_run)

getValue

public java.lang.Number getValue(int a_permutation,
                                 int a_run,
                                 java.lang.Comparable rowKey,
                                 java.lang.Comparable columnKey)

getData

public KeyedValues2D getData()

createKey

protected java.lang.Object createKey(int a_permutation,
                                     int a_run)

calcAvgFitness

public KeyedValues2D calcAvgFitness(int a_permutation)
Calculates the average fitness value curve for a given permutation. If permutation -1 is given, a composition of all permutations available is created.

Parameters:
a_permutation - -1 to use all permutations
Returns:
DefaultKeyedValues2D list of fitness values, one for each individual in the generation
Since:
2.2

calcAvgFitnessHelper

protected void calcAvgFitnessHelper(int a_permutation,
                                    KeyedValues2D result)

calcAvgFitnessImpr

public KeyedValues2D calcAvgFitnessImpr(int a_permutation)
Calculates average fitness value improvement per generation.

Parameters:
a_permutation - int
Returns:
DefaultKeyedValues2D
Since:
2.2

getNumberOfRuns

public int getNumberOfRuns(int a_permutation)
Parameters:
a_permutation - the permutation to determine the number of runs for
Returns:
the number of runs for the given permutation

storeGenotype

public void storeGenotype(int a_permutation,
                          int a_run,
                          Genotype a_genotype)
Stores information contained in the given genotype.

Parameters:
a_permutation - int
a_run - index of the run proceeded for the given genotype
a_genotype - the genotype holding the population of chromosomes
Since:
2.2

storePopulation

public void storePopulation(int a_permutation,
                            int a_run,
                            Population a_pop)
Stores information contained in the given genotype.

Parameters:
a_permutation - int
a_run - index of the run proceeded for the given genotype
a_pop - the population holding the relevant chromosomes
Since:
3.5 (originally named storeGenotype)

retrieveGenotype

public Evaluator.GenotypeData retrieveGenotype(int a_permutation,
                                               int a_run)

calcPerformance

public Evaluator.GenotypeDataAvg calcPerformance(int a_permutation)
Calculates performance metrics for a given permutation and run stored before with storeGenotype, like: average fitness, maximum fitness...

Parameters:
a_permutation - the permutation to compute the performance metrics for
Returns:
computed statistical data
Since:
2.2

getGenotypeAverageData

public java.util.List<Evaluator.GenotypeDataAvg> getGenotypeAverageData()
Returns:
Averaged genotype data
Since:
3.5

JGAP