models
Class BiasedNetworkModel

java.lang.Object
  |
  +--models.BiasedNetworkModel

public class BiasedNetworkModel
extends java.lang.Object

This class implements a learning in network model with biased network formation This model uses beta-distribution learning (aka payoff learning).

Author:
Kevin Zollman

Field Summary
static MersenneTwister random
           
 
Constructor Summary
BiasedNetworkModel(Individual[] i, Game g, LearningRule l, double m, double min, double max)
           
 
Method Summary
 int detectConvergence(int optimal)
          Checks to see if the population has converged either to the correct state or the bad state.
 int getAgreement(int i, int j)
          Returns the agreement count between i and j.
 Game getGame()
          Returns the value of game.
 Individual[] getIndivids()
          Returns the value of indivis.
 double getMaximumProb()
          Gets the connection probability
 double getMinimumProb()
          Gets the connection probability
 int getTotalPlayed()
          Returns the value of totalPlayed.
 void incAgreement(int i, int j)
          Increments the agreement counter between i and j.
 void incTotalPlayed()
          Increments total count
static void main(java.lang.String[] args)
           
 void playGen()
          Resets then plays a generation.
 void resetAgreement(int n)
          Resets the value for agreement.
 void setAgreement(int i, int j, int a)
          Sets the agreement counter for two agents to a specified value.
 void setGame(Game game)
          Sets the value of game.
 void setIndivids(Individual[] individs)
          Sets the value of indivis.
 void setMaximumProb(double p)
          Sets the connection probability
 void setMinimumProb(double p)
          Sets the connection probability
 void setTotalPlayed(int totalPlayed)
          Sets the value of totalPlayed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

public static final MersenneTwister random
Constructor Detail

BiasedNetworkModel

public BiasedNetworkModel(Individual[] i,
                          Game g,
                          LearningRule l,
                          double m,
                          double min,
                          double max)
                   throws ModelError
Method Detail

getIndivids

public Individual[] getIndivids()
Returns the value of indivis.


setIndivids

public void setIndivids(Individual[] individs)
Sets the value of indivis.


getGame

public Game getGame()
Returns the value of game.


setGame

public void setGame(Game game)
Sets the value of game.

Parameters:
game - The value to assign game.

getMinimumProb

public double getMinimumProb()
Gets the connection probability

Returns:
The connection probability

setMinimumProb

public void setMinimumProb(double p)
Sets the connection probability

Parameters:
p - The connection probability

getMaximumProb

public double getMaximumProb()
Gets the connection probability

Returns:
The connection probability

setMaximumProb

public void setMaximumProb(double p)
Sets the connection probability

Parameters:
p - The connection probability

getTotalPlayed

public int getTotalPlayed()
Returns the value of totalPlayed.


setTotalPlayed

public void setTotalPlayed(int totalPlayed)
Sets the value of totalPlayed.

Parameters:
totalPlayed - The value to assign totalPlayed.

incTotalPlayed

public void incTotalPlayed()
Increments total count


resetAgreement

public void resetAgreement(int n)
Resets the value for agreement.

Parameters:
n - Number of agents in the network

getAgreement

public int getAgreement(int i,
                        int j)
Returns the agreement count between i and j. Although agreement is only defined for i <= j, arguments can be passed in any order. Since agreement is symmetric, getAgreement(i, j) == getAgreement(j, i) always.

Parameters:
i - One agent
j - Another

incAgreement

public void incAgreement(int i,
                         int j)
Increments the agreement counter between i and j. Since agreement is symmteric incAgreement(i,j) is equivalent to incAgreement(j, i)

Parameters:
i - One agent
j - Another

setAgreement

public void setAgreement(int i,
                         int j,
                         int a)
Sets the agreement counter for two agents to a specified value. Since agreement is symmetric setAgreement(i,j,s) is equivalent to setAgreement(j,i,s)

Parameters:
i - One agent
j - Another

playGen

public void playGen()
             throws ModelError
Resets then plays a generation. This first calls each individuals reset function, then calls each individuals playGame function, then calles each individuals update function

Throws:
ModelError - If something bad happens

detectConvergence

public int detectConvergence(int optimal)
                      throws ModelError
Checks to see if the population has converged either to the correct state or the bad state. Convergence here only means individuals all persue the same strategy, so should not be used to stop a run.

Parameters:
optimal - The optimal action
Returns:
This function returns 0 if unconverged, 1 if converged to the true state, 2 if converged to the wrong state
ModelError

main

public static void main(java.lang.String[] args)