BCESolve
BCEAbstractGame Class Referenceabstract

The base class for games of incomplete information. More...

#include <bceabstractgame.hpp>

Inheritance diagram for BCEAbstractGame:

Public Member Functions

 BCEAbstractGame ()
 Default constructor.
 
 BCEAbstractGame (int numStatesArg, int numActionsArg, int numTypesArg, int numObjectivesArg)
 Constructor. More...
 
 BCEAbstractGame (int numStatesArg, const vector< int > &numActionsArg, const vector< int > &numTypesArg, int numObjectivesArg)
 Constructor. More...
 
 ~BCEAbstractGame ()
 Destructor.
 
void setHasProductStructureData (bool hasProductStructure)
 Allows user to specify if the game has a product structure.
 
virtual double prior (int state, const vector< int > &types) const =0
 Prior over state and types. More...
 
double prior (const vector< int > &states, const vector< int > &types) const
 Overloaded prior if the game has a product structure.
 
double prior (int state, int type, int player) const
 Marginal prior distribution. More...
 
virtual double objective (int state, const vector< int > &actions, int obj) const =0
 Objective function. More...
 
double objective (const vector< int > &states, const vector< int > &actions, int obj) const
 Overloaded objective if the game has a product structure.
 
virtual bool dominated (int action, int type, int player) const
 Indicates if a combination of actions and types is dominated. More...
 
bool dominated (const vector< int > &actions, const vector< int > &types) const
 Check if no player's action is dominated. More...
 
virtual bool feasibleDeviation (int action, int dev, int type, int player) const
 Check if deviation is feasible. More...
 
bool setNumPrivateStates (const vector< int > &_numPrivateStates)
 
string getObjLabels (int obj)
 Gets an entry from objective label vector.
 
vector< string > & getObjLabels ()
 Gets all of the objective labels.
 
void setObjLabel (int obj, string label)
 Sets a label in the objectiveLabels vector.
 
void findLabelRedundancies (int obj)
 Finds if a specific label matches any existing labels. More...
 
void nameEmptyLabels ()
 Names objectives according to defaults if given label is empty. More...
 
bool hasProductStructure () const
 Returns whether or not the state has a product structure.
 
const vector< int > & getNumPrivateStates () const
 Returns the numbers of private states.
 
int getNumObjectives () const
 Returns the number of objectives.
 
int getNumStates () const
 Returns the number of states.
 
const vector< int > & getNumActions () const
 Returns a vector of the numbers of actions.
 
const vector< int > & getNumTypes () const
 Returns a vector of the numbers of types.
 
int getNumPlayers () const
 Returns the number of players (always 2)
 

Protected Attributes

int numPlayers
 The number of players, always 2.
 
vector< int > numActions
 The number of action profiles for each player.
 
int numStates
 The number of payoff relevant states.
 
vector< int > numTypes
 The number of private types for each player.
 
int numObjectives
 The number of objective functions. Must be >= 2.
 
bool hasProductStructureData
 Indicates if the state has a product structure. More...
 
vector< int > numPrivateStates
 Number of states for each player. More...
 
vector< string > objectiveLabels
 Labels for the objectives.
 

Detailed Description

The base class for games of incomplete information.

This is a pure virtual base class from which to create classes that represent games of incomplete information. This class is used by the solver class, BCESolver.

To create a game, you derive from this class and reimplement the BCEAbstractGame::prior and BCEAbstractGame::objective methods to return, respectively, the prior distribution over states and types, as well as the objective functions for the players and possible auxiliary objective functions. The user can also reimplement the BCEAbstractGame::dominated method to indicate if there are dominated actions that a given type should never play.

Examples
allpayauction.hpp, duopoly.hpp, fpagame.hpp, fpaunknown.hpp, hybridentryreserve.hpp, and postedprice.hpp.

Constructor & Destructor Documentation

◆ BCEAbstractGame() [1/2]

BCEAbstractGame::BCEAbstractGame ( int  numStatesArg,
int  numActionsArg,
int  numTypesArg,
int  numObjectivesArg 
)

Constructor.

This constructor assumes that all of the players have the same numbers of types and actions.

◆ BCEAbstractGame() [2/2]

BCEAbstractGame::BCEAbstractGame ( int  numStatesArg,
const vector< int > &  numActionsArg,
const vector< int > &  numTypesArg,
int  numObjectivesArg 
)

Constructor.

This constructor allows different players to have different numbers of types and actions.

Member Function Documentation

◆ dominated() [1/2]

bool BCEAbstractGame::dominated ( const vector< int > &  actions,
const vector< int > &  types 
) const

Check if no player's action is dominated.

Utility function that iteratively calls BCESolver::dominated(int,int,int) for each player, and returns false if all of the calls returned false.

◆ dominated() [2/2]

virtual bool BCEAbstractGame::dominated ( int  action,
int  type,
int  player 
) const
inlinevirtual

Indicates if a combination of actions and types is dominated.

If a combination of actions and types is dominated, the algorithm will force the probability of taking that action (given that type) to be zero. This is a virtual method that can be reimplemented. By default, no action is dominated.

Reimplemented in BCEGame.

Examples
fpaunknown.hpp.

◆ feasibleDeviation()

virtual bool BCEAbstractGame::feasibleDeviation ( int  action,
int  dev,
int  type,
int  player 
) const
inlinevirtual

Check if deviation is feasible.

Indicates whether or not it is feasible to deviate from the action to the alternative dev, when the player's type is type. This is a virtual method that can be reimplemented. By default, all deviations are feasible.

Reimplemented in BCEGame.

Examples
fpagame.hpp.

◆ findLabelRedundancies()

void BCEAbstractGame::findLabelRedundancies ( int  obj)

Finds if a specific label matches any existing labels.

If a label matches and existing label, appends an * and checks recursively if the new label is unique.

◆ nameEmptyLabels()

void BCEAbstractGame::nameEmptyLabels ( )

Names objectives according to defaults if given label is empty.

Takes any empty string label and gives it a default name. This default is "Player 0" for the first objective, "Player 1" for the second objective, and "k" for all subsequent objectives.

◆ objective()

virtual double BCEAbstractGame::objective ( int  state,
const vector< int > &  actions,
int  obj 
) const
pure virtual

Objective function.

Maps actions and values into objective functions. The argument objectiveIndex can be any number between 0 and numObjectives-1, inclusive. objective=0 through numPlayers-1 are the payoffs of players 1 through numPlayers, respectively. This is a pure virtual function that must be implemented by the derived class.

Implemented in BCEGame.

Examples
allpayauction.hpp, duopoly.hpp, fpagame.hpp, fpaunknown.hpp, hybridentryreserve.hpp, and postedprice.hpp.

◆ prior() [1/2]

virtual double BCEAbstractGame::prior ( int  state,
const vector< int > &  types 
) const
pure virtual

Prior over state and types.

For each state and vector of types, returns the prior probability of those occuring. This is a pure virtual function that must be implemented by the derived class.

Implemented in BCEGame.

Examples
allpayauction.hpp, duopoly.hpp, fpagame.hpp, fpaunknown.hpp, hybridentryreserve.hpp, and postedprice.hpp.

◆ prior() [2/2]

double BCEAbstractGame::prior ( int  state,
int  type,
int  player 
) const

Marginal prior distribution.

Calculates the marginal joint distribution of a given player's type and the state.

TODO: Have behavior depend on whether or not the state has a product structure.

◆ setNumPrivateStates()

bool BCEAbstractGame::setNumPrivateStates ( const vector< int > &  _numPrivateStates)
inline

Sets the number of private states if the state has a product structure

The products of the number of private states must equal the total number of states. If an argument of vector<double>(2,0) is passed, hasProductStructureData will be set equal to zero.

Examples
fpagame.hpp, and fpaunknown.hpp.

Member Data Documentation

◆ hasProductStructureData

bool BCEAbstractGame::hasProductStructureData
protected

Indicates if the state has a product structure.

If true, the state has a product structure, and each player's payoff only depends on their coordinate.

◆ numPrivateStates

vector<int> BCEAbstractGame::numPrivateStates
protected

Number of states for each player.

If the state has a product structure, this vector indicates how many private values each player has. Should be that the product of the numbers of private values is equal to the total numer of states.


The documentation for this class was generated from the following files: