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
public class LV
extends Discrete
implements Model.HasDE.ODE, Model.HasDE.SDE, Model.HasDE.DualDynamics, Model.HasIBS, HasPop2D.Traits, HasPop3D.Traits, HasMean.Traits, HasPhase2D
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassODE model for the Lotka-Volterra module.classSDE model for the LV module.Nested classes/interfaces inherited from interface Features
Features.Groups, Features.Multispecies, Features.Pairs, Features.Payoffs, Features.StaticNested classes/interfaces inherited from interface HasMean
HasMean.Fitness, HasMean.TraitsNested classes/interfaces inherited from interface HasPhase2D
HasPhase2D.Data2PhaseNested classes/interfaces inherited from interface HasPop2D
HasPop2D.Fitness, HasPop2D.TraitsNested classes/interfaces inherited from interface HasPop3D
HasPop3D.Fitness, HasPop3D.TraitsNested classes/interfaces inherited from interface Model.HasDE
Model.HasDE.DGroups, Model.HasDE.DPairs, Model.HasDE.DualDynamics, Model.HasDE.EM, Model.HasDE.PDE, Model.HasDE.PDEADV, Model.HasDE.PDERD, Model.HasDE.RK5Nested classes/interfaces inherited from interface Model.HasIBS
Model.HasIBS.CGroups, Model.HasIBS.CPairs, Model.HasIBS.DGroups, Model.HasIBS.DPairs, Model.HasIBS.MCGroups, Model.HasIBS.MCPairs -
Field Summary
FieldsModifier and TypeFieldDescription(package private) PredatorThe reference to the predator species.(package private) static final intThe index of the prey.(package private) double[]The reaction rates for prey reproduction, predation, and competition.(package private) static final intThe index of vacant sites.Fields inherited from class Discrete
cloMonoStop, monoStop, mutationFields inherited from class Module
active, birthRate, cloBirthRate, cloCompRate, cloDeathRate, cloGeometry, cloModel, cloNGroup, cloNPopulation, cloPhase2DAxes, cloTraitColors, cloTraitDisable, cloTraitNames, competitionRate, competitionRates, deathRate, defaultColor, engine, ibspop, id, logger, map2fitness, model, nActive, name, nGroup, nPopulation, nTraits, opponent, playerUpdate, species, structure, traitColor, traitName, trajectoryColor, VACANT_COLOR, VACANT_NAME, vacantIdx -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOpportunity to supply custom individual based simulations.createModel(ModelType type) Creates a model of typetypeformodule.Returns a string with information about the authors of the module.intFor replicator dynamics the frequencies of all traits must sum up to one.getTitle()Returns title of active module, e.g.voidload()Load new module and perform basic initializations.voidSet the map that transforms the data of the module to a 2D phase plane (projection) tomap.voidunload()Unload module and free all resources.Methods inherited from class Discrete
collectCLO, getMaxMonoPayoff, getMinMonoPayoff, getMonoPayoff, getMonoStop, getMutation, setMonoStopMethods inherited from class Module
add, check, getActiveTraits, getBirthRate, getCompetitionRate, getCompetitionRates, getDeathRate, getGeometry, getIBSPopulation, getId, getKey, getMap2Fitness, getMeanColors, getModelType, getModelTypes, getNActive, getName, getNGroup, getNPopulation, getNRoles, getNSpecies, getNTraits, getOpponent, getPlayerUpdate, getSpecies, getSpecies, getTraitColor, getTraitColors, getTraitName, getTraitNames, getTrajectoryColor, getVacantIdx, hasVacant, init, preprocessModelOption, processColorMap, reset, run, setActiveTraits, setBirthRate, setCompetitionRates, setDeathRate, setIBSPopulation, setModel, setName, setNGroup, setNPopulation, setNTraits, setNTraits, setOpponent, setTraitColors, setTraitNames, setTrajectoryColorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CLOProvider
adjustCLOMethods inherited from interface Features
isMultispecies, isPairwise, isStaticMethods inherited from interface HasPhase2D
getPhase2DMapMethods inherited from interface LifecycleListener
modelLoaded, modelUnloaded, moduleLoaded, moduleRestored, moduleUnloadedMethods inherited from interface Model.HasIBS
createIBSMethods inherited from interface RunListener
modelDidInit, modelDidReset, modelRelaxed, modelRunning, modelSettings, modelStopped
-
Field Details
-
predator
Predator predatorThe reference to the predator species. -
PREY
static final int PREYThe index of the prey.- See Also:
-
VACANT
static final int VACANTThe index of vacant sites. Both species use the same index.- See Also:
-
rates
double[] ratesThe reaction rates for prey reproduction, predation, and competition.
-
-
Constructor Details
-
LV
Create a new instance of the Lotka-Volterra module.- Parameters:
engine- the pacemaker for running the module
-
-
Method Details
-
getTitle
-
getAuthors
Description copied from class:ModuleReturns a string with information about the authors of the module.- Overrides:
getAuthorsin classModule<Discrete>- Returns:
- the names of the authors
-
load
-
unload
-
getDependent
public int getDependent()Description copied from interface:Model.HasDEFor replicator dynamics the frequencies of all traits must sum up to one. Hence, fornTraitstraits there are onlynTraits-1degrees of freedom. The index returned bygetDependent()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:
getDependentin interfaceModel.HasDE- Returns:
- the index of the dependent trait (or
-1if there is none)
-
setPhase2DMap
Description copied from interface:HasPhase2DSet the map that transforms the data of the module to a 2D phase plane (projection) tomap. This provides an opportunity for implementing classes to change settings of the map.- Specified by:
setPhase2DMapin interfaceHasPhase2D- Parameters:
map- the map
-
createModel
Description copied from class:ModuleCreates a model of typetypeformodule.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:
createModelin classDiscrete- Parameters:
type- the type ofModelto create- Returns:
- the model for
moduleornullif the module does not support the requested model type - See Also:
-
createIBSPopulation
Description copied from class:ModuleOpportunity to supply custom individual based simulations.- Overrides:
createIBSPopulationin classModule<Discrete>- Returns:
- the custom IBSPopulation or
nullto use default.
-