models
Class PayoffLearningModel

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

public class PayoffLearningModel
extends java.lang.Object


Field Summary
static MersenneTwister random
           
 
Constructor Summary
PayoffLearningModel(Individual[] i, Game g, ConnectionRule c, LearningRule l, double m)
           
 
Method Summary
 int detectConvergence(int optimal)
          Checks to see if the population has converged either to the correct state or the bad state.
 Game getGame()
          Returns the value of game.
 Individual[] getIndivids()
          Returns the value of indivis.
static void main(java.lang.String[] args)
           
 void playGen()
          Resets then plays a generation.
 void setGame(Game game)
          Sets the value of game.
 void setIndivids(Individual[] individs)
          Sets the value of indivis.
 
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

PayoffLearningModel

public PayoffLearningModel(Individual[] i,
                           Game g,
                           ConnectionRule c,
                           LearningRule l,
                           double m)
                    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.

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)