Class Discrete
- All Implemented Interfaces:
Runnable, LifecycleListener, RunListener, Features, CLOProvider
- Direct Known Subclasses:
CDL, Centipede, EcoPGG, LV, Moran, NetGames, Predator, RSP, SIR, TBT, Traits
-
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.Fields inherited from class Module
active, cloDeathRate, cloGeometry, cloNGroup, cloNPopulation, cloPhase2DAxes, cloTraitColors, cloTraitDisable, cloTraitNames, deathRate, defaultColor, engine, ibspop, ID, logger, map2fitness, markers, model, nActive, name, nGroup, nPopulation, nTraits, opponent, playerUpdate, species, structure, traitColor, traitName, trajectoryColor, VACANT_COLOR, VACANT_NAME, vacantIdx -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate new module with a discrete set of traits.privateCreate a new module with a discrete set of traits with pacemakerengineand interactions with modulepartner.protectedCreate another module with a discrete set of traits. -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectCLO(CLOParser parser) All providers of command line options must implement this method to collect their options.createModel(ModelType type) Creates a model of typetypeformodule.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
add, check, createIBSPopulation, getActiveTraits, getAuthors, getDeathRate, getGeometry, getIBSPopulation, getID, getKey, getMap2Fitness, getMarkers, getMeanColors, getModelTypes, getNActive, getName, getNGroup, getNPopulation, getNRoles, getNSpecies, getNTraits, getOpponent, getPlayerUpdate, getSpecies, getSpecies, getTraitColor, getTraitColors, getTraitName, getTraitNames, getTrajectoryColor, getVacantIdx, hasVacant, init, processColorMap, reset, run, setActiveTraits, 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
getTitle, isMultispecies, isPairwise, isStaticMethods inherited from interface LifecycleListener
modelLoaded, modelUnloaded, moduleLoaded, moduleRestored, moduleUnloadedMethods inherited from interface RunListener
modelDidInit, modelDidReset, modelRelaxed, modelRunning, modelSettings, modelStopped
-
Field Details
-
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<Discrete>- Returns:
- the mutation type
-
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 classModule<Discrete>- Parameters:
type- the type ofModelto create- Returns:
- the model for
moduleornullif the module does not support the requested model type - See Also:
-
load
-
unload
-
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<Discrete>- Parameters:
parser- the reference to parser that manages command line options- See Also:
-