Package org.evoludo.simulator.modules
Class Discrete
- All Implemented Interfaces:
Runnable
,MilestoneListener
,Features
,CLOProvider
Parent class of all EvoLudo modules with discrete strategy sets.
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested classes/interfaces inherited from interface Features
Features.Groups, Features.Pairs, Features.Static
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CLOption
Command line option to request that models stop execution when reaching monomorphic population states.protected boolean
The flag to indicate whether models should stop once a monomorphic state has been reached.protected Mutation.Discrete
The mutation operator for discrete traits.The listspecies
contains references to each species in this module.Fields inherited from class Module
active, cloDeathRate, cloGeometry, cloNGroup, cloNPopulation, cloPhase2DAxis, cloSpeciesUpdateRate, cloTraitColors, cloTraitDisable, cloTraitNames, competition, deathRate, defaultColor, engine, ibs, ID, interaction, logger, map2fitness, markers, model, nActive, name, nGroup, nPopulation, nTraits, opponent, playerUpdate, speciesUpdateRate, structure, traitColor, traitName, trajectoryColor, VACANT
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Create new module with a discrete set of strategies.private
Create a new module with a discrete set of strategies with pacemakerengine
and interactions with modulepartner
.protected
Create another module with a discrete set of strategies. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adddpop
to list of species.void
collectCLO
(CLOParser parser) All providers of command line options must implement this method to collect their options.double
Calculates and returns the maximum payoff/score of individuals in monomorphic populations.double
Calculates and returns the minimum payoff/score of individuals in monomorphic populations.double
getMonoGameScore
(int type) Calculate and return the payoff/score of individuals in monomorphic populations with trait/strategytype
.boolean
Get the flag which indicates whether models stop once a monomorphic state has been reached.Gets the mutation type.void
load()
Load new module and perform basic initializations.void
setMonoStop
(boolean monoStop) Set whether models should stop once a monomorphic state has been reached.void
unload()
Unload module and free all resources.Methods inherited from class Module
check, createGeometry, createIBSPop, getActiveTraits, getAuthors, getCompetitionGeometry, getDeathRate, getDependent, getGeometry, getIBSPopulation, getID, getInteractionGeometry, getKey, getMapToFitness, getMarkers, getMaxGameScore, getMeanColors, getMinGameScore, getModelTypes, getNActive, getName, getNGroup, getNPopulation, getNRoles, getNSpecies, getNTraits, getOpponent, getPlayerUpdate, getSpecies, getSpecies, getSpeciesUpdateRate, getTitle, getTraitColor, getTraitColors, getTraitName, getTraitNames, getTrajectoryColor, getVacant, init, isNeutral, processColorMap, reset, run, setActiveTraits, setDeathRate, setGeometries, setIBSPopulation, setModel, setName, setNGroup, setNPopulation, setNTraits, setOpponent, setSpeciesUpdateRate, setTraitColors, setTraitNames, setTrajectoryColor
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface CLOProvider
adjustCLO
Methods inherited from interface Features
isPairwise, isStatic
Methods inherited from interface MilestoneListener
modelDidInit, modelDidReset, modelLoaded, modelRelaxed, modelRunning, modelSettings, modelStopped, modelUnloaded, moduleLoaded, moduleRestored, moduleUnloaded
-
Field Details
-
species
The listspecies
contains references to each species in this module. It deliberately shadowsModule.species
to simplify bookkeeping. During instantiationModule.species
andspecies
are 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 strategies.- Parameters:
engine
- the pacemaker for running the model
-
Discrete
Create another module with a discrete set of strategies. 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 strategies with pacemakerengine
and interactions with modulepartner
. Ifpartner == null
this is a single species module and interactions within species (opponent == this
holds).- Parameters:
engine
- the pacemaker for running the modelpartner
- the partner species
-
-
Method Details
-
getMutation
Description copied from class:Module
Gets the mutation type.- Specified by:
getMutation
in classModule
- Returns:
- the mutation type
-
add
Adddpop
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
ifdpop
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. -
unload
public void unload()Description copied from class:Module
Unload module and free all resources. -
getMonoGameScore
public double getMonoGameScore(int type) Calculate and return the payoff/score of individuals in monomorphic populations with trait/strategytype
.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 classModule
- 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 classModule
- 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
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, theparser
issues 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:
collectCLO
in interfaceCLOProvider
- Overrides:
collectCLO
in classModule
- Parameters:
parser
- the reference to parser that manages command line options- See Also:
-