Class Discrete

All Implemented Interfaces:
Runnable, LifecycleListener, RunListener, Features, CLOProvider
Direct Known Subclasses:
CDL, Centipede, EcoPGG, LV, Moran, NetGames, Predator, RSP, SIR, TBT, Traits

public abstract class Discrete extends Module<Discrete>
Parent class of all EvoLudo modules with discrete sets of traits.
Author:
Christoph Hauert
  • Field Details

    • mutation

      protected Mutation.Discrete mutation
      The mutation operator for discrete traits.
    • monoStop

      protected boolean monoStop
      The flag to indicate whether models should stop once a monomorphic state has been reached.
    • cloMonoStop

      public final CLOption cloMonoStop
      Command line option to request that models stop execution when reaching monomorphic population states.
  • Constructor Details

    • Discrete

      protected Discrete(EvoLudo engine)
      Create new module with a discrete set of traits.
      Parameters:
      engine - the pacemaker for running the model
    • Discrete

      protected Discrete(Discrete partner)
      Create another module with a discrete set of traits. The additional module represents another species in multi-species modules that interact with species partner.
      Parameters:
      partner - the partner species
    • Discrete

      private Discrete(EvoLudo engine, Discrete partner)
      Create a new module with a discrete set of traits with pacemaker engine and interactions with module partner. If partner == null this is a single species module and interactions within species (opponent == this holds).
      Parameters:
      engine - the pacemaker for running the model
      partner - the partner species
  • Method Details

    • getMutation

      public Mutation.Discrete getMutation()
      Description copied from class: Module
      Gets the mutation type.
      Specified by:
      getMutation in class Module<Discrete>
      Returns:
      the mutation type
    • createModel

      public Model createModel(ModelType type)
      Description copied from class: Module
      Creates a model of type type for module.

      Note: Override to provide custom model implementations.

      Important: any custom model implementations that involve random numbers, must use the shared random number generator for reproducibility

      Overrides:
      createModel in class Module<Discrete>
      Parameters:
      type - the type of Model to create
      Returns:
      the model for module or null if the module does not support the requested model type
      See Also:
    • load

      public void load()
      Description copied from class: Module
      Load new module and perform basic initializations.
      Overrides:
      load in class Module<Discrete>
      See Also:
    • unload

      public void unload()
      Description copied from class: Module
      Unload module and free all resources.
      Overrides:
      unload in class Module<Discrete>
      See Also:
    • getMonoPayoff

      public double getMonoPayoff(int type)
      Calculate and return the payoff/score of individuals in monomorphic populations with trait type.

      Note: Optional implementation. Returns Double#NaN if not defined or not implemented.

      Parameters:
      type - the index of the trait
      Returns:
      payoff/score in monomorphic population with trait type
    • getMinMonoPayoff

      public double getMinMonoPayoff()
      Default implementation of Features.Payoffs.getMinMonoPayoff(). Only available to modules that implement the Features.Payoffs interface.
      Returns:
      the minimum payoff in monomorphic populations
    • getMaxMonoPayoff

      public double getMaxMonoPayoff()
      Default implementation of Features.Payoffs.getMaxMonoPayoff(). Only available to modules that implement the Features.Payoffs interface.
      Returns:
      the maximum payoff in monomorphic populations
    • setMonoStop

      public void setMonoStop(boolean monoStop)
      Set whether models should stop once a monomorphic state has been reached.
      Parameters:
      monoStop - the flag to indicate whether to stop
    • getMonoStop

      public boolean getMonoStop()
      Get the flag which indicates whether models stop once a monomorphic state has been reached.
      Returns:
      true if models stop when reaching homogeneous states.
    • 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 Module<Discrete>
      Parameters:
      parser - the reference to parser that manages command line options
      See Also: