Package org.evoludo.simulator.modules
Class NetGames
- All Implemented Interfaces:
Runnable
,IBS.HasIBS
,MilestoneListener
,Features
,HasHistogram
,HasHistogram.Degree
,HasHistogram.Fitness
,HasHistogram.StatisticsStationary
,HasMean
,HasMean.Fitness
,HasMean.Strategy
,HasPop2D
,HasPop2D.Fitness
,HasPop2D.Strategy
,HasPop3D
,HasPop3D.Fitness
,HasPop3D.Strategy
,CLOProvider
public class NetGames
extends Discrete
implements IBS.HasIBS, HasPop2D.Strategy, HasPop3D.Strategy, HasMean.Strategy, HasPop2D.Fitness, HasPop3D.Fitness, HasMean.Fitness, HasHistogram.Fitness, HasHistogram.Degree, HasHistogram.StatisticsStationary
Cooperation in dynamical networks.
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
The extension for IBS simulations implement cooperative actions on dynamical networks.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 colors for altruists, fair players, and egoists.final CLOption
Command line option to set the cost-to-benefit ratio of cooperation.final CLOption
Command line option to set the cost-to-benefit ratio of cooperation.(package private) double
The probability to pick a random model for comparison.(package private) double
The cost-to-benefit ratio of cooperation.(package private) double
The selection strength on differences in payoff or cooperativity.static final int
The color index of altruists.static final int
The color index of egoists.static final int
The color index of fair players.Fields inherited from class Discrete
cloMonoStop, monoStop, mutation, species
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Providers of command line options may want to remove certain options that other providers provided by overriding this method.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.Get the color of pure altruists (only help others, don't receive any help from others).Returns a string with information about the authors of the module.Get the color of pure egoists (only receive help from others, don't provide any help to others).Get the color of fair individuals (help the same number of individuals as help them, regardless of any potential reciprocity).getKey()
Returns identifier of the active module.double
Calculates and returns the maximum payoff/score of an individual.double
Calculates and returns the minimum payoff/score of an individual.double
Get the probability of picking a random model for comparison.double
getRatio()
Get the cost-to-benefit ratio of cooperation.double
Get the selection strength on differences in payoffs and cooperativity.getTitle()
Returns title of active module, e.g.void
load()
Load new module and perform basic initializations.<T> ColorMap
<T> processColorMap
(ColorMap<T> colorMap) void
setAltruistColor
(Color altruist) Set the color of pure altruists (only help others, don't receive any help from others).void
setEgoistColor
(Color egoist) Set the color of pure egoists (only receive help from others, don't provide any help to others).void
setFairColor
(Color fair) Set the color of fair individuals (help the same number of individuals as help them, regardless of any potential reciprocity).void
setRandomSampleProb
(double prob) Set the probability of picking a random model for comparison.void
setRatio
(double ratio) Set the cost-to-benefit ratio of cooperation.void
setSelection
(double selection) Set the selection strength on differences in payoffs and cooperativity.Methods inherited from class Discrete
add, getMaxMonoGameScore, getMinMonoGameScore, getMonoGameScore, getMonoStop, getMutation, setMonoStop, unload
Methods inherited from class Module
check, createGeometry, getActiveTraits, getCompetitionGeometry, getDeathRate, getDependent, getGeometry, getIBSPopulation, getID, getInteractionGeometry, getMapToFitness, getMarkers, getMeanColors, getModelTypes, getNActive, getName, getNGroup, getNPopulation, getNRoles, getNSpecies, getNTraits, getOpponent, getPlayerUpdate, getSpecies, getSpecies, getSpeciesUpdateRate, getTraitColor, getTraitColors, getTraitName, getTraitNames, getTrajectoryColor, getVacant, init, isNeutral, 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 Features
isPairwise, isStatic
Methods inherited from interface HasHistogram
getCustomLevels, getNTraits, getTraitColors
Methods inherited from interface IBS.HasIBS
createIBS
Methods inherited from interface MilestoneListener
modelDidInit, modelDidReset, modelLoaded, modelRelaxed, modelRunning, modelSettings, modelStopped, modelUnloaded, moduleLoaded, moduleRestored, moduleUnloaded
-
Field Details
-
ratio
double ratioThe cost-to-benefit ratio of cooperation. -
selection
double selectionThe selection strength on differences in payoff or cooperativity. -
pRandomSample
double pRandomSampleThe probability to pick a random model for comparison. -
TYPE_ALTRUIST
public static final int TYPE_ALTRUISTThe color index of altruists.- See Also:
-
TYPE_FAIR
public static final int TYPE_FAIRThe color index of fair players.- See Also:
-
TYPE_EGOIST
public static final int TYPE_EGOISTThe color index of egoists.- See Also:
-
cloRatio
Command line option to set the cost-to-benefit ratio of cooperation. -
cloSelection
Command line option to set the cost-to-benefit ratio of cooperation. -
cloColors
Command line option to set the colors for altruists, fair players, and egoists.
-
-
Constructor Details
-
NetGames
Create a new instance of the module for cooperation in dynamical networks, where the network structure encodes the individuals behaviour.- Parameters:
engine
- the manager of modules and pacemaker for running the model
-
-
Method Details
-
load
public void load()Description copied from class:Module
Load new module and perform basic initializations. -
getKey
Description copied from class:Module
Returns identifier of the active module. For example, 2x2 games inTBT
return "2x2". This corresponds to the argument for the--module
option to load a particular module. The default is to use the class name. -
getAuthors
Description copied from class:Module
Returns a string with information about the authors of the module.- Overrides:
getAuthors
in classModule
- Returns:
- the names of the authors
-
getTitle
Description copied from class:Module
Returns title of active module, e.g. 2x2 games inTBT
returns "2x2 Games". -
processColorMap
Opportunity for modules to make adjustments to the color map in graphs such asPop2D
orPop3D
. By default no changes are made.Dynamical networks use a custom mapping for colors.
- Overrides:
processColorMap
in classModule
- Type Parameters:
T
- the type of the color map- Parameters:
colorMap
- the color map- Returns:
- the processed color map
- See Also:
-
getMinGameScore
public double getMinGameScore()Description copied from class:Module
Calculates and returns the minimum payoff/score of an individual. This value is important for converting payoffs/scores into probabilities, for scaling graphical output and some optimizations.- Specified by:
getMinGameScore
in classModule
- Returns:
- the minimum payoff/score
- See Also:
-
getMaxGameScore
public double getMaxGameScore()Description copied from class:Module
Calculates and returns the maximum payoff/score of an individual. This value is important for converting payoffs/scores into probabilities, for scaling graphical output and some optimizations.- Specified by:
getMaxGameScore
in classModule
- Returns:
- the maximum payoff/score
- See Also:
-
setRatio
public void setRatio(double ratio) Set the cost-to-benefit ratio of cooperation.- Parameters:
ratio
- the new cost-to-benefit ratio
-
getRatio
public double getRatio()Get the cost-to-benefit ratio of cooperation.- Returns:
- the cost-to-benefit ratio
-
setSelection
public void setSelection(double selection) Set the selection strength on differences in payoffs and cooperativity.- Parameters:
selection
- the new selection strength
-
getSelection
public double getSelection()Get the selection strength on differences in payoffs and cooperativity.- Returns:
- the selection strength
-
setRandomSampleProb
public void setRandomSampleProb(double prob) Set the probability of picking a random model for comparison.- Parameters:
prob
- the new probability to pick a random model
-
getRandomSampleProb
public double getRandomSampleProb()Get the probability of picking a random model for comparison.- Returns:
- the probability to pick a random model
-
setAltruistColor
Set the color of pure altruists (only help others, don't receive any help from others).- Parameters:
altruist
- the new color of altruists
-
getAltruistColor
Get the color of pure altruists (only help others, don't receive any help from others).- Returns:
- the color of altruists
-
setFairColor
Set the color of fair individuals (help the same number of individuals as help them, regardless of any potential reciprocity).- Parameters:
fair
- the new color of fair individuals
-
getFairColor
Get the color of fair individuals (help the same number of individuals as help them, regardless of any potential reciprocity).- Returns:
- the color of fair individuals
-
setEgoistColor
Set the color of pure egoists (only receive help from others, don't provide any help to others).- Parameters:
egoist
- the new color of egoists
-
getEgoistColor
Get the color of pure egoists (only receive help from others, don't provide any help to others).- Returns:
- the color of egoists
-
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 classDiscrete
- Parameters:
parser
- the reference to parser that manages command line options- See Also:
-
adjustCLO
Description copied from interface:CLOProvider
Providers of command line options may want to remove certain options that other providers provided by overriding this method. After all command line options are collected, all providers get a chance to adjust the collection. In particular, options should be removed that do not make sense in present context. Overriding methods usually callCLOParser.removeCLO(String[])
or variants thereof.- Specified by:
adjustCLO
in interfaceCLOProvider
- 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 classModule
- Returns:
- the custom IBSPopulation or
null
to use default.
-