BCESolve
BCEGame Class Reference

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

#include <bcegame.hpp>

Inheritance diagram for BCEGame:
Collaboration diagram for BCEGame:

Public Member Functions

 BCEGame ()
 Default constructor.
 
 BCEGame (const BCEAbstractGame &game)
 Constructor. More...
 
 ~BCEGame ()
 Destructor.
 
double prior (int state, const vector< int > &types) const
 Prior over state and types. More...
 
double prior (int state) const
 Prior over state. More...
 
double prior (int player, int type) const
 Prior over types.
 
double conditional (int state, const vector< int > &types) const
 Conditional distribution of types given states. More...
 
bool setConditional (int state, const vector< int > &types, double value)
 Sets the prior.
 
bool setPrior (int state, double value)
 
double objective (int state, const vector< int > &actions, int obj) const
 Objective function. More...
 
bool setObjective (int state, const vector< int > &actions, int obj, double value)
 Sets the objective.
 
bool dominated (int action, int type, int player) const
 Indicates if a combination of actions and types is dominated. More...
 
void setDominated (int action, int type, int player, bool value)
 Set dominated.
 
bool feasibleDeviation (int action, int dev, int type, int player) const
 Check if deviation is feasible. More...
 
bool setFeasibleDeviation (int action, int dev, int type, int player, bool value)
 Set feasible.
 
bool addObjective (int position, string label)
 Adds a new objective after position.
 
bool removeObjective (int obj)
 Removes the objective obj.
 
bool addState (int position)
 Adds a new state after position.
 
bool removeState (int state)
 Removes state from the game.
 
bool addType (int player, int position)
 Add type for player at position.
 
bool removeType (int player, int type)
 Remove type for player.
 
bool addAction (int player, int position)
 Add action for player at position.
 
bool removeAction (int player, int action)
 Remove action for player.
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialization routine.
 
- Public Member Functions inherited from BCEAbstractGame
 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)
 

Static Public Member Functions

static void save (const BCEGame &game, const char *filename)
 Serialize a BCEGame object using Boost.
 
static void load (BCEGame &game, const char *filename)
 Deserialize a BCEGame object using Boost.
 

Private Attributes

vector< vector< vector< double > > > objectiveData
 Data for the objectives. More...
 
vector< double > priorData
 Data for the prior. More...
 
vector< vector< double > > conditionalData
 Data for conditional distributions of types. More...
 
vector< vector< vector< bool > > > dominatedData
 Data for the dominated array. More...
 
vector< vector< vector< bool > > > feasibleDeviationData
 Data for the feasibleDeviation array. More...
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Protected Attributes inherited from BCEAbstractGame
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 game is derived from BCEAbstractGame and is primarily for the purpose of constructing and serializing games.

Constructor & Destructor Documentation

◆ BCEGame()

BCEGame::BCEGame ( const BCEAbstractGame game)

Constructor.

Copies a BCEAbstractGame into a BCEGame.

Member Function Documentation

◆ conditional()

double BCEGame::conditional ( int  state,
const vector< int > &  types 
) const
inline

Conditional distribution of types given states.

For each state and vector of types, returns the conditional probability of the types given the state.

◆ dominated()

bool BCEGame::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 from BCEAbstractGame.

◆ feasibleDeviation()

bool BCEGame::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 from BCEAbstractGame.

◆ objective()

double BCEGame::objective ( int  state,
const vector< int > &  actions,
int  obj 
) const
inlinevirtual

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.

Implements BCEAbstractGame.

◆ prior() [1/2]

double BCEGame::prior ( int  state) const
inline

Prior over state.

Returns the prior probability of the given state occuring.

◆ prior() [2/2]

double BCEGame::prior ( int  state,
const vector< int > &  types 
) const
inlinevirtual

Prior over state and types.

For each state and vector of types, returns the prior probability of those occuring. Definition of virtual function.

Implements BCEAbstractGame.

Member Data Documentation

◆ conditionalData

vector< vector<double> > BCEGame::conditionalData
private

Data for conditional distributions of types.

Access via conditionalData[state][typeIndex]

◆ dominatedData

vector< vector< vector<bool> > > BCEGame::dominatedData
private

Data for the dominated array.

Access via dominatedData[player][type][action]

◆ feasibleDeviationData

vector< vector< vector<bool> > > BCEGame::feasibleDeviationData
private

Data for the feasibleDeviation array.

Access via feasibleDeviationData[player][type][action + dev*numActions[player]]

◆ objectiveData

vector< vector< vector<double> > > BCEGame::objectiveData
private

Data for the objectives.

Access via objectiveData[obj][state][actionIndex]

◆ priorData

vector<double> BCEGame::priorData
private

Data for the prior.

Access via priorData[state]


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