edu.stanford.multiagent.gamer
Class PolymatrixGame

java.lang.Object
  |
  +--edu.stanford.multiagent.gamer.ParameterizedObject
        |
        +--edu.stanford.multiagent.gamer.Game
              |
              +--edu.stanford.multiagent.gamer.GraphicalGame
                    |
                    +--edu.stanford.multiagent.gamer.PolymatrixGame

public class PolymatrixGame
extends GraphicalGame

Generate a Polymatrix Game with any given structure as long as the structure has been implemented as a graph class. For example, can be used to create polymatrix games with tree structures or ring structures. Similar to StructuredGraphicalGame except the payoff matrices in the graphical games are per node and the payoff matrices in the polymatrix game are per edge. (This means it is sensible for polymatrix games to have subgames that are not just random, unlike the random graphical games.)


Field Summary
 
Fields inherited from class edu.stanford.multiagent.gamer.GraphicalGame
graph
 
Fields inherited from class edu.stanford.multiagent.gamer.Game
actions, DEFAULT_HIGH, DEFAULT_LOW, intMult, intPayoffs, players, pMaxPayoff, pMinPayoff, pNormalize, symActions
 
Fields inherited from class edu.stanford.multiagent.gamer.ParameterizedObject
parameters
 
Constructor Summary
PolymatrixGame()
           
 
Method Summary
protected  void checkParameters()
          This will be done for the subgame matrices and the graph separately
 void doGenerate()
          Generate the matrices for each node of the graph and the graph connecting neighbors to each other.
protected  java.lang.String getGameHelp()
          Return help screen information about the given game class.
protected  void initGraph()
          Initialize a graph with the number of nodes equal to the number of players.
 void initialize()
          Initialize this game, the graph, and the two player games.
 void randomizeParameters()
          Randomize parameters that were not set by the user
 void setParameters(edu.stanford.multiagent.gamer.ParamParser p, boolean randomize)
          Sets multiple parameters at once using a ParamParser.
 
Methods inherited from class edu.stanford.multiagent.gamer.GraphicalGame
addEdge, addEdge, getPayoff, setNodeMatrix, writeGame
 
Methods inherited from class edu.stanford.multiagent.gamer.Game
generate, getAutoNormPayoff, getDescription, getHelp, getName, getNormPayoff, getNumActions, getNumActions, getNumPlayers, getOutputPayoff, getOutputPayoff, getPayoff, getRangeHelp, parseActions, parsePlayersActions, parsePlayersSameNumberActions, parseSameNumberActions, setDescription, setName, setNormMinAndMax, setNumActions, setNumActions, setNumPlayers
 
Methods inherited from class edu.stanford.multiagent.gamer.ParameterizedObject
getBooleanParameter, getDoubleParameter, getLongParameter, getParamDescription, getParameter, getParameters, getStringParameter, setParameter, setParameter, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolymatrixGame

public PolymatrixGame()
               throws java.lang.Exception
Method Detail

setParameters

public void setParameters(edu.stanford.multiagent.gamer.ParamParser p,
                          boolean randomize)
                   throws java.lang.Exception
Description copied from class: ParameterizedObject
Sets multiple parameters at once using a ParamParser.

Overrides:
setParameters in class ParameterizedObject
Parameters:
p - the ParamParser containing the parameters and their values
randomize - should be set to true if it is desired that any unset parameters be randomized
Throws:
java.lang.Exception

initialize

public void initialize()
                throws java.lang.Exception
Initialize this game, the graph, and the two player games.

Overrides:
initialize in class Game
Throws:
java.lang.Exception

randomizeParameters

public void randomizeParameters()
Randomize parameters that were not set by the user

Overrides:
randomizeParameters in class ParameterizedObject

checkParameters

protected void checkParameters()
                        throws java.lang.Exception
This will be done for the subgame matrices and the graph separately

Specified by:
checkParameters in class ParameterizedObject
Throws:
java.lang.Exception - if anything is wrong with the parameter values

getGameHelp

protected java.lang.String getGameHelp()
Description copied from class: Game
Return help screen information about the given game class.

Specified by:
getGameHelp in class Game

initGraph

protected void initGraph()
Initialize a graph with the number of nodes equal to the number of players.

Specified by:
initGraph in class GraphicalGame

doGenerate

public void doGenerate()
Generate the matrices for each node of the graph and the graph connecting neighbors to each other.

Specified by:
doGenerate in class ParameterizedObject