Class simCDL
- All Implemented Interfaces:
Runnable
,ChangeListener
,IBS.HasIBS
,IBS.HasIBS.DGroups
,IBS.HasIBS.DPairs
,MilestoneListener
,ODE.HasDE
,ODE.HasODE
,PDE.HasPDE
,SDE.HasSDE
,Features
,Features.Groups
,Features.Pairs
,HasHistogram
,HasHistogram.Degree
,HasHistogram.Fitness
,HasHistogram.StatisticsStationary
,HasMean
,HasMean.Fitness
,HasMean.Strategy
,HasPop2D
,HasPop2D.Fitness
,HasPop2D.Strategy
,HasPop3D
,HasPop3D.Fitness
,HasPop3D.Strategy
,HasS3
,CLOProvider
- Author:
- Christoph Hauert
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
The simulation for the CDL module.Nested classes/interfaces inherited from class CDL
CDL.IBSPop
Nested classes/interfaces inherited from interface ChangeListener
ChangeListener.PendingAction
Nested classes/interfaces inherited from interface Features
Features.Groups, Features.Pairs, Features.Static
Nested classes/interfaces inherited from interface HasHistogram
HasHistogram.Degree, HasHistogram.Fitness, HasHistogram.StatisticsProbability, HasHistogram.StatisticsStationary, HasHistogram.StatisticsTime, HasHistogram.Strategy
Nested classes/interfaces inherited from interface HasMean
HasMean.Fitness, HasMean.Strategy
Nested classes/interfaces inherited from interface HasPop2D
HasPop2D.Fitness, HasPop2D.Strategy
Nested classes/interfaces inherited from interface HasPop3D
HasPop3D.Fitness, HasPop3D.Strategy
Nested classes/interfaces inherited from interface IBS.HasIBS
IBS.HasIBS.CGroups, IBS.HasIBS.CPairs, IBS.HasIBS.DGroups, IBS.HasIBS.DPairs, IBS.HasIBS.MCGroups, IBS.HasIBS.MCPairs
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CLOption
Command line option to set the number of samples for fixation probabilities.final CLOption
Command line option to set the number of steps for initial frequencies.final CLOption
Command line option to show the simulation progress.final CLOption
Command line option to set the range and increments for scanning non-linearities.(package private) int[]
The initial counts for the different strategies.(package private) double[]
Temporary variables for fixation probabilities and absorption times.(package private) double[]
Temporary variables for fixation probabilities and absorption times.(package private) double[]
Temporary variables for fixation probabilities and absorption times.(package private) int
The number of samples for fixation probabilities.(package private) int
The number of steps for initial frequencies.(package private) PrintStream
The output stream.(package private) double
Time of previous sample.(package private) boolean
The flag to indicate whether to show progress.(package private) double[]
The scan range for non-linearity in public goods games.(package private) double[]
Temporary variables for fixation probabilities and absorption times.(package private) double[]
Temporary variables for fixation probabilities and absorption times.Fields inherited from class CDL
cloCost, cloInterest, cloLoneCooperator, cloLoneDefector, cloLoner, cloOthers, cloSolo, COOPERATE, costCoop, DEFECT, doSolo, isLinearPGG, LONER, othersOnly, payLoneCoop, payLoneDefect, payLoner, r1, rN
Fields inherited from class Discrete
cloMonoStop, monoStop, mutation
Fields inherited from class Module
cloDeathRate, cloGeometry, cloNGroup, cloNPopulation, cloPhase2DAxis, cloSpeciesUpdateRate, cloTraitColors, cloTraitDisable, cloTraitNames, competition, deathRate, defaultColor, engine, interaction, logger, map2fitness, markers, model, nActive, name, nGroup, nPopulation, nTraits, playerUpdate, speciesUpdateRate, structure, traitColor, trajectoryColor, VACANT
Fields inherited from interface HasS3
CORNER_LEFT, CORNER_RIGHT, CORNER_TOP, EDGE_BOTTOM, EDGE_LEFT, EDGE_RIGHT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
check()
Check all parameters.void
collectCLO
(CLOParser parser) All providers of command line options must implement this method to collect their options.Opportunity to supply custom individual based simulations.static void
Main method to run the simulation.void
Called whenever the state of the EvoLudo model changed.void
Called after a running EvoLudo model stopped because the model converged (or reached an absorbing state).protected void
Reset statistics.void
run()
protected void
Start collecting statistics.protected void
updateStatistics
(double time) Update statistics.Methods inherited from class CDL
adjustCLO, avgScores, getAuthors, getCostCoop, getDependent, getInterest, getMaxGameScore, getMinGameScore, getMonoGameScore, getOthersOnly, getPayLoneCoop, getPayLoneDefect, getPayLoner, getSolo, getTitle, groupScores, interest, load, mixedScores, pairScores, setCostCoop, setInterest, setInterest, setOthersOnly, setPayLoneCoop, setPayLoneDefect, setPayLoner, setSolo, unload
Methods inherited from class Discrete
add, getMaxMonoGameScore, getMinMonoGameScore, getMonoStop, getMutation, setMonoStop
Methods inherited from class Module
createGeometry, getActiveTraits, getCompetitionGeometry, getDeathRate, getGeometry, getIBSPopulation, getID, getInteractionGeometry, getKey, getMapToFitness, getMarkers, getMeanColors, getModelTypes, getNActive, getName, getNGroup, getNPopulation, getNRoles, getNSpecies, getNTraits, getOpponent, getPlayerUpdate, getSpecies, getSpecies, getSpeciesUpdateRate, getTraitColor, getTraitColors, getTraitName, getTraitNames, getTrajectoryColor, getVacant, init, isNeutral, processColorMap, reset, 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 Features.Groups
getNGroup, isPairwise
Methods inherited from interface HasHistogram
getCustomLevels, getNTraits, getTraitColors
Methods inherited from interface IBS.HasIBS
createIBS
Methods inherited from interface IBS.HasIBS.DGroups
mixedScores
Methods inherited from interface MilestoneListener
modelDidInit, modelDidReset, modelLoaded, modelRelaxed, modelRunning, modelSettings, modelUnloaded, moduleLoaded, moduleRestored, moduleUnloaded
Methods inherited from interface ODE.HasODE
createODE
Methods inherited from interface PDE.HasPDE
createPDE
Methods inherited from interface SDE.HasSDE
createSDE
-
Field Details
-
progress
boolean progressThe flag to indicate whether to show progress. -
nSamples
int nSamplesThe number of samples for fixation probabilities. -
nSteps
int nStepsThe number of steps for initial frequencies. -
scanNL
double[] scanNLThe scan range for non-linearity in public goods games. -
out
PrintStream outThe output stream. Defaults toSystem.out
. -
initcount
int[] initcountThe initial counts for the different strategies. -
mean
double[] meanTemporary variables for fixation probabilities and absorption times. -
var
double[] varTemporary variables for fixation probabilities and absorption times. -
state
double[] stateTemporary variables for fixation probabilities and absorption times. -
meanmean
double[] meanmeanTemporary variables for fixation probabilities and absorption times. -
meanvar
double[] meanvarTemporary variables for fixation probabilities and absorption times. -
prevsample
double prevsampleTime of previous sample. -
cloNSamples
Command line option to set the number of samples for fixation probabilities. -
cloNSteps
Command line option to set the number of steps for initial frequencies. -
cloScanNL
Command line option to set the range and increments for scanning non-linearities. -
cloProgress
Command line option to show the simulation progress.
-
-
Constructor Details
-
simCDL
Create a new simulation to investigate the role of volunteering in public goods games.- Parameters:
engine
- the pacemaker for running the model
-
-
Method Details
-
run
public void run()Description copied from class:Module
Default run-loop for modules. Opportunity to override in subclasses for running customized simulations. Currently only called from
EvoLudoJRE.simulation()
if custom simulation class is specified injar
file. -
modelChanged
Description copied from interface:ChangeListener
Called whenever the state of the EvoLudo model changed. Process potentially pending requests.Note: the model may process some pending actions directly and without notifying the listeners through
modelChanged(PendingAction)
first. In particular, this applies to pending actions that fire their own notifications, such asRESET
andINIT
that in turn triggermodelReset()
andmodelInit()
, respectively.- Specified by:
modelChanged
in interfaceChangeListener
- Parameters:
action
- pending action that needs to be processed.- See Also:
-
modelStopped
public void modelStopped()Description copied from interface:MilestoneListener
Called after a running EvoLudo model stopped because the model converged (or reached an absorbing state).- Specified by:
modelStopped
in interfaceMilestoneListener
-
startStatistics
protected void startStatistics()Start collecting statistics. -
resetStatistics
protected void resetStatistics()Reset statistics. -
updateStatistics
protected void updateStatistics(double time) Update statistics.- Parameters:
time
- the current time
-
check
public boolean check()Description copied from class:Module
Check all parameters. After this call all parameters must be consistent. If parameter adjustments require a reset then this method must returntrue
.Note: All parameter changes that don't require a reset can be made on the fly, in particular also while a model is running.
-
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 classCDL
- Parameters:
parser
- the reference to parser that manages command line options- See Also:
-
createIBSPop
Description copied from class:Module
Opportunity to supply custom individual based simulations.- Overrides:
createIBSPop
in classCDL
- Returns:
- the custom IBSPopulation or
null
to use default.
-
main
Main method to run the simulation.- Parameters:
args
- the array of command line arguments
-