Class LV

All Implemented Interfaces:
Runnable, LifecycleListener, Model.HasDE, Model.HasDE.DualDynamics, Model.HasDE.ODE, Model.HasDE.SDE, Model.HasIBS, RunListener, Features, HasMean, HasMean.Traits, HasPhase2D, HasPop2D, HasPop2D.Traits, HasPop3D, HasPop3D.Traits, CLOProvider

Lotka-Volterra module for EvoLudo. This module implements the classic Lotka-Volterra equations for predator-prey dynamics. It supports both deterministic and stochastic simulations, as well as individual-based simulations (IBS).
Author:
Christoph Hauert
  • Field Details

    • predator

      Predator predator
      The reference to the predator species.
    • PREY

      static final int PREY
      The index of the prey.
      See Also:
    • VACANT

      static final int VACANT
      The index of vacant sites. Both species use the same index.
      See Also:
    • rates

      double[] rates
      The reaction rates for prey reproduction, predation, and competition.
  • Constructor Details

    • LV

      public LV(EvoLudo engine)
      Create a new instance of the Lotka-Volterra module.
      Parameters:
      engine - the pacemaker for running the module
  • Method Details

    • getTitle

      public String getTitle()
      Description copied from interface: Features
      Returns title of active module, e.g. 2x2 games in TBT returns "2x2 Games".
      Specified by:
      getTitle in interface Features
      Returns:
      the title of active module
    • getAuthors

      public String getAuthors()
      Description copied from class: Module
      Returns a string with information about the authors of the module.
      Overrides:
      getAuthors in class Module<Discrete>
      Returns:
      the names of the authors
    • load

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

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

      public int getDependent()
      Description copied from interface: Model.HasDE
      For replicator dynamics the frequencies of all traits must sum up to one. Hence, for nTraits traits there are only nTraits-1 degrees of freedom. The index returned by getDependent() marks the one rate of change that is derived from all the others.

      Notes:

      • Dependent traits are used by models where the frequencies of all types must sum up to one.
      • Density modules do not have dependent traits and getDependent() should return -1.
      • Currently differential equations implementations are only provided for Discrete modules.
      Specified by:
      getDependent in interface Model.HasDE
      Returns:
      the index of the dependent trait (or -1 if there is none)
    • setPhase2DMap

      public void setPhase2DMap(HasPhase2D.Data2Phase map)
      Description copied from interface: HasPhase2D
      Set the map that transforms the data of the module to a 2D phase plane (projection) to map. This provides an opportunity for implementing classes to change settings of the map.
      Specified by:
      setPhase2DMap in interface HasPhase2D
      Parameters:
      map - the map
    • 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 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:
    • createIBSPopulation

      public IBSPop createIBSPopulation()
      Description copied from class: Module
      Opportunity to supply custom individual based simulations.
      Overrides:
      createIBSPopulation in class Module<Discrete>
      Returns:
      the custom IBSPopulation or null to use default.