Class simTBT

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

public class simTBT extends TBT implements ChangeListener
Simulation of the two player, two trait model.
Author:
Christoph Hauert
See Also:
  • "Ohtsuki, H., Hauert, C., Lieberman, E., & Nowak, M. A. (2006). <em>A simple rule for the evolution of cooperation on graphs and social networks.</em> Nature, 441(7092), 502-505. <a href='http://dx.doi.org/10.1038/nature04605'>doi: 10.1038/nature04605</a>"
  • Field Details

    • progress

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

      int nRuns
      The number of runs.
    • scanST

      double[] scanST
      The scan parameters for the S-T-plane.
    • scanDG

      double[] scanDG
      The scan parameters for the donation game.
    • ibs

      IBS ibs
      The two player, two trait model.
    • snapinterval

      long snapinterval
      The interval for saving snapshots.
    • snapprefix

      String snapprefix
      The prefix for snapshot filenames.
    • 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.
    • 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.
    • cloProgress

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

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

      public final CLOption cloSnapPrefix
      Command line option to set the prefix for snapshot filenames.
    • cloRuns

      public final CLOption cloRuns
      Command line option to set the number of runs.
    • cloScanST

      public final CLOption cloScanST
      Command line option to scan the S-T-plane.
    • cloScanDG

      public final CLOption cloScanDG
      Command line option to scan the donation game.
  • Constructor Details

    • simTBT

      public simTBT(EvoLudo engine)
      Create a new simulation to investigate the two player, two trait model.
      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 pending)
      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:
      pending - 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
    • 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 TBT
      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