edu.stanford.multiagent.gamer
Class GeometricGame
java.lang.Object
|
+--edu.stanford.multiagent.gamer.ParameterizedObject
|
+--edu.stanford.multiagent.gamer.Game
|
+--edu.stanford.multiagent.gamer.GeometricGame
- Direct Known Subclasses:
- GreedyGame, SimpleInspectionGame
- public abstract class GeometricGame
- extends Game
Class implements shared details of Geometric Games.
It is assumed that all Geometric Games have two players, and
that each chooses a subset of elements from a set S as their
action. There may be limits on the max number of elements from S
which each may choose, but otherwise choices are unrestricted.
The payoff will always be calculated based on the set which the
the first ("red") player chooses from S, the set which the second
("blue") player chooses from S, and the intersection of these sets.
The payoff function is abstract and must be filled in by each
subclass of Geometric Game.
Constructor Summary |
GeometricGame()
Constructor for new geometric games. |
Method Summary |
abstract double |
calculatePayoff(int player,
java.util.BitSet R,
java.util.BitSet B,
java.util.BitSet intersection)
Calculates the payoff for a player based on the set chosen
by player one, the set chosen by player 2, and the intersection
of these two sets. |
long |
getGeoNumActions(long fullSetSize,
long maxSize)
Returns the number of possible actions for a player choosing
a set of maximum size maxSize from a set of size fullSetSize. |
double |
getPayoff(int[] outcome,
int player)
Returns the payoff for the given player at the given
outcome, which must first be translated into subsets of
the elements which are chosen by each player. |
void |
initVariables(long sizeOfSet,
long maxInR,
long maxInB)
Initializes all variables common to geometric games. |
Methods inherited from class edu.stanford.multiagent.gamer.Game |
generate, getAutoNormPayoff, getDescription, getGameHelp, getHelp, getName, getNormPayoff, getNumActions, getNumActions, getNumPlayers, getOutputPayoff, getOutputPayoff, getPayoff, getRangeHelp, initialize, parseActions, parsePlayersActions, parsePlayersSameNumberActions, parseSameNumberActions, setDescription, setName, setNormMinAndMax, setNumActions, setNumActions, setNumPlayers, writeGame |
Methods inherited from class edu.stanford.multiagent.gamer.ParameterizedObject |
checkParameters, doGenerate, getBooleanParameter, getDoubleParameter, getLongParameter, getParamDescription, getParameter, getParameters, getStringParameter, randomizeParameters, setParameter, setParameter, setParameters, setParameters |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GeometricGame
public GeometricGame()
throws java.lang.Exception
- Constructor for new geometric games.
initVariables
public void initVariables(long sizeOfSet,
long maxInR,
long maxInB)
- Initializes all variables common to geometric games.
- Parameters:
sizeOfSet
- the total number of items in the set from which
players will choosemaxInR
- the maximum number of items that the first player
will be able to choose from the setmaxInB
- the maximum number of items that the second player
will be able to choose from the set
getPayoff
public double getPayoff(int[] outcome,
int player)
- Returns the payoff for the given player at the given
outcome, which must first be translated into subsets of
the elements which are chosen by each player.
- Specified by:
getPayoff
in class Game
- Parameters:
outcome
- an array holding the actions chosen by
each playerplayer
- the player whose payoff to return
calculatePayoff
public abstract double calculatePayoff(int player,
java.util.BitSet R,
java.util.BitSet B,
java.util.BitSet intersection)
- Calculates the payoff for a player based on the set chosen
by player one, the set chosen by player 2, and the intersection
of these two sets. This function must be overwritten by
every child class.
- Parameters:
player
- the player whose payoff should be returnedR
- the set chosen by player 1B
- the set chosen by player 2intersection
- the intersection of the sets chosen by
players 1 and 2
getGeoNumActions
public long getGeoNumActions(long fullSetSize,
long maxSize)
throws java.lang.Exception
- Returns the number of possible actions for a player choosing
a set of maximum size maxSize from a set of size fullSetSize.
- Parameters:
fullSetSize
- size of the full setmaxSize
- the maximum number of items that can be chosen
java.lang.Exception