Class SDE

All Implemented Interfaces:
Discrete, CLOProvider

public class SDE extends ODE
Integrator for stochastic differential equations (SDE) based on Euler's method.
Author:
Christoph Hauert
  • Field Details

    • module

      protected Module module
      Convenience variable: module associated with this model (useful as long as SDE models are restricted to single species).
  • Constructor Details

    • SDE

      public SDE(EvoLudo engine)
      Constructs a new model for the numerical integration of the system of stochastic differential equations representing the dynamics specified by the Module module using the EvoLudo pacemaker engine to control the numerical evaluations. The integrator implements Euler's method (fixed step size).

      Important: for reproducibility the shared random number generator should be used.

      Parameters:
      engine - the pacemaker for running the model
      See Also:
  • Method Details

    • load

      public void load()
      Description copied from class: Model
      Milestone: Load this model and allocate resources (if applicable).
      Overrides:
      load in class ODE
      See Also:
    • unload

      public void unload()
      Description copied from class: Model
      Milestone: Unload this model and free resources (if applicable).
      Overrides:
      unload in class ODE
      See Also:
    • check

      public boolean check()
      Description copied from class: Model
      Check consistency of parameters and adjust if necessary (and possible). All issues and modifications should be reported through logger. Some parameters can be adjusted while the model remains active or even while running, whereas others require a reset. An example of the former category is in general simple adjustments of payoffs, while an example of the latter category is a change of the population structure.
      Overrides:
      check in class ODE
      Returns:
      true if reset required
      See Also:
    • reset

      public void reset()
      Description copied from class: Model
      Milestone: Reset this model
      Overrides:
      reset in class ODE
      See Also:
    • next

      public boolean next()
      Description copied from class: ODE
      Advance model by one step. The details of what happens during one step depends on the models Type as well as its Mode.

      Implementation Notes:

      Before:
      1. yt current state
      2. ft current fitness
      3. dyt current derivatives fitness
      4. dtTry size of time step attempting to make
      After:
      1. yt next state
      2. ft next fitness
      3. dyt next derivatives
      4. yout contains previous state (i.e. yt when entering method)
      5. stepTaken the time between yt and yout
      Overrides:
      next in class ODE
      Returns:
      true if next() can be called again. Typically false is returned if the model requires attention, such as the following conditions:
      • the model has converged
      • the model turned monomorphic (stops only if requested)
      • a statistics sample is available
      • a preset time has been reached
      See Also:
    • checkConvergence

      public boolean checkConvergence(double dist2)
      Helper method to check whether the squared distance dist2 qualifies to signal convergence.

      Implementation Notes:

      1. ODE's can converge even with non-zero mutation rates
      2. step size may keep decreasing without ever reaching the accuracy threshold (or reach step). This scenario requires an emergency brake (otherwise the browser becomes completely unresponsive - nasty!). Emergency brake triggered if stepTaken is so small that more than 1/(accuracy * stepTaken) updates are required to complete dt.
      3. stepTaken < 0 may hold but irrelevant because only the squared value is used.

      Note: SDE's only converge to absorbing states (including extinction), if there are any. Moreover, SDE's cannot converge with non-zero mutation rates (except extinction).

      Overrides:
      checkConvergence in class ODE
      Parameters:
      dist2 - the squared distance between the current and previous states (y[t+dt]-y[t])2.
      Returns:
      true if convergence criteria passed
    • deStep

      protected double deStep(double step)
      Attempts a numerical integration step of size step. The baseline are steps of fixed size following Euler's method. For stochastic differential equations Gaussian distributed white noise is added.

      Implementation Notes:

      Integration of SDEs can be optimized in 1 and 2 dimensions for replicator systems this means 2 or 3 strategies. Currently noise implemented only for replicator type dynamics.
      Overrides:
      deStep in class ODE
      Parameters:
      step - the time step to attempt
      Returns:
      squared distance between this state and previous one, (yt-yout)2.
      See Also:
    • readStatisticsSample

      public void readStatisticsSample()
      Description copied from class: Model
      Signal that statistics sample is ready to process.
      Overrides:
      readStatisticsSample in class Model
    • resetStatisticsSample

      public void resetStatisticsSample()
      Description copied from class: Model
      Reset statistics and get ready to start new collection.
      Overrides:
      resetStatisticsSample in class Model
    • permitsSampleStatistics

      public boolean permitsSampleStatistics()
      Check if the current model settings permit sample statistics. Fixation probabilities and times are examples of statistics based on samples.
      Overrides:
      permitsSampleStatistics in class Model
      Returns:
      true if sample statistics are permitted
      See Also:
    • permitsUpdateStatistics

      public boolean permitsUpdateStatistics()
      Description copied from class: Model
      Check if the current model settings permit update statistics. Sojourn times are an example of statistics based on updates.
      Overrides:
      permitsUpdateStatistics in class Model
      Returns:
      true if update statistics are permitted
    • collectCLO

      public void collectCLO(CLOParser parser)
      Description copied from interface: CLOProvider
      All providers of command line options must implement this method to collect their options.

      Each command line option is (uniquely) identified by it's name (see CLOption.getName()), which corresponds to the long version of the option. If an attempt is made to add an option with a name that already exists, the parser issues a warning and ignores the option. Thus, in general, implementing subclasses should first register their options and call super.collectCLO(CLOParser) at the end such that subclasses are able to override command line options specified in a parental class.

      Override this method in subclasses to add further command line options. Subclasses must make sure that they include a call to super.

      Specified by:
      collectCLO in interface CLOProvider
      Overrides:
      collectCLO in class ODE
      Parameters:
      parser - the reference to parser that manages command line options
      See Also: