Class simCDLPQ

All Implemented Interfaces:
Runnable, ChangeListener, IBS.HasIBS, IBS.HasIBS.DGroups, IBS.HasIBS.DPairs, MilestoneListener, ODE.HasDE, ODE.HasODE, PDE.HasPDE, SDE.HasSDE, Features, Features.Groups, Features.Pairs, HasHistogram, HasHistogram.Degree, HasHistogram.Fitness, HasHistogram.StatisticsStationary, HasMean, HasMean.Fitness, HasMean.Strategy, HasPop2D, HasPop2D.Fitness, HasPop2D.Strategy, HasPop3D, HasPop3D.Fitness, HasPop3D.Strategy, HasS3, CLOProvider

public class simCDLPQ extends CDLPQ implements ChangeListener
Simulations of peer- versus pool-punishment in voluntary public goods games.
Author:
Christoph Hauert
See Also:
  • "Sigmund K., De Silva H., Traulsen A., Hauert C. (2010) <em>Social learning promotes institutions for governing the commons.</em> Nature 466: 861-863. <a href='https://doi.org/10.1038/nature09203'>doi: 10.1038/nature09203</a>"
  • Field Details

    • snapinterval

      long snapinterval
      The interval for saving snapshots.
    • out

      The output stream. Defaults to System.out.
    • mean

      double[] mean
      Temporary variables for fixation probabilities and absorption times.
    • var

      double[] var
      Temporary variables for fixation probabilities and absorption times.
    • state

      double[] state
      Temporary variables for fixation probabilities and absorption times.
    • prevsample

      double prevsample
      Time of previous sample.
    • cloSnapInterval

      public final CLOption cloSnapInterval
      Command line option to set the interval for taking snapshots.
  • Constructor Details

    • simCDLPQ

      public simCDLPQ(EvoLudo engine)
      Create a new simulation to investigate the role of pool- versus peer-punishment in voluntary public goods games.
      Parameters:
      engine - the pacemaker for running the model
  • Method Details

    • run

      public void run()
      Description copied from class: Module

      Default run-loop for modules. Opportunity to override in subclasses for running customized simulations. Currently only called from EvoLudoJRE.simulation() if custom simulation class is specified in jar file.

      Specified by:
      run in interface Runnable
      Overrides:
      run in class Module
    • modelChanged

      public void modelChanged(ChangeListener.PendingAction action)
      Description copied from interface: ChangeListener
      Called whenever the state of the EvoLudo model changed. Process potentially pending requests.

      Note: the model may process some pending actions directly and without notifying the listeners through modelChanged(PendingAction) first. In particular, this applies to pending actions that fire their own notifications, such as RESET and INIT that in turn trigger modelReset() and modelInit(), respectively.

      Specified by:
      modelChanged in interface ChangeListener
      Parameters:
      action - pending action that needs to be processed.
      See Also:
    • modelStopped

      public void modelStopped()
      Description copied from interface: MilestoneListener
      Called after a running EvoLudo model stopped because the model converged (or reached an absorbing state).
      Specified by:
      modelStopped in interface MilestoneListener
    • startStatistics

      protected void startStatistics()
      Start collecting statistics.
    • resetStatistics

      protected void resetStatistics()
      Reset statistics.
    • updateStatistics

      protected void updateStatistics(double time)
      Update statistics.
      Parameters:
      time - the current time
    • 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 CDLPQ
      Parameters:
      parser - the reference to parser that manages command line options
      See Also:
    • saveSnapshot

      public void saveSnapshot(int format)
      Save snapshot of current configuration.
      Parameters:
      format - the format of the snapshot
      See Also:
      • MVPop2D
    • openSnapshot

      protected File openSnapshot(String ext)
      Open file for exporting the snapshot.
      Parameters:
      ext - the file extension
      Returns:
      the file for the snapshot
    • main

      public static void main(String[] args)
      Main method to run the simulation.
      Parameters:
      args - the array of command line arguments