Package org.evoludo.simulator.modules
Class NetGames
- All Implemented Interfaces:
Runnable,IBS.HasIBS,MilestoneListener,Features,Features.Payoffs,HasHistogram,HasHistogram.Degree,HasHistogram.Fitness,HasHistogram.StatisticsStationary,HasMean,HasMean.Fitness,HasMean.Traits,HasPop2D,HasPop2D.Fitness,HasPop2D.Traits,HasPop3D,HasPop3D.Fitness,HasPop3D.Traits,CLOProvider
public class NetGames
extends Discrete
implements Features.Payoffs, IBS.HasIBS, HasPop2D.Traits, HasPop3D.Traits, HasMean.Traits, 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 TypeClassDescriptionclassThe extension for IBS simulations implement cooperative actions on dynamical networks.Nested 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.MCPairs -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CLOptionCommand line option to set the colors for altruists, fair players, and egoists.final CLOptionCommand line option to set the cost-to-benefit ratio of cooperation.final CLOptionCommand line option to set the cost-to-benefit ratio of cooperation.(package private) doubleThe probability to pick a random model for comparison.(package private) doubleThe cost-to-benefit ratio of cooperation.(package private) doubleThe selection strength on differences in payoff or cooperativity.static final intThe color index of altruists.static final intThe color index of egoists.static final intThe color index of fair players.Fields inherited from class Discrete
cloMonoStop, monoStop, mutation, speciesFields inherited from class Module
active, cloDeathRate, cloGeometry, cloNGroup, cloNPopulation, cloPhase2DAxes, cloTraitColors, cloTraitDisable, cloTraitNames, competition, deathRate, defaultColor, engine, ibs, ID, interaction, logger, map2fitness, markers, model, nActive, name, nGroup, nPopulation, nTraits, opponent, playerUpdate, structure, traitColor, traitName, trajectoryColor, VACANT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidProviders of command line options may want to remove certain options that other providers provided by overriding this method.voidcollectCLO(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.doubleCalculates and returns the maximum payoff/score of an individual.doubleCalculates and returns the minimum payoff/score of an individual.doubleGet the probability of picking a random model for comparison.doublegetRatio()Get the cost-to-benefit ratio of cooperation.doubleGet the selection strength on differences in payoffs and cooperativity.getTitle()Returns title of active module, e.g.voidload()Load new module and perform basic initializations.<T> ColorMap<T> processColorMap(ColorMap<T> colorMap) voidsetAltruistColor(Color altruist) Set the color of pure altruists (only help others, don't receive any help from others).voidsetEgoistColor(Color egoist) Set the color of pure egoists (only receive help from others, don't provide any help to others).voidsetFairColor(Color fair) Set the color of fair individuals (help the same number of individuals as help them, regardless of any potential reciprocity).voidsetRandomSampleProb(double prob) Set the probability of picking a random model for comparison.voidsetRatio(double ratio) Set the cost-to-benefit ratio of cooperation.voidsetSelection(double selection) Set the selection strength on differences in payoffs and cooperativity.Methods inherited from class Discrete
add, getMaxMonoPayoff, getMinMonoPayoff, getMonoPayoff, getMonoStop, getMutation, setMonoStop, unloadMethods inherited from class Module
check, createGeometry, createModel, getActiveTraits, getCompetitionGeometry, getDeathRate, getGeometry, getIBSPopulation, getID, getInteractionGeometry, getMap2Fitness, getMarkers, getMeanColors, getModelTypes, getNActive, getName, getNGroup, getNPopulation, getNRoles, getNSpecies, getNTraits, getOpponent, getPlayerUpdate, getSpecies, getSpecies, getTraitColor, getTraitColors, getTraitName, getTraitNames, getTrajectoryColor, getVacant, init, reset, run, 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, isPairwise, isStaticMethods 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 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:ModuleLoad new module and perform basic initializations. -
getKey
Description copied from class:ModuleReturns identifier of the active module. For example, 2x2 games inTBTreturn "2x2". This corresponds to the argument for the--moduleoption to load a particular module. The default is to use the class name. -
getAuthors
Description copied from class:ModuleReturns a string with information about the authors of the module.- Overrides:
getAuthorsin classModule- Returns:
- the names of the authors
-
getTitle
Description copied from interface:FeaturesReturns title of active module, e.g. 2x2 games inTBTreturns "2x2 Games". -
processColorMap
Opportunity for modules to make adjustments to the color map in graphs such asPop2DorPop3D. By default no changes are made.Dynamical networks use a custom mapping for colors.
- Overrides:
processColorMapin classModule- Type Parameters:
T- the type of the color map- Parameters:
colorMap- the color map- Returns:
- the processed color map
- See Also:
-
getMinPayoff
public double getMinPayoff()Description copied from interface:Features.PayoffsCalculates 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:
getMinPayoffin interfaceFeatures.Payoffs- Returns:
- the minimum payoff/score
- See Also:
-
getMaxPayoff
public double getMaxPayoff()Description copied from interface:Features.PayoffsCalculates 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:
getMaxPayoffin interfaceFeatures.Payoffs- 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: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 classDiscrete- Parameters:
parser- the reference to parser that manages command line options- See Also:
-
adjustCLO
Description copied from interface:CLOProviderProviders 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:
adjustCLOin interfaceCLOProvider- Parameters:
parser- the reference to parser that manages command line options- See Also:
-
createIBSPop
Description copied from class:ModuleOpportunity to supply custom individual based simulations.- Overrides:
createIBSPopin classModule- Returns:
- the custom IBSPopulation or
nullto use default.
-