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

Cooperation in dynamical networks.
Author:
Christoph Hauert
  • Field Details

    • ratio

      double ratio
      The cost-to-benefit ratio of cooperation.
    • selection

      double selection
      The selection strength on differences in payoff or cooperativity.
    • pRandomSample

      double pRandomSample
      The probability to pick a random model for comparison.
    • TYPE_ALTRUIST

      public static final int TYPE_ALTRUIST
      The color index of altruists.
      See Also:
    • TYPE_FAIR

      public static final int TYPE_FAIR
      The color index of fair players.
      See Also:
    • TYPE_EGOIST

      public static final int TYPE_EGOIST
      The color index of egoists.
      See Also:
    • cloRatio

      public final CLOption cloRatio
      Command line option to set the cost-to-benefit ratio of cooperation.
    • cloSelection

      public final CLOption cloSelection
      Command line option to set the cost-to-benefit ratio of cooperation.
    • cloColors

      public final CLOption cloColors
      Command line option to set the colors for altruists, fair players, and egoists.
  • Constructor Details

    • NetGames

      public NetGames(EvoLudo engine)
      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.
      Overrides:
      load in class Discrete
      See Also:
    • getKey

      public String getKey()
      Description copied from class: Module
      Returns identifier of the active module. For example, 2x2 games in TBT return "2x2". This corresponds to the argument for the --module option to load a particular module. The default is to use the class name.
      Overrides:
      getKey in class Module
      Returns:
      the identifying key of this module
    • getAuthors

      public String getAuthors()
      Description copied from class: Module
      Returns a string with information about the authors of the module.
      Overrides:
      getAuthors in class Module
      Returns:
      the names of the authors
    • getTitle

      public String getTitle()
      Description copied from class: Module
      Returns title of active module, e.g. 2x2 games in TBT returns "2x2 Games".
      Specified by:
      getTitle in class Module
      Returns:
      the title of active module
    • processColorMap

      public <T> ColorMap<T> processColorMap(ColorMap<T> colorMap)
      Opportunity for modules to make adjustments to the color map in graphs such as Pop2D or Pop3D. By default no changes are made.

      Dynamical networks use a custom mapping for colors.

      Overrides:
      processColorMap in class Module
      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 class Module
      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 class Module
      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

      public void setAltruistColor(Color altruist)
      Set the color of pure altruists (only help others, don't receive any help from others).
      Parameters:
      altruist - the new color of altruists
    • getAltruistColor

      public Color getAltruistColor()
      Get the color of pure altruists (only help others, don't receive any help from others).
      Returns:
      the color of altruists
    • setFairColor

      public void setFairColor(Color fair)
      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

      public Color 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

      public void setEgoistColor(Color egoist)
      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

      public Color 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

      public void collectCLO(CLOParser parser)
      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, the parser issues a warning and ignores the option. Thus, in general, implementing subclasses should first register their options and call super.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 interface CLOProvider
      Overrides:
      collectCLO in class Discrete
      Parameters:
      parser - the reference to parser that manages command line options
      See Also:
    • adjustCLO

      public void adjustCLO(CLOParser parser)
      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 call CLOParser.removeCLO(String[]) or variants thereof.
      Specified by:
      adjustCLO in interface CLOProvider
      Parameters:
      parser - the reference to parser that manages command line options
      See Also:
    • createIBSPop

      public NetGames.IBSPop createIBSPop()
      Description copied from class: Module
      Opportunity to supply custom individual based simulations.
      Overrides:
      createIBSPop in class Module
      Returns:
      the custom IBSPopulation or null to use default.