Class Discrete

Object
Module
Discrete
All Implemented Interfaces:
Runnable, MilestoneListener, Features, CLOProvider
Direct Known Subclasses:
CDL, Centipede, EcoPGG, Moran, NetGames, RSP, TBT, Traits

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

    • species

      The list species contains references to each species in this module. It deliberately shadows Module.species to simplify bookkeeping. During instantiation Module.species and species are linked to represent one and the same list.
      See Also:
    • 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 strategies.
      Parameters:
      engine - the pacemaker for running the model
    • Discrete

      protected Discrete(Discrete partner)
      Create another module with a discrete set of strategies. 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 strategies 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
      Returns:
      the mutation type
    • add

      public boolean add(Discrete dpop)
      Add dpop to list of species. Duplicate entries are ignored. Allocate new list if necessary. Assign generic name to species if none provided.
      Parameters:
      dpop - the module to add to species list.
      Returns:
      true if dpop successfully added; false adding failed or already included in list.
    • load

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

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

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

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

      Parameters:
      type - trait/strategy
      Returns:
      payoff/score in monomorphic population with trait/strategy type
    • getMinMonoGameScore

      public double getMinMonoGameScore()
      Description copied from class: Module
      Calculates and returns the minimum payoff/score of individuals in monomorphic populations.
      Specified by:
      getMinMonoGameScore in class Module
      Returns:
      the minimum payoff/score in monomorphic populations
    • getMaxMonoGameScore

      public double getMaxMonoGameScore()
      Description copied from class: Module
      Calculates and returns the maximum payoff/score of individuals in monomorphic populations.
      Specified by:
      getMaxMonoGameScore in class Module
      Returns:
      the maximum payoff/score 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
      Parameters:
      parser - the reference to parser that manages command line options
      See Also: