SGSolve
|
Describes a stochastic game. More...
#include <sggame.hpp>
Public Member Functions | |
SGGame () | |
Default constructor. | |
SGGame (const SGAbstractGame &game) | |
Converts an SGAbstractGame into a SGGame. More... | |
SGGame (double _delta, int _numStates, const vector< vector< int > > &_numActions, const vector< vector< vector< double > > > &_payoffs, const vector< vector< vector< double > > > &_probabilities) | |
Constructor excluding eqActions. More... | |
SGGame (double _delta, int _numStates, const vector< vector< int > > &_numActions, const vector< vector< vector< double > > > &_payoffs, const vector< vector< vector< double > > > &_probabilities, const vector< bool > &_unconstrained) | |
Constructor customizing unconstrained. | |
SGGame (double _delta, int _numStates, const vector< vector< int > > &_numActions, const vector< vector< vector< double > > > &_payoffs, const vector< vector< vector< double > > > &_probabilities, const vector< vector< bool > > &_eqActions, const vector< bool > &_unconstrained) | |
Constructor customizing equilibrium actions. More... | |
SGGame (int _numPlayers, double _delta, int _numStates, const vector< vector< int > > &_numActions, const vector< vector< vector< double > > > &_payoffs, const vector< vector< vector< double > > > &_probabilities, const vector< vector< bool > > &_eqActions, const vector< bool > &_unconstrained) | |
Constructor with custom numPlayers. More... | |
double | getDelta () const |
Returns SGGame::delta, the discount factor. | |
int | getNumPlayers () const |
Returns SGGame::numPlayers, the number of players. | |
int | getNumStates () const |
Returns the number of states. | |
const vector< vector< int > > & | getNumActions () const |
Sets the argument _numActions equal to SGGame::numActions. | |
const vector< int > & | getNumActions_total () const |
const vector< vector< vector< double > > > & | getProbabilities () const |
Returns a const reference to probabilities. | |
const vector< vector< SGPoint > > & | getPayoffs () const |
Returns a const reference to the payoffs. | |
const vector< vector< bool > > & | getEquilibriumActions () const |
Returns a const reference to the equilibrium actions. | |
void | getPayoffBounds (SGPoint &UB, SGPoint &LB) const |
const vector< bool > & | getConstrained () const |
Returns the unconstrained vector. | |
bool | setDiscountFactor (double newDelta) |
Set discount factor. More... | |
bool | setPayoff (int state, int action, int player, double payoff) |
Set payoffs. More... | |
bool | setProbability (int state, int action, int newState, double prob) |
Set probability. More... | |
bool | setConstrained (const vector< bool > &_unconstrained) |
Sets whether or not players are incentive constrained. | |
bool | addAction (int state, int player, int position) |
Adds a new action. More... | |
bool | removeAction (int state, int player, int action) |
Removes the given action. | |
bool | addState (int position) |
Adds a new state. More... | |
bool | removeState (int state) |
Removes the given state. | |
bool | transitionProbsSumToOne (double tolerance=1e-3) const |
Check if transition probabilities sum to one. | |
bool | profitableDeviation (vector< int > &input, SGGame game) |
Check if there exists a profitable deviation. | |
Static Public Member Functions | |
static void | save (const SGGame &game, const char *filename) |
Static method for saving an SGGame object to the file filename. | |
static void | load (SGGame &game, const char *filename) |
Static method for loading an SGGame object from the file filename. | |
Protected Member Functions | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serializes the game using boost. | |
Protected Attributes | |
double | delta |
int | numPlayers |
int | numStates |
vector< vector< int > > | numActions |
vector< int > | numActions_total |
vector< vector< SGPoint > > | payoffs |
vector< vector< vector< double > > > | probabilities |
vector< vector< bool > > | eqActions |
vector< bool > | unconstrained |
Friends | |
class | boost::serialization::access |
class | SGSolver |
Describes a stochastic game.
This class contains members that describe a stochastic game.
SGGame::SGGame | ( | const SGAbstractGame & | game | ) |
Converts an SGAbstractGame into a SGGame.
The user can derive their own class from SGAbstractGame, and then pass the derived object to the SGGame constructor. This constructor essentially copies the data from the user defined payoffs and probability methods into arrays. Storing this data in arrays provides for faster access by SGApprox and it allows the game to be serialized. See risksharing.hpp and risksharing.cpp for an example.
SGGame::SGGame | ( | double | _delta, |
int | _numStates, | ||
const vector< vector< int > > & | _numActions, | ||
const vector< vector< vector< double > > > & | _payoffs, | ||
const vector< vector< vector< double > > > & | _probabilities | ||
) |
Constructor excluding eqActions.
< Initializes a game object with all actions being permissible.
SGGame::SGGame | ( | double | _delta, |
int | _numStates, | ||
const vector< vector< int > > & | _numActions, | ||
const vector< vector< vector< double > > > & | _payoffs, | ||
const vector< vector< vector< double > > > & | _probabilities, | ||
const vector< vector< bool > > & | _eqActions, | ||
const vector< bool > & | _unconstrained | ||
) |
Constructor customizing equilibrium actions.
< If _eqActions is an empty vector, the constructor will initialize it so that all action profiles are allowed. Otherwise, we restrict attention to equilibria in which action profiles in _eqActions are used.
SGGame::SGGame | ( | int | _numPlayers, |
double | _delta, | ||
int | _numStates, | ||
const vector< vector< int > > & | _numActions, | ||
const vector< vector< vector< double > > > & | _payoffs, | ||
const vector< vector< vector< double > > > & | _probabilities, | ||
const vector< vector< bool > > & | _eqActions, | ||
const vector< bool > & | _unconstrained | ||
) |
Constructor with custom numPlayers.
< All other constructors eventually call this constructor.
bool SGGame::addAction | ( | int | state, |
int | player, | ||
int | position | ||
) |
Adds a new action.
Adds a new action for the given state and player just after the action at index position. The new action has payoffs initialized to zero, and state remains the same with probability 1.
bool SGGame::addState | ( | int | position | ) |
Adds a new state.
Inserts a new state after the index position. The new state has one action for each player with payoffs of zero, and the state is absorbing.
|
inline |
Returns a constant reference to the total number of actions in each state
Sets the arguments equal to tight upper and lower bounds on the payoffs, respectively.
bool SGGame::setDiscountFactor | ( | double | newDelta | ) |
Set discount factor.
Method for setting the discount factor.
bool SGGame::setPayoff | ( | int | state, |
int | action, | ||
int | player, | ||
double | payoff | ||
) |
Set payoffs.
Method for setting payoffs for the given player, action, and state.
bool SGGame::setProbability | ( | int | state, |
int | action, | ||
int | newState, | ||
double | prob | ||
) |
Set probability.
Sets the transition probability from state to newState when action is played.
|
protected |
The discount factor.
|
protected |
Indicates which action profiles are allowed to be played on path in each state. By default, initialized to true for all action profiles. Allows one to, for example, look at strongly symmetric equilibria (by first excluding asymmetric action profiles from the lists). Players can always deviate to action profiles which are not allowed on path.
|
protected |
Gives the number of each player's actions in each state. In particular, player i has numActions[s][i] actions in state s. Should note that a pair (a1,a2) is mapped into an action profile using the formula a=a1+a2*numActions[s][a1], and generalized to n>2.
|
protected |
Total number of action profiles for each state.
|
protected |
The number of players.
|
protected |
The number of states, must be at least 1.
|
protected |
Gives the payoffs of the players as a function of the action profile. In particular, payoffs[s][a][i] are player i's payoffs in state s when action profile a is played.
|
protected |
State transition probabilities: probabilities[s][a][s'] is the probability of transitioning to state s' when action profile a is played in state s.
|
protected |
If unconstrained[i]=true, the algorithm will not impose incentive compatibility as a constraint for player i.