Class simCDL
- All Implemented Interfaces:
Runnable, ChangeListener, LifecycleListener, Model.HasDE, Model.HasDE.DGroups, Model.HasDE.EM, Model.HasDE.ODE, Model.HasDE.PDE, Model.HasDE.PDEADV, Model.HasDE.PDERD, Model.HasDE.RK5, Model.HasDE.SDE, Model.HasIBS, Model.HasIBS.DGroups, Model.HasIBS.DPairs, RunListener, Features, Features.Groups, Features.Pairs, Features.Payoffs, HasHistogram, HasHistogram.Degree, HasHistogram.Fitness, HasHistogram.StatisticsStationary, HasMean, HasMean.Fitness, HasMean.Traits, HasPop2D, HasPop2D.Fitness, HasPop2D.Traits, HasPop3D, HasPop3D.Fitness, HasPop3D.Traits, HasS3, CLOProvider
- Author:
- Christoph Hauert
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classThe simulation for the CDL module.Nested classes/interfaces inherited from class CDL
CDL.IBSPopNested classes/interfaces inherited from interface ChangeListener
ChangeListener.PendingActionNested classes/interfaces inherited from interface Features
Features.Groups, Features.Multispecies, Features.Pairs, Features.Payoffs, Features.StaticNested classes/interfaces inherited from interface HasHistogram
HasHistogram.Degree, HasHistogram.Fitness, HasHistogram.StatisticsProbability, HasHistogram.StatisticsStationary, HasHistogram.StatisticsTime, HasHistogram.StrategyNested classes/interfaces inherited from interface HasMean
HasMean.Fitness, HasMean.TraitsNested 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.ODE, Model.HasDE.PDE, Model.HasDE.PDEADV, Model.HasDE.PDERD, Model.HasDE.RK5, Model.HasDE.SDENested 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 TypeFieldDescriptionfinal CLOptionCommand line option to set the number of steps for initial frequencies.final CLOptionCommand line option to show the simulation progress.final CLOptionCommand line option to set the range and increments for scanning non-linearities.(package private) int[]The initial counts for the different traits.(package private) double[]Temporary running mean for fixation probabilities.(package private) double[]Mean of recorded means (used for statistics).(package private) double[]Variance of recorded means.(package private) intThe number of steps for initial frequencies.(package private) PrintStreamThe output stream.(package private) doubleTime of previous sample.(package private) booleanThe flag to indicate whether to show progress.(package private) double[]The scan range for non-linearity in public goods games.(package private) double[]Temporary state buffer for sampling.(package private) double[]Temporary running variance for fixation probabilities.Fields inherited from class CDL
cloCost, cloInterest, cloLoneCooperator, cloLoneDefector, cloLoner, cloOthers, cloSolo, COOPERATE, costCoop, DEFECT, doSolo, isLinearPGG, LONER, othersOnly, payLoneCoop, payLoneDefect, payLoner, r1, rNFields inherited from class Discrete
cloMonoStop, monoStop, mutationFields inherited from class Module
cloDeathRate, cloGeometry, cloNGroup, cloNPopulation, cloPhase2DAxes, cloTraitColors, cloTraitDisable, cloTraitNames, deathRate, defaultColor, engine, logger, map2fitness, markers, model, nActive, name, nGroup, nPopulation, nTraits, playerUpdate, structure, traitColor, trajectoryColor, VACANT_COLOR, VACANT_NAME, vacantIdxFields inherited from interface HasS3
CORNER_LEFT, CORNER_RIGHT, CORNER_TOP, EDGE_BOTTOM, EDGE_LEFT, EDGE_RIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectCLO(CLOParser parser) All providers of command line options must implement this method to collect their options.Opportunity to supply custom individual based simulations.static voidMain method to run the simulation.voidCalled whenever the state of the EvoLudo model changed.voidCalled after a running EvoLudo model stopped because the model converged (or reached an absorbing state).protected voidReset statistics.voidrun()protected voidStart collecting statistics.protected voidupdateStatistics(double time) Update statistics.Methods inherited from class CDL
adjustCLO, avgScores, check, getAuthors, getCostCoop, getDependent, getInterest, getMaxPayoff, getMinPayoff, getMonoPayoff, getOthersOnly, getPayLoneCoop, getPayLoneDefect, getPayLoner, getSolo, getTitle, groupScores, interest, load, mixedScores, pairScores, setCostCoop, setInterest, setInterest, setOthersOnly, setPayLoneCoop, setPayLoneDefect, setPayLoner, setSolo, unloadMethods inherited from class Discrete
createModel, getMaxMonoPayoff, getMinMonoPayoff, getMonoStop, getMutation, setMonoStopMethods inherited from class Module
add, getActiveTraits, 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, 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 Features
isMultispecies, isStaticMethods inherited from interface Features.Groups
getNGroup, isPairwiseMethods inherited from interface Features.Payoffs
getMap2Fitness, getMaxMonoPayoff, getMinMonoPayoff, isNeutralMethods inherited from interface HasHistogram
getCustomLevels, getNTraits, getTraitColorsMethods inherited from interface LifecycleListener
modelLoaded, modelUnloaded, moduleLoaded, moduleRestored, moduleUnloadedMethods inherited from interface Model.HasIBS
createIBSMethods inherited from interface Model.HasIBS.DGroups
mixedScoresMethods inherited from interface RunListener
modelDidInit, modelDidReset, modelRelaxed, modelRunning, modelSettings
-
Field Details
-
progress
boolean progressThe flag to indicate whether to show progress. -
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 traits. -
mean
double[] meanTemporary running mean for fixation probabilities. -
variance
double[] varianceTemporary running variance for fixation probabilities. -
state
double[] stateTemporary state buffer for sampling. -
meanmean
double[] meanmeanMean of recorded means (used for statistics). -
meanvar
double[] meanvarVariance of recorded means. -
prevsample
double prevsampleTime of previous sample. -
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:ModuleDefault 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 injarfile. -
modelChanged
Description copied from interface:ChangeListenerCalled 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 asRESETandINITthat in turn triggermodelReset()andmodelInit(), respectively.- Specified by:
modelChangedin interfaceChangeListener- Parameters:
action- pending action that needs to be processed.- See Also:
-
modelStopped
public void modelStopped()Description copied from interface:RunListenerCalled after a running EvoLudo model stopped because the model converged (or reached an absorbing state).- Specified by:
modelStoppedin interfaceRunListener
-
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
-
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 classCDL- Parameters:
parser- the reference to parser that manages command line options- See Also:
-
createIBSPopulation
Description copied from class:ModuleOpportunity to supply custom individual based simulations.- Overrides:
createIBSPopulationin classCDL- Returns:
- the custom IBSPopulation or
nullto use default.
-
main
Main method to run the simulation.- Parameters:
args- the array of command line arguments
-