models
Class HybridModel

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

public class HybridModel
extends java.lang.Object

This is a Hyrbid Model which involves both experimentation (as implemented in the BGModel) and also conformist behavior (averaging of neighbors beliefs). The model involves one extra parameter (e) which is the experimentation parameter. An individual performs an experiment on a given round with probability e.

Author:
Kevin Zollman

Constructor Summary
HybridModel()
           
 
Method Summary
 void createPlayersHigh(Individual[] inds, int s)
          Forms a new network of specified size; expects random to be set.
 void createPlayersHigh(Individual[] inds, int s, ConnectionRule c, LearningRule l, double m, double z)
          Forms a new network of specified size; expects random to be set.
 void createPlayersHigh(Individual[] inds, int s, ConnectionRule c, LearningRule l, Game g, double m, double z)
          Forms a new network of specified size; expects random to be set.
 void createPlayersLow(Individual[] inds)
          Forms a new network of specified size; doesn't expect much to be set.
 int detectConvergence(int sow)
          Checks to see if the population has converged either to the correct state or the bad state.
 double getE()
           
 Game[] getGames()
          Returns the games for the BgModel
 Individual[] getIndividuals()
          Returns the set of individuals for the model.
 MersenneTwister getRandom()
          Returns the random number generator for the model.
static void main(java.lang.String[] args)
           
 void playGen()
          Resets then plays a generation.
 void setE(double e)
           
 void setGames(Game[] g)
          Sets an array of games, one for each state of the world.
 void setIndividuals(Individual[] i)
          Sets the list of individuals for the model.
 void setRandom(MersenneTwister r)
          Sets the random number generator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HybridModel

public HybridModel()
Method Detail

setGames

public void setGames(Game[] g)
Sets an array of games, one for each state of the world.

Parameters:
g - The array of Game objects

getGames

public Game[] getGames()
Returns the games for the BgModel

Returns:
the games

setIndividuals

public void setIndividuals(Individual[] i)
Sets the list of individuals for the model.

Parameters:
i - An array of individuals

getIndividuals

public Individual[] getIndividuals()
Returns the set of individuals for the model.

Returns:
the individuals

getE

public double getE()
Returns:
The value of e (the probability an individual experiments)

setE

public void setE(double e)

setRandom

public void setRandom(MersenneTwister r)
Sets the random number generator.

Parameters:
r - the mersennetwister random number generator

getRandom

public MersenneTwister getRandom()
Returns the random number generator for the model.

Returns:
the mersenne twister random number generator

createPlayersLow

public void createPlayersLow(Individual[] inds)
Forms a new network of specified size; doesn't expect much to be set. This method only tells each individual of the network, does not set anything else.

Parameters:
inds - A list of individuals

createPlayersHigh

public void createPlayersHigh(Individual[] inds,
                              int s)
                       throws ModelError
Forms a new network of specified size; expects random to be set. This method tells each individual of the network, sets the random number generator, and calle each individuals initStart function.

Parameters:
inds - A list of individuals
s - The number of states of the world
Throws:
ModelError - If an initialization error

createPlayersHigh

public void createPlayersHigh(Individual[] inds,
                              int s,
                              ConnectionRule c,
                              LearningRule l,
                              double m,
                              double z)
                       throws ModelError
Forms a new network of specified size; expects random to be set. This method tells each individual of the network, sets the random number generator, gives the individuals a connection and learning rule, sets the mutation rate, sets belief constraint, and calls each individuals initStart function

Parameters:
inds - A list of individuals
s - The number of states of the world
c - The connection rule used for forming network connections by each individual
l - The learning rule used for determining strategies by each individual
m - The mutation rate for each individual to reset their beliefs
z - The zero-state constraint for beliefs (initial beliefs cannot be lower than z)
Throws:
ModelError - If something fails during initialization

createPlayersHigh

public void createPlayersHigh(Individual[] inds,
                              int s,
                              ConnectionRule c,
                              LearningRule l,
                              Game g,
                              double m,
                              double z)
                       throws ModelError
Forms a new network of specified size; expects random to be set. This method tells each individual of the network, sets the random number generator, gives the individuals a connection and learning rule, sets the list of games sets the mutation rate, sets belief constraint, and calls each individuals initStart function

Parameters:
inds - A list of individuals
s - The number of states of the world
c - The connection rule used for forming network connections by each individual
l - The learning rule used for determining strategies by each individual
g - The games used in the model
m - The mutation rate for each individual to reset their beliefs
z - The zero-state constraint for beliefs (initial beliefs cannot be lower than z)
Throws:
ModelError - If something fails during initialization

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 sow)
                      throws ModelError
Checks to see if the population has converged either to the correct state or the bad state. This function presumes that state 0 is the uninformative state.

Parameters:
sow - What is the actual state of the world?
Returns:
This function returns 0 if unconverged, 1 if converged to the true state, 2 if converged to the wrong state (only possible in good states; i.e. not state 0).
ModelError

main

public static void main(java.lang.String[] args)
Parameters:
args - Command line