Package org.evoludo.simulator.modules
Class Discrete
- All Implemented Interfaces:
Runnable,MilestoneListener,Features,CLOProvider
- Direct Known Subclasses:
CDL,Centipede,EcoPGG,LV,Moran,NetGames,Predator,RSP,SIR,TBT,Traits
Parent class of all EvoLudo modules with discrete sets of traits.
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested classes/interfaces inherited from interface Features
Features.Groups, Features.Multispecies, Features.Pairs, Features.Payoffs, Features.Static -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CLOptionCommand line option to request that models stop execution when reaching monomorphic population states.protected booleanThe flag to indicate whether models should stop once a monomorphic state has been reached.protected Mutation.DiscreteThe mutation operator for discrete traits.The listspeciescontains references to each species in this module.Fields inherited from class Module
active, cloDeathRate, cloGeometry, cloNGroup, cloNPopulation, cloPhase2DAxes, cloTraitColors, cloTraitDisable, cloTraitNames, competition, deathRate, defaultColor, engine, ibs, ID, interaction, logger, map2fitness, markers, model, nActive, name, nGroup, nPopulation, nTraits, opponent, playerUpdate, structure, traitColor, traitName, trajectoryColor, VACANT -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate new module with a discrete set of traits.privateCreate a new module with a discrete set of traits with pacemakerengineand interactions with modulepartner.Create another module with a discrete set of traits. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdddpopto list of species.voidcollectCLO(CLOParser parser) All providers of command line options must implement this method to collect their options.doubleDefault implementation ofFeatures.Payoffs.getMaxMonoPayoff().doubleDefault implementation ofFeatures.Payoffs.getMinMonoPayoff().doublegetMonoPayoff(int type) Calculate and return the payoff/score of individuals in monomorphic populations with traittype.booleanGet the flag which indicates whether models stop once a monomorphic state has been reached.Gets the mutation type.voidload()Load new module and perform basic initializations.voidsetMonoStop(boolean monoStop) Set whether models should stop once a monomorphic state has been reached.voidunload()Unload module and free all resources.Methods inherited from class Module
check, createGeometry, createIBSPop, createModel, getActiveTraits, getAuthors, getCompetitionGeometry, getDeathRate, getGeometry, getIBSPopulation, getID, getInteractionGeometry, getKey, getMap2Fitness, getMarkers, getMeanColors, getModelTypes, getNActive, getName, getNGroup, getNPopulation, getNRoles, getNSpecies, getNTraits, getOpponent, getPlayerUpdate, getSpecies, getSpecies, getTraitColor, getTraitColors, getTraitName, getTraitNames, getTrajectoryColor, getVacant, init, processColorMap, reset, run, setActiveTraits, setDeathRate, setGeometries, setIBSPopulation, setModel, setName, setNGroup, setNPopulation, 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
getTitle, isMultispecies, isPairwise, isStaticMethods inherited from interface MilestoneListener
modelDidInit, modelDidReset, modelLoaded, modelRelaxed, modelRunning, modelSettings, modelStopped, modelUnloaded, moduleLoaded, moduleRestored, moduleUnloaded
-
Field Details
-
species
The listspeciescontains references to each species in this module. It deliberately shadowsModule.speciesto simplify bookkeeping. During instantiationModule.speciesandspeciesare linked to represent one and the same list.- See Also:
-
mutation
The mutation operator for discrete traits. -
monoStop
protected boolean monoStopThe flag to indicate whether models should stop once a monomorphic state has been reached. -
cloMonoStop
Command line option to request that models stop execution when reaching monomorphic population states.
-
-
Constructor Details
-
Discrete
Create new module with a discrete set of traits.- Parameters:
engine- the pacemaker for running the model
-
Discrete
Create another module with a discrete set of traits. The additional module represents another species in multi-species modules that interact with speciespartner.- Parameters:
partner- the partner species
-
Discrete
Create a new module with a discrete set of traits with pacemakerengineand interactions with modulepartner. Ifpartner == nullthis is a single species module and interactions within species (opponent == thisholds).- Parameters:
engine- the pacemaker for running the modelpartner- the partner species
-
-
Method Details
-
getMutation
Description copied from class:ModuleGets the mutation type.- Specified by:
getMutationin classModule- Returns:
- the mutation type
-
add
Adddpopto 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:
trueifdpopsuccessfully added;falseadding failed or already included in list.
-
load
public void load()Description copied from class:ModuleLoad new module and perform basic initializations. -
unload
public void unload()Description copied from class:ModuleUnload module and free all resources. -
getMonoPayoff
public double getMonoPayoff(int type) Calculate and return the payoff/score of individuals in monomorphic populations with traittype.Note: Optional implementation. Returns
Double#NaNif 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 ofFeatures.Payoffs.getMinMonoPayoff(). Only available to modules that implement theFeatures.Payoffsinterface.- Returns:
- the minimum payoff in monomorphic populations
-
getMaxMonoPayoff
public double getMaxMonoPayoff()Default implementation ofFeatures.Payoffs.getMaxMonoPayoff(). Only available to modules that implement theFeatures.Payoffsinterface.- 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:
trueif models stop when reaching homogeneous states.
-
collectCLO
Description copied from interface:CLOProviderAll 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, theparserissues a warning and ignores the option. Thus, in general, implementing subclasses should first register their options and callsuper.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:
collectCLOin interfaceCLOProvider- Overrides:
collectCLOin classModule- Parameters:
parser- the reference to parser that manages command line options- See Also:
-