SGSolve
SGSolver_MaxMinMax Class Reference

Class for solving stochastic games. More...

#include <sgsolver_maxminmax.hpp>

Collaboration diagram for SGSolver_MaxMinMax:

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 > &regimeTuple, 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 > &regimeTuple, const SGPoint currDir, const vector< list< SGAction_MaxMinMax > > &actions) const
 
void policyToPayoffs (SGTuple &pivot, const vector< SGActionIter > &actionTuple, const vector< SG::Regime > &regimeTuple) 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 > &regimeTuple) 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 > &regimeTuple, 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 > &regimeTuple, 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_MaxMinMaxgetSolution () const
 

Private Attributes

const SGEnvenv
 SGEnv object to hold parameters.
 
const SGGamegame
 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< SGPointdirections
 
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
 

Detailed Description

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.

Examples
pd_twostate.cpp, and risksharing_maxminmax.cpp.

Constructor & Destructor Documentation

◆ SGSolver_MaxMinMax()

SGSolver_MaxMinMax::SGSolver_MaxMinMax ( const SGEnv _env,
const SGGame _game 
)

Constructor.

Creates a new SGSolver_MaxMinMax object and initializes it with the given game.

Member Function Documentation

◆ getSolution()

const SGSolution_MaxMinMax& SGSolver_MaxMinMax::getSolution ( ) const
inline

Returns a constant reference to the SGSolution_MaxMinMax object storing the output of the computation.

Examples
pd_twostate.cpp.

◆ iterate()

double SGSolver_MaxMinMax::iterate ( )

One iteration of the endogenous algorith.

Return the new error level.

◆ lexAbove()

bool SGSolver_MaxMinMax::lexAbove ( const SGPoint a,
const SGPoint b 
) const

Lexicographic comparison of directions.

Returns true if a is above b or a is parallel to b.

◆ lexComp()

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.

◆ policyToPenalties()

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

◆ sensitivity()

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

◆ solve()

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.

Examples
pd_twostate.cpp.

◆ solve_fixed()

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.

Member Data Documentation

◆ actions

vector< list<SGAction_MaxMinMax> > SGSolver_MaxMinMax::actions
private

Actions that can still be played.

◆ delta

const double SGSolver_MaxMinMax::delta
private

The discount factor, copied from SGApprox_V2::game.

◆ directions

list<SGPoint> SGSolver_MaxMinMax::directions
private

List of directions in which the algorithm bounds payoffs.

◆ dueEast

const SGPoint SGSolver_MaxMinMax::dueEast = SGPoint(1.0,0.0)
private

The direction due east.

◆ dueNorth

const SGPoint SGSolver_MaxMinMax::dueNorth = SGPoint(0.0,1.0)
private

The direction due north.

◆ eqActions

const vector< vector<bool> >& SGSolver_MaxMinMax::eqActions
private

Constant refernece to actions that are allowed to be played in equilibrium in the game.

◆ errorLevel

double SGSolver_MaxMinMax::errorLevel
private

The current error level.

◆ levels

list< vector<double> > SGSolver_MaxMinMax::levels
private

List of optimal levels attained in the corresponding directions.

◆ numActions

const vector< vector<int> > SGSolver_MaxMinMax::numActions
private

Number of actions in the game.

◆ numActions_totalByState

const vector< int > SGSolver_MaxMinMax::numActions_totalByState
private

Total number of actions in each state.

◆ numIter

int SGSolver_MaxMinMax::numIter
private

The number of iterations computed thus far.

◆ numPlayers

const int SGSolver_MaxMinMax::numPlayers
private

The number of players, always 2.

◆ numStates

const int SGSolver_MaxMinMax::numStates
private

The number of states, copied from SGApprox_V2::game.

◆ payoffs

const vector< vector<SGPoint> >& SGSolver_MaxMinMax::payoffs
private

Constant reference to payoffs in the game.

◆ probabilities

const vector< vector< vector<double> > >& SGSolver_MaxMinMax::probabilities
private

Constant reference to transition probabilities in the game.

◆ threatTuple

SGTuple SGSolver_MaxMinMax::threatTuple
private

The current threat payoffs.


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