Class simCDLP
- All Implemented Interfaces:
Runnable,ChangeListener,IBS.HasIBS,IBS.HasIBS.DGroups,IBS.HasIBS.DPairs,MilestoneListener,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,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 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 IBS.HasIBS
IBS.HasIBS.CGroups, IBS.HasIBS.CPairs, IBS.HasIBS.DGroups, IBS.HasIBS.DPairs, IBS.HasIBS.MCGroups, IBS.HasIBS.MCPairsNested 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.SDE -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CLOptionCommand line option to determine the basin of attraction of punishers and cooperators.final CLOptionCommand line option to generate a histogram of states visited.final CLOptionCommand line option to set the threshold for corner states.final CLOptionCommand line option to determine the time to reach the threshold of punishers.private booleanGenerate the basins of attraction.(package private) booleanGenerate a histogram of states visited.private booleanThe flag to indicate whether the initial configuration is given by the interior fixed pointQ(for CDL only).(package private) double[]Temporary variables for fixation probabilities and absorption times.(package private) PrintStreamThe output stream.(package private) doubleTime of previous sample.(package private) double[]Temporary variables for fixation probabilities and absorption times.(package private) intThe threshold for qualifying as a corner state.(package private) longThe time to reach the punisher corner.(package private) double[]Temporary variables for fixation probabilities and absorption times.Fields inherited from class CDLP
cloCostPunish, cloLeniencyCooperators, cloLeniencyLoners, cloPunishment, PUNISHFields 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, competition, deathRate, defaultColor, engine, interaction, logger, map2fitness, markers, model, nActive, name, nGroup, nPopulation, nTraits, playerUpdate, structure, traitColor, trajectoryColor, VACANTFields 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.private double[]findQ(int n, double r, double sigma) Find the interior fixed pointQfor the CDL model.private doublefunc(double z, int n, double r) The function \(F(z)\) for the interior fixed point \(Q\).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()private doublesign(double x) The sign function.protected voidStart collecting statistics.protected voidupdateStatistics(double time) Update statistics.Methods inherited from class CDLP
avgScores, createIBSPop, getAuthors, getLeniencyCoop, getLeniencyLoner, getMinPayoff, getMonoPayoff, getPunishCost, getPunishFine, getTitle, groupScores, load, mixedScores, pairScores, setLeniencyCoop, setLeniencyLoner, setPunishCost, setPunishFineMethods inherited from class CDL
adjustCLO, check, getCostCoop, getDependent, getInterest, getMaxPayoff, getOthersOnly, getPayLoneCoop, getPayLoneDefect, getPayLoner, getSolo, interest, setCostCoop, setInterest, setInterest, setOthersOnly, setPayLoneCoop, setPayLoneDefect, setPayLoner, setSolo, unloadMethods inherited from class Discrete
add, getMaxMonoPayoff, getMinMonoPayoff, getMonoStop, getMutation, setMonoStopMethods inherited from class Module
createGeometry, createModel, getActiveTraits, 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, 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 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 IBS.HasIBS
createIBSMethods inherited from interface IBS.HasIBS.DGroups
mixedScoresMethods inherited from interface MilestoneListener
modelDidInit, modelDidReset, modelLoaded, modelRelaxed, modelRunning, modelSettings, modelUnloaded, moduleLoaded, moduleRestored, moduleUnloaded
-
Field Details
-
threshold
int thresholdThe threshold for qualifying as a corner state. -
timesamples
long timesamplesThe time to reach the punisher corner. -
doLocation
boolean doLocationGenerate a histogram of states visited. -
doBasin
private boolean doBasinGenerate the basins of attraction. -
initInQ
private boolean initInQThe flag to indicate whether the initial configuration is given by the interior fixed pointQ(for CDL only). -
out
PrintStream outThe output stream. Defaults toSystem.out. -
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. -
prevsample
double prevsampleTime of previous sample. -
cloThreshold
Command line option to set the threshold for corner states. -
cloBasin
Command line option to determine the basin of attraction of punishers and cooperators. -
cloTime2Punish
Command line option to determine the time to reach the threshold of punishers. -
cloHistogram
Command line option to generate a histogram of states visited.
-
-
Constructor Details
-
simCDLP
Create a new simulation to investigate the role of punishment in voluntary 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:MilestoneListenerCalled after a running EvoLudo model stopped because the model converged (or reached an absorbing state).- Specified by:
modelStoppedin 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
-
findQ
private double[] findQ(int n, double r, double sigma) Find the interior fixed pointQfor the CDL model.- Parameters:
n- the maximum size of the interaction groupr- the multiplication factor of the public goodsigma- the payoff for loners- Returns:
- the interior fixed point
Q
-
func
private double func(double z, int n, double r) The function \(F(z)\) for the interior fixed point \(Q\).- Parameters:
z- the fraction of lonersn- the maximum size of the interaction groupr- the multiplication factor of the public good- Returns:
- the value of \(F(z)\)
-
sign
private double sign(double x) The sign function. Returns 1.0 for positive values, 0.0 for negative values, and 0.5 for zero.- Parameters:
x- the value- Returns:
- the sign of the value
-
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 classCDLP- Parameters:
parser- the reference to parser that manages command line options- See Also:
-
main
Main method to run the simulation.- Parameters:
args- the array of command line arguments
-