SGSolve
|
Class for solving stochastic games. More...
#include <sgsolver_maxminmax.hpp>
Public Member Functions | |
SGSolver_MaxMinMax () | |
Default constructor. | |
SGSolver_MaxMinMax (const SGEnv &_env, const SGGame &_game) | |
Constructor. More... | |
~SGSolver_MaxMinMax () | |
Destructor. | |
void | solve_fixed () |
Solve routine. More... | |
void | solve () |
Solve routine. More... | |
double | iterate () |
One iteration of the endogenous algorith. More... | |
double | pseudoHausdorff (const list< SGPoint > &newDirections, const list< vector< double > > &newLevels) const |
Compute approximate Hausdorff distance. | |
void | initialize () |
Initializes the solve routines. | |
std::string | progressString () const |
void | robustOptimizePolicy (SGTuple &pivot, vector< double > &penalties, vector< SGActionIter > &actionTuple, vector< SG::Regime > ®imeTuple, vector< bool > &bestAPSNotBinding, SGTuple &bestBindingPayoffs, const SGPoint currDir, const vector< list< SGAction_MaxMinMax > > &actions) const |
Optimizes the policy for the given direction. | |
double | sensitivity (const SGTuple &pivot, const vector< double > &penalties, const vector< SGActionIter > &actionTuple, const vector< SG::Regime > ®imeTuple, const SGPoint currDir, const vector< list< SGAction_MaxMinMax > > &actions) const |
void | policyToPayoffs (SGTuple &pivot, const vector< SGActionIter > &actionTuple, const vector< SG::Regime > ®imeTuple) const |
Converts a policy function to a payoff function using bellman iteration. | |
void | policyToPenalties (vector< double > &penalties, const vector< SGActionIter > &actionTuple, const vector< SG::Regime > ®imeTuple) const |
bool | lexComp (const SGPoint &a, const double aPenalty, const SGPoint &b, const double bPenalty, const SGPoint &dir) const |
Lexicographic comparison of points. More... | |
bool | computeBestBindingPayoff (const SGActionIter ait, int &bestBindingPlayer, int &bestBindingPoint, const SGPoint &dir) const |
Computes the best binding payoff for an action. | |
void | updateBestBinding (const vector< SGActionIter > &actionTuple, const vector< SG::Regime > ®imeTuple, const SGPoint &dir, SGTuple &bestBindingPayoffs, vector< bool > &bestAPSNotBinding) const |
Update best binding payoffs and check if best APS is binding. | |
void | minimizeRegimes (SGTuple &pivot, vector< double > &penalties, const vector< SGActionIter > &actionTuple, vector< SG::Regime > ®imeTuple, const SGPoint &dir, const SGTuple &bestBindingPayoffs, const vector< bool > &bestAPSNotBinding) const |
Switches regimes from binding to non-binding to minimize levels. | |
bool | lexAbove (const SGPoint &a, const SGPoint &b) const |
Lexicographic comparison of directions. More... | |
const SGSolution_MaxMinMax & | getSolution () const |
Private Attributes | |
const SGEnv & | env |
SGEnv object to hold parameters. | |
const SGGame & | game |
Constant reference to the game to be solved. | |
SGSolution_MaxMinMax | soln |
SGSolution object used by SGApprox to store data. | |
const double | delta |
const int | numPlayers |
const int | numStates |
const vector< vector< bool > > & | eqActions |
const vector< vector< SGPoint > > & | payoffs |
const vector< vector< vector< double > > > & | probabilities |
const vector< vector< int > > | numActions |
const vector< int > | numActions_totalByState |
list< SGPoint > | directions |
list< vector< double > > | levels |
SGTuple | threatTuple |
vector< list< SGAction_MaxMinMax > > | actions |
const SGPoint | dueEast = SGPoint(1.0,0.0) |
const SGPoint | dueNorth = SGPoint(0.0,1.0) |
int | numIter |
double | errorLevel |
Class for solving stochastic games.
This class implements the max-min-max algorithm of Abreu, Brooks, and Sannikov (2019) for two players. It contains the parameters for the algorithm, the solve method, as well as the data structure produced by solve. It calculates the equilibrium payoff correspondence corresponding to an SGGame object.
Constructor.
Creates a new SGSolver_MaxMinMax object and initializes it with the given game.
|
inline |
Returns a constant reference to the SGSolution_MaxMinMax object storing the output of the computation.
double SGSolver_MaxMinMax::iterate | ( | ) |
One iteration of the endogenous algorith.
Return the new error level.
Lexicographic comparison of directions.
Returns true if a is above b or a is parallel to b.
bool SGSolver_MaxMinMax::lexComp | ( | const SGPoint & | a, |
const double | aPenalty, | ||
const SGPoint & | b, | ||
const double | bPenalty, | ||
const SGPoint & | dir | ||
) | const |
Lexicographic comparison of points.
Returns true if a is above b in the direction dir, or if they are at the same level but a is higher than b in the direction dir rotated 90 degrees clockwise.
void SGSolver_MaxMinMax::policyToPenalties | ( | vector< double > & | penalties, |
const vector< SGActionIter > & | actionTuple, | ||
const vector< SG::Regime > & | regimeTuple | ||
) | const |
Converts a policy function to the associated penalties using bellman iteration, when computing inner approximation
double SGSolver_MaxMinMax::sensitivity | ( | const SGTuple & | pivot, |
const vector< double > & | penalties, | ||
const vector< SGActionIter > & | actionTuple, | ||
const vector< SG::Regime > & | regimeTuple, | ||
const SGPoint | currDir, | ||
const vector< list< SGAction_MaxMinMax > > & | actions | ||
) | const |
Find the next clockwise direction at which the optimal tuple changes
void SGSolver_MaxMinMax::solve | ( | ) |
Solve routine.
Initializes a new SGApproximation object and iteratively generates it until one of the stopping criteria have been met. Stores progress in the data member.
Generates directions endogenously.
void SGSolver_MaxMinMax::solve_fixed | ( | ) |
Solve routine.
Initializes a new SGApproximation object and iteratively generates it until one of the stopping criteria have been met. Stores progress in the data member.
Fixed directions.
|
private |
Actions that can still be played.
|
private |
The discount factor, copied from SGApprox_V2::game.
|
private |
List of directions in which the algorithm bounds payoffs.
|
private |
Constant refernece to actions that are allowed to be played in equilibrium in the game.
|
private |
The current error level.
|
private |
List of optimal levels attained in the corresponding directions.
|
private |
Number of actions in the game.
|
private |
Total number of actions in each state.
|
private |
The number of iterations computed thus far.
|
private |
The number of players, always 2.
|
private |
The number of states, copied from SGApprox_V2::game.
|
private |
Constant reference to payoffs in the game.
|
private |
Constant reference to transition probabilities in the game.
|
private |
The current threat payoffs.