ec.simple
Class SimpleStatistics

java.lang.Object
  extended by ec.Statistics
      extended by ec.simple.SimpleStatistics
All Implemented Interfaces:
Setup, Singleton, SteadyStateStatisticsForm, java.io.Serializable
Direct Known Subclasses:
FinalStatistics

public class SimpleStatistics
extends Statistics
implements SteadyStateStatisticsForm

A basic Statistics class suitable for simple problem applications. SimpleStatistics prints out the best individual, per subpopulation, each generation. At the end of a run, it also prints out the best individual of the run. SimpleStatistics outputs this data to a log which may either be a provided file or stdout. Compressed files will be overridden on restart from checkpoint; uncompressed files will be appended on restart.

SimpleStatistics implements a simple version of steady-state statistics: if it quits before a generation boundary, it will include the best individual discovered, even if the individual was discovered after the last boundary. This is done by using individualsEvaluatedStatistics(...) to update best-individual-of-generation in addition to doing it in postEvaluationStatistics(...).

Parameters

base.gzip
boolean
(whether or not to compress the file (.gz suffix added)
base.file
String (a filename), or nonexistant (signifies stdout)
(the log for statistics)

Version:
1.0
Author:
Sean Luke
See Also:
Serialized Form

Field Summary
 Individual[] best_of_run
          The best individual we've found so far
static java.lang.String P_COMPRESS
          compress?
static java.lang.String P_LOWEST_SCORES
           
static java.lang.String P_STATISTICS_FILE
          log file parameter
protected  boolean pickLowest
          Pick lowest rather than highest scoring individuals
 int statisticslog
          The Statistics' log
 
Fields inherited from class ec.Statistics
children, P_CHILD, P_NUMCHILDREN
 
Constructor Summary
SimpleStatistics()
           
 
Method Summary
 void finalStatistics(EvolutionState state, int result)
          Logs the best individual of the run.
 void generationBoundaryStatistics(EvolutionState state)
          Steady-state only: computes statistics at each generation count
 void individualsEvaluatedStatistics(SteadyStateEvolutionState state, Individual[] newIndividuals, Individual[] oldIndividuals, int[] subpopulations, int[] indicies)
          Steady State only: loads any additional post-generation boundary stragglers into best_of_run.
 void postEvaluationStatistics(EvolutionState state)
          Logs the best individual of the generation.
 void postInitializationStatistics(EvolutionState state)
          GENERATIONAL: Called immediately after population initialization occurs.
 void setup(EvolutionState state, Parameter base)
          Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.
 
Methods inherited from class ec.Statistics
individualsBredStatistics, postBreedingStatistics, postCheckpointStatistics, postInitialEvaluationStatistics, postPostBreedingExchangeStatistics, postPreBreedingExchangeStatistics, preBreedingStatistics, preCheckpointStatistics, preEvaluationStatistics, preInitialEvaluationStatistics, preInitializationStatistics, prePostBreedingExchangeStatistics, prePreBreedingExchangeStatistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ec.steadystate.SteadyStateStatisticsForm
individualsBredStatistics, postInitialEvaluationStatistics, preInitialEvaluationStatistics, preInitializationStatistics
 

Field Detail

P_STATISTICS_FILE

public static final java.lang.String P_STATISTICS_FILE
log file parameter

See Also:
Constant Field Values

P_COMPRESS

public static final java.lang.String P_COMPRESS
compress?

See Also:
Constant Field Values

P_LOWEST_SCORES

public static final java.lang.String P_LOWEST_SCORES
See Also:
Constant Field Values

statisticslog

public int statisticslog
The Statistics' log


best_of_run

public Individual[] best_of_run
The best individual we've found so far


pickLowest

protected boolean pickLowest
Pick lowest rather than highest scoring individuals

Constructor Detail

SimpleStatistics

public SimpleStatistics()
Method Detail

setup

public void setup(EvolutionState state,
                  Parameter base)
Description copied from interface: Setup
Sets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else.

Specified by:
setup in interface Setup
Overrides:
setup in class Statistics

postInitializationStatistics

public void postInitializationStatistics(EvolutionState state)
Description copied from class: Statistics
GENERATIONAL: Called immediately after population initialization occurs.

Overrides:
postInitializationStatistics in class Statistics

postEvaluationStatistics

public void postEvaluationStatistics(EvolutionState state)
Logs the best individual of the generation.

Overrides:
postEvaluationStatistics in class Statistics

individualsEvaluatedStatistics

public void individualsEvaluatedStatistics(SteadyStateEvolutionState state,
                                           Individual[] newIndividuals,
                                           Individual[] oldIndividuals,
                                           int[] subpopulations,
                                           int[] indicies)
Steady State only: loads any additional post-generation boundary stragglers into best_of_run.

Specified by:
individualsEvaluatedStatistics in interface SteadyStateStatisticsForm
Overrides:
individualsEvaluatedStatistics in class Statistics

generationBoundaryStatistics

public void generationBoundaryStatistics(EvolutionState state)
Steady-state only: computes statistics at each generation count

Specified by:
generationBoundaryStatistics in interface SteadyStateStatisticsForm
Overrides:
generationBoundaryStatistics in class Statistics

finalStatistics

public void finalStatistics(EvolutionState state,
                            int result)
Logs the best individual of the run.

Specified by:
finalStatistics in interface SteadyStateStatisticsForm
Overrides:
finalStatistics in class Statistics