Class simCDL

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 simCDL extends CDL implements ChangeListener
Simulations to investigate the role of volunteering in public goods games.
Author:
Christoph Hauert
See Also:
  • "Hauert C., De Monte S., Hofbauer J., Sigmund K. (2002) <em>Volunteering as Red Queen Mechanism for Cooperation in Public Goods Games.</em> Science 296:1129-1132. doi: <a href= 'https://doi.org/10.1126/science.1070582'>10.1126/science.1070582</a>"
  • Field Details

    • progress

      boolean progress
      The flag to indicate whether to show progress.
    • nSamples

      int nSamples
      The number of samples for fixation probabilities.
    • nSteps

      int nSteps
      The number of steps for initial frequencies.
    • scanNL

      double[] scanNL
      The scan range for non-linearity in public goods games.
    • out

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

      int[] initcount
      The initial counts for the different strategies.
    • 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.
    • meanmean

      double[] meanmean
      Temporary variables for fixation probabilities and absorption times.
    • meanvar

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

      double prevsample
      Time of previous sample.
    • cloNSamples

      public final CLOption cloNSamples
      Command line option to set the number of samples for fixation probabilities.
    • cloNSteps

      public final CLOption cloNSteps
      Command line option to set the number of steps for initial frequencies.
    • cloScanNL

      public final CLOption cloScanNL
      Command line option to set the range and increments for scanning non-linearities.
    • cloProgress

      public final CLOption cloProgress
      Command line option to show the simulation progress.
  • Constructor Details

    • simCDL

      public simCDL(EvoLudo engine)
      Create a new simulation to investigate the role of volunteering in 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
    • check

      public boolean check()
      Description copied from class: Module
      Check all parameters. After this call all parameters must be consistent. If parameter adjustments require a reset then this method must return true.

      Note: All parameter changes that don't require a reset can be made on the fly, in particular also while a model is running.

      Overrides:
      check in class CDL
      Returns:
      true to trigger reset
      See Also:
    • 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 CDL
      Parameters:
      parser - the reference to parser that manages command line options
      See Also:
    • createIBSPop

      public CDL.IBSPop createIBSPop()
      Description copied from class: Module
      Opportunity to supply custom individual based simulations.
      Overrides:
      createIBSPop in class CDL
      Returns:
      the custom IBSPopulation or null to use default.
    • main

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