Package ec.simple

Class SimpleShortStatistics

java.lang.Object
ec.Statistics
ec.simple.SimpleShortStatistics
All Implemented Interfaces:
Setup, Singleton, Serializable
Direct Known Subclasses:
KozaShortStatistics

public class SimpleShortStatistics extends Statistics
A Simple-style statistics generator, intended to be easily parseable with awk or other Unix tools. Prints fitness information, one generation (or pseudo-generation) per line. If do-time is true, then timing information is also given. If do-size is true, then size information is also given. No final statistics information is provided. You can also set SimpleShortStatistics to only output every *modulus* generations to keep the tally shorter. And you can gzip the statistics file.

Each line represents a single generation. The first items on a line are always:

  • The generation number
  • (if do-time) how long initialization took in milliseconds, or how long the previous generation took to breed to form this generation
  • (if do-time) How long evaluation took in milliseconds this generation

Then, (if do-subpops) the following items appear, once per each subpopulation:

  • (if do-size) The average size of an individual this generation
  • (if do-size) The average size of an individual so far in the run
  • (if do-size) The size of the best individual this generation
  • (if do-size) The size of the best individual so far in the run
  • The mean fitness of the subpopulation this generation
  • The best fitness of the subpopulation this generation
  • The best fitness of the subpopulation so far in the run

Then the following items appear, for the whole population:

  • (if do-size) The average size of an individual this generation
  • (if do-size) The average size of an individual so far in the run
  • (if do-size) The size of the best individual this generation
  • (if do-size) The size of the best individual so far in the run
  • The mean fitness this generation
  • The best fitness this generation
  • The best fitness so far in the run
Compressed files will be overridden on restart from checkpoint; uncompressed files will be appended on restart.

Parameters

base.file
String (a filename), or nonexistant (signifies stdout)
(the log for statistics)
base.gzip
boolean
(whether or not to compress the file (.gz suffix added)
base.modulus
integer >= 1 (default)
(How often (in generations) should we print a statistics line?)
base.do-time
bool = true or false (default)
(print timing information?)
base.do-size
bool = true or false (default)
(print sizing information?)
base.do-subpops
bool = true or false (default)
(print information on a per-subpop basis as well as per-population?)
See Also:
  • Field Details

    • P_STATISTICS_MODULUS

      public static final String P_STATISTICS_MODULUS
      See Also:
    • P_DELIMITER

      public static final String P_DELIMITER
      See Also:
    • P_COMPRESS

      public static final String P_COMPRESS
      See Also:
    • P_FULL

      public static final String P_FULL
      See Also:
    • P_DO_SIZE

      public static final String P_DO_SIZE
      See Also:
    • P_DO_TIME

      public static final String P_DO_TIME
      See Also:
    • P_DO_SUBPOPS

      public static final String P_DO_SUBPOPS
      See Also:
    • P_DO_HEADER

      public static final String P_DO_HEADER
      See Also:
    • P_STATISTICS_FILE

      public static final String P_STATISTICS_FILE
      See Also:
    • statisticslog

      public int statisticslog
    • modulus

      public int modulus
    • delimiter

      public String delimiter
    • doSize

      public boolean doSize
    • doTime

      public boolean doTime
    • doSubpops

      public boolean doSubpops
    • doHeader

      public boolean doHeader
    • bestSoFar

      public Individual[] bestSoFar
    • totalSizeSoFar

      public long[] totalSizeSoFar
    • totalIndsSoFar

      public long[] totalIndsSoFar
    • totalIndsThisGen

      public long[] totalIndsThisGen
    • totalSizeThisGen

      public long[] totalSizeThisGen
    • totalFitnessThisGen

      public double[] totalFitnessThisGen
    • bestOfGeneration

      public Individual[] bestOfGeneration
    • lastTime

      public long lastTime
  • Constructor Details

    • SimpleShortStatistics

      public SimpleShortStatistics()
  • Method Details

    • 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
    • getBestSoFar

      public Individual[] getBestSoFar()
    • preInitializationStatistics

      public void preInitializationStatistics(EvolutionState state)
      Description copied from class: Statistics
      Called immediately before population initialization occurs.
      Overrides:
      preInitializationStatistics 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
    • preBreedingStatistics

      public void preBreedingStatistics(EvolutionState state)
      Description copied from class: Statistics
      GENERATIONAL: Called immediately before breeding occurs.
      Overrides:
      preBreedingStatistics in class Statistics
    • postBreedingStatistics

      public void postBreedingStatistics(EvolutionState state)
      Description copied from class: Statistics
      GENERATIONAL: Called immediately after breeding occurs.
      Overrides:
      postBreedingStatistics in class Statistics
    • preEvaluationStatistics

      public void preEvaluationStatistics(EvolutionState state)
      Description copied from class: Statistics
      GENERATIONAL: Called immediately before evaluation occurs.
      Overrides:
      preEvaluationStatistics in class Statistics
    • prepareStatistics

      protected void prepareStatistics(EvolutionState state)
    • gatherExtraSubpopStatistics

      protected void gatherExtraSubpopStatistics(EvolutionState state, int subpop, int individual)
    • printExtraSubpopStatisticsBefore

      protected void printExtraSubpopStatisticsBefore(EvolutionState state, int subpop)
    • printExtraSubpopStatisticsAfter

      protected void printExtraSubpopStatisticsAfter(EvolutionState state, int subpop)
    • gatherExtraPopStatistics

      protected void gatherExtraPopStatistics(EvolutionState state, int subpop)
    • printExtraPopStatisticsBefore

      protected void printExtraPopStatisticsBefore(EvolutionState state)
    • printExtraPopStatisticsAfter

      protected void printExtraPopStatisticsAfter(EvolutionState state)
    • postEvaluationStatistics

      public void postEvaluationStatistics(EvolutionState state)
      Prints out the statistics, but does not end with a println -- this lets overriding methods print additional statistics on the same line
      Overrides:
      postEvaluationStatistics in class Statistics