learningRules
Class SmoothBGLearning

java.lang.Object
  |
  +--learningRules.SmoothBGLearning
All Implemented Interfaces:
LearningRule

public class SmoothBGLearning
extends java.lang.Object
implements LearningRule

This is a strategy learning model for the Bala Goyal Model. This model presumes there are n states of the world and n strategies. It then has the individuals update probabilites based on the state of the world. The best response rule is a probabilistic (smoothed) best response.

Author:
Kevin Zollman

Constructor Summary
SmoothBGLearning(Game[] g, double gam)
          Initializing a BgLearning model.
 
Method Summary
 void newGeneration(Individual i)
          This does nothing since there is no discounting or anything.
 int pickStrat(Individual i)
          This function chooses a strategy for the player.
static double probs(double[] x)
          This calculates 1/(e^x[0]+e^x[1]+...+e^x[n]) It returns a double which is a rounded version of the result
 void processPayoff(Individual i)
          This processes a payoff for an individual.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmoothBGLearning

public SmoothBGLearning(Game[] g,
                        double gam)
Initializing a BgLearning model.

Parameters:
g - The games array containing all the possible games one for each state of the world
Method Detail

probs

public static final double probs(double[] x)
This calculates 1/(e^x[0]+e^x[1]+...+e^x[n]) It returns a double which is a rounded version of the result

Parameters:
x - The list of exponents
Returns:
1/(e^x[0]+e^x[1]+...+e^x[n])

newGeneration

public void newGeneration(Individual i)
                   throws ModelError
This does nothing since there is no discounting or anything.

Specified by:
newGeneration in interface LearningRule
Parameters:
i - The individual calling the function
Throws:
ModelError - (although, since this does nothing it will never be thrown)

processPayoff

public void processPayoff(Individual i)
                   throws ModelError
This processes a payoff for an individual. This function performs standard Bayesian updating based the the most recent payoff received This function should only be called after the game has been played.

Specified by:
processPayoff in interface LearningRule
Parameters:
i - The individual calling the function
Throws:
ModelError - if something fails durring updating

pickStrat

public int pickStrat(Individual i)
This function chooses a strategy for the player. It uses a probabilistic (smoothed) best response to its beliefs function. The function used is an exponentiation function for two strategies the probability of strategy one is
e^(E(1)/gamma) / *(e^(E(1)/gamma) + e^(E(2)/gamma))
where E(x) is the expectation of action x and gamma is a parameter which corresponds to the amount of "smoothing" that occurs (i.e. the higher the gamma the further from the best response correspondence the function is).

Specified by:
pickStrat in interface LearningRule
Parameters:
i - The calling individual