Package ec

# Class Statistics

java.lang.Object
ec.Statistics

All Implemented Interfaces:
  `Setup`, `Singleton`, `Serializable`

Direct Known Subclasses:
  `ChartableStatistics`, `RandomRestarts`, `SimpleShortStatistics`, `SimpleStatistics`, `TarpeianStatistics`

public class Statistics extends Object implements Singleton
Statistics and its subclasses are Cliques which generate statistics during the run. Statistics are arranged in a tree hierarchy -- The root statistics object may have "children", and when the root is called, it calls its children with the same message. You can override this behavior however you see fit.

There are lots of places where statistics might be nice to print out. These places are implemented as hooks in the Statistics object which you can override if you like; otherwise they call the default behavior. If you plan on allowing your Statistics subclass to contain children, you should remember to call the appropriate super.foo() if you override any foo() method.

While there are lots of hooks, various EvolutionState objects only implement a subset of them. You'll need to look at the EvolutionState code to see which ones are implemented to make sure that your statistics hooks are called appropriately!

Statistics objects should set up their statistics logs etc. during `setup(...)`. Remember to make the log restartable in case of restarting from a checkpoint.

Steady-State Statistics. For convenience, Statistics contains default implementations of the SteadyStateStatisticsForm methods but does not implement SteadyStateStatisticsForm. This mostly is intended to keep SteadyStateStatistcsForm implementations from having to call functions on all their children: instead they can just call foo.super();

Parameters

base.`num-children` int >= 0 | (number of child statistics objects)
base.`child`.n classname, inherits or equals ec.Statistics | (the class of child statistics object number n)

Parameter bases

base.`child`.n | species (child statistics object number n)

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `Statistics[]`
  `children`
  `static final String`
  `P_CHILD`
  `static final String`
  `P_MUZZLE`
  `static final String`
  `P_NUMCHILDREN`
  `static final String`
  `P_SILENT`
  `static final String`
  `P_SILENT_FILE`
  `static final String`
  `P_SILENT_PRINT`
  `boolean`
  `silentFile`
  `boolean`
  `silentPrint`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Statistics()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `enteringInitialPopulationStatistics(SteadyStateEvolutionState state)`
  STEADY-STATE: called when we created an empty initial Population.
  `void`
  `enteringSteadyStateStatistics(int subpop, SteadyStateEvolutionState state)`
  STEADY-STATE: called when a given Subpopulation is entering the Steady-State.
  `void`
  `finalStatistics(EvolutionState state, int result)`
  Called immediately after the run has completed.
  `void`
  `generationBoundaryStatistics(EvolutionState state)`
  STEADY-STATE: called each time the generation count increments
  `void`
  `individualsBredStatistics(SteadyStateEvolutionState state, Individual[] individuals)`
  STEADY-STATE: called each time new individuals are bred during the steady-state process.
  `void`
  `individualsEvaluatedStatistics(SteadyStateEvolutionState state, Individual[] newIndividuals, Individual[] oldIndividuals, int[] subpopulations, int[] indices)`
  STEADY-STATE: called each time new individuals are evaluated during the steady-state process.
  `void`
  `postBreedingStatistics(EvolutionState state)`
  GENERATIONAL: Called immediately after breeding occurs.
  `void`
  `postCheckpointStatistics(EvolutionState state)`
  Called immediately after checkpointing occurs.
  `void`
  `postEvaluationStatistics(EvolutionState state)`
  GENERATIONAL: Called immediately after evaluation occurs.
  `void`
  `postInitializationStatistics(EvolutionState state)`
  GENERATIONAL: Called immediately after population initialization occurs.
  `void`
  `postPostBreedingExchangeStatistics(EvolutionState state)`
  Called immediately after the post-breeding exchange occurs.
  `void`
  `postPreBreedingExchangeStatistics(EvolutionState state)`
  Called immediately after the pre-breeding exchange occurs.
  `void`
  `preBreedingStatistics(EvolutionState state)`
  GENERATIONAL: Called immediately before breeding occurs.
  `void`
  `preCheckpointStatistics(EvolutionState state)`
  Called immediately before checkpointing occurs.
  `void`
  `preEvaluationStatistics(EvolutionState state)`
  GENERATIONAL: Called immediately before evaluation occurs.
  `void`
  `preInitializationStatistics(EvolutionState state)`
  Called immediately before population initialization occurs.
  `void`
  `prePostBreedingExchangeStatistics(EvolutionState state)`
  Called immediately before the post-breeding exchange occurs.
  `void`
  `prePreBreedingExchangeStatistics(EvolutionState state)`
  Called immediately before the pre-breeding exchange 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 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### P_NUMCHILDREN

    public static final String P_NUMCHILDREN
    See Also:
      - Constant Field Values

  - ### P_CHILD

    public static final String P_CHILD
    See Also:
      - Constant Field Values

  - ### P_SILENT

    public static final String P_SILENT
    See Also:
      - Constant Field Values

  - ### P_MUZZLE

    public static final String P_MUZZLE
    See Also:
      - Constant Field Values

  - ### P_SILENT_PRINT

    public static final String P_SILENT_PRINT
    See Also:
      - Constant Field Values

  - ### P_SILENT_FILE

    public static final String P_SILENT_FILE
    See Also:
      - Constant Field Values

  - ### children

    public Statistics[] children

  - ### silentFile

    public boolean silentFile

  - ### silentPrint

    public boolean silentPrint

- ## Constructor Details

  - ### Statistics

    public Statistics()

- ## 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`

  - ### preInitializationStatistics

    public void preInitializationStatistics(EvolutionState state)
    Called immediately before population initialization occurs.

  - ### postInitializationStatistics

    public void postInitializationStatistics(EvolutionState state)
    GENERATIONAL: Called immediately after population initialization occurs.

  - ### preCheckpointStatistics

    public void preCheckpointStatistics(EvolutionState state)
    Called immediately before checkpointing occurs.

  - ### postCheckpointStatistics

    public void postCheckpointStatistics(EvolutionState state)
    Called immediately after checkpointing occurs.

  - ### preEvaluationStatistics

    public void preEvaluationStatistics(EvolutionState state)
    GENERATIONAL: Called immediately before evaluation occurs.

  - ### postEvaluationStatistics

    public void postEvaluationStatistics(EvolutionState state)
    GENERATIONAL: Called immediately after evaluation occurs.

  - ### prePreBreedingExchangeStatistics

    public void prePreBreedingExchangeStatistics(EvolutionState state)
    Called immediately before the pre-breeding exchange occurs.

  - ### postPreBreedingExchangeStatistics

    public void postPreBreedingExchangeStatistics(EvolutionState state)
    Called immediately after the pre-breeding exchange occurs.

  - ### preBreedingStatistics

    public void preBreedingStatistics(EvolutionState state)
    GENERATIONAL: Called immediately before breeding occurs.

  - ### postBreedingStatistics

    public void postBreedingStatistics(EvolutionState state)
    GENERATIONAL: Called immediately after breeding occurs.

  - ### prePostBreedingExchangeStatistics

    public void prePostBreedingExchangeStatistics(EvolutionState state)
    Called immediately before the post-breeding exchange occurs.

  - ### postPostBreedingExchangeStatistics

    public void postPostBreedingExchangeStatistics(EvolutionState state)
    Called immediately after the post-breeding exchange occurs.

  - ### finalStatistics

    public void finalStatistics(EvolutionState state, int result)
    Called immediately after the run has completed. result is either `state.R_FAILURE`, indicating that an ideal individual was not found, or `state.R_SUCCESS`, indicating that an ideal individual was found.

  - ### enteringInitialPopulationStatistics

    public void enteringInitialPopulationStatistics(SteadyStateEvolutionState state)
    STEADY-STATE: called when we created an empty initial Population.

  - ### enteringSteadyStateStatistics

    public void enteringSteadyStateStatistics(int subpop, SteadyStateEvolutionState state)
    STEADY-STATE: called when a given Subpopulation is entering the Steady-State.

  - ### individualsBredStatistics

    public void individualsBredStatistics(SteadyStateEvolutionState state, Individual[] individuals)
    STEADY-STATE: called each time new individuals are bred during the steady-state process.

  - ### individualsEvaluatedStatistics

    public void individualsEvaluatedStatistics(SteadyStateEvolutionState state, Individual[] newIndividuals, Individual[] oldIndividuals, int[] subpopulations, int[] indices)
    STEADY-STATE: called each time new individuals are evaluated during the steady-state process. You can look up the individuals in state.newIndividuals[]

  - ### generationBoundaryStatistics

    public void generationBoundaryStatistics(EvolutionState state)
    STEADY-STATE: called each time the generation count increments