BCESolve
|
Class for storing data produced by BCESolver. More...
#include <bcesolution.hpp>
Public Member Functions | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialization routine. | |
BCESolution () | |
Default constructor. | |
BCESolution (const BCEGame &game) | |
Constructor. More... | |
~BCESolution () | |
Destructor. | |
void | addEquilibrium (const map< int, double > &distr) |
Appends distr to the end of the list newEquilibria. | |
void | clearEquilibria () |
Clears all equilibria. | |
void | setBoundaryMapped (const bool isMapped) |
Sets boundaryMapped status. | |
void | setMapBoundaryWeights (const vector< vector< double > > &weights) |
Sets mapBoundaryWeights. | |
void | setMainObjectiveWeights (const vector< double > &weights) |
Sets main objective weights. | |
void | consolidateEquilibria () |
Consolidates equilibria. More... | |
const BCEGame & | getGame () const |
Returns the game. | |
const BCEquilibrium & | getEquilibrium (int equilibriumIndex) const |
Returns the equilibrium at equilibriumIndex. | |
void | setCurrentEquilibrium (int equilibriumIndex) |
Set current equilibrium. More... | |
BCESolution & | operator= (const BCESolution &rhs) |
Assignment operator. | |
void | getExpectedObjectives (vector< double > &objectiveValues) const |
Gets the expected objectives under the current BCE. More... | |
void | getExpectedObjectives (vector< vector< double > > &objectiveValues) const |
Gets the expected objectives under all BCE. More... | |
void | getExpectedObjectives (vector< double > &objectiveValues, const map< int, double > &distribution) const |
Calculates expected objectives for the given distribution. | |
double | getDeviationObjectives (int player, int action, int type, vector< vector< double > > &objectiveValues) const |
Calculates deviation objectives. More... | |
double | getConditionalMarginal (const vector< int > &stateConditions, const vector< vector< int > > &actionConditions, const vector< vector< int > > &typeConditions, bool stateMarginal, const vector< bool > &actionMarginal, const vector< bool > &typeMarginal, vector< double > &distribution) const |
Computes the marginal conditional distribution of a BCE. More... | |
const vector< vector< double > > & | getMapBoundaryWeights () const |
Returns the mapBoundary weights. | |
const vector< double > | getMainObjectiveWeights () const |
Returns the main objective weights. | |
const bool | getIsBoundaryMapped () const |
Static Public Member Functions | |
static void | save (const BCESolution &data, const char *filename) |
Serialize a BCESolution object using Boost. | |
static void | load (BCESolution &data, const char *filename) |
Deserialize a BCESolution object using Boost. | |
Private Attributes | |
BCEGame | game |
The game that the equilibria correspond to. | |
list< BCEquilibrium > | newEquilibria |
List of new equilibria that have not yet been consolidated. | |
vector< BCEquilibrium > | equilibria |
Consolidated vector of equilibria. | |
int | currentEquilibrium |
Index of the current equilibrium in BCESolution::equilibria. | |
vector< vector< double > > | mapBoundaryWeights |
Matrix of weights on mapBoundary objectives. More... | |
vector< double > | mainObjectiveWeights |
Vector of weights on the main objective. | |
bool | boundaryMapped |
True if boundary was mapped in the solver. | |
Friends | |
class | boost::serialization::access |
Class for storing data produced by BCESolver.
This class stores Bayes correlated equilibria as output by the BCESolver class. It also contains statistical routines for analyzing the list of equilibria.
The class contains data structures for storing BCE in the BCESolution::equilibria member. It also stores various information about the BCEGame object for which the equilibrium was calculated, in the members BCESolution::objectives, BCESolution::prior, and BCESolution::dominated. These arrays correspond to the methods of the same name in the BCEGame class.
BCESolution also contains methods for calculating statistics of a BCE. In particular, BCESolution::getConditionalMarginal is a general purpose tool for calculating marginal conditional distributions of the BCE, BCESolution::getExpectedObjectives can be used to calculate the expected objectives under the BCE, and BCESolution::getDeviationObjectives can be used to calculate counterfactual payoffs if players had used actions different from their recommendations.
BCESolution::BCESolution | ( | const BCEGame & | game | ) |
Constructor.
Initializes a new BCESolution object for a game with the given numbers of players, states, actions, types, objectives.
void BCESolution::consolidateEquilibria | ( | ) |
Consolidates equilibria.
Appends the list of newEquilibria to the vector equilibria. Clears newEquilibria.
double BCESolution::getConditionalMarginal | ( | const vector< int > & | stateConditions, |
const vector< vector< int > > & | actionConditions, | ||
const vector< vector< int > > & | typeConditions, | ||
bool | stateMarginal, | ||
const vector< bool > & | actionMarginal, | ||
const vector< bool > & | typeMarginal, | ||
vector< double > & | distribution | ||
) | const |
Computes the marginal conditional distribution of a BCE.
A general method for calculating conditional marginal distributions of the current BCE. The state must be equal to an element of stateConditions, action[i] must be an element of actionConditions[i], etc. If the given condition vector is empty, no restriction is imposed. The distribution is projected onto variables with a logical true in Marginal. Returns the probability of the event we are conditioning on. See BCECounter for a description of the conditioning and marginal arguments.
double BCESolution::getDeviationObjectives | ( | int | player, |
int | action, | ||
int | type, | ||
vector< vector< double > > & | objectiveValues | ||
) | const |
Calculates deviation objectives.
Calculates the expected payoff resulting from each action for the given player, type, and recommended action. Returns the probability of the given action.
void BCESolution::getExpectedObjectives | ( | vector< double > & | objectiveValues | ) | const |
Gets the expected objectives under the current BCE.
This method will calculate the expected objectives for the current equilibrium, as specified by BCESolution::currentIndex.
void BCESolution::getExpectedObjectives | ( | vector< vector< double > > & | objectiveValues | ) | const |
Gets the expected objectives under all BCE.
This method will calculate the expected objectives for each of the equilibrium distributions in "equilibria". Optionally can be called with a particular given distribution, which is useful, e.g., for calculating objectives with a conditional distribution.
void BCESolution::setCurrentEquilibrium | ( | int | equilibriumIndex | ) |
Set current equilibrium.
Sets the current equilibrium to the equilibrium with index i. That vector must be an element of the vector equilibria.
|
private |
Matrix of weights on mapBoundary objectives.
The first row, i.e. mapBoundaryWeights[0] contains weights for the main objective, and the second row contains weights for the secondary objective. The number of columns is the number of objectives.