SGSolve
SGSolver_MaxMinMax_3Player Class Reference

Class for solving stochastic games. More...

#include <sgsolver_maxminmax_3player.hpp>

Collaboration diagram for SGSolver_MaxMinMax_3Player:

Public Member Functions

 SGSolver_MaxMinMax_3Player ()
 Default constructor.
 
 SGSolver_MaxMinMax_3Player (const SGEnv &_env, const SGGame &_game)
 Constructor. More...
 
 ~SGSolver_MaxMinMax_3Player ()
 Destructor.
 
void solve (const int numDirsApprox=200, const bool dropRedundant=true, const bool addEndogenous=true)
 Fixed direction solve routine. More...
 
void solve_endogenous ()
 Endogenous direction solve routine. More...
 
double iterate_endogenous ()
 One iteration of the endogenous algorithm. More...
 
double iterate (const int maxDirections, const bool dropRedundant, const bool addEndogenous)
 One iteration of the algorithm. More...
 
void initialize ()
 Initializes the solve routines.
 
std::string progressString () const
 
void optimizePolicy (SGTuple &pivot, vector< SGActionIter > &actionTuple, vector< SG::Regime > &regimeTuple, const SGPoint &currDir, const vector< list< SGAction_MaxMinMax > > &actions) const
 Optimizes the policy for the given direction.
 
bool computeOptimalPolicies (SGProductPolicy &optPolicies, const SGTuple &pivot, const SGPoint &currDir, const vector< list< SGAction_MaxMinMax > > &actions) const
 
double sensitivity (SGPoint &optSubDir, const SGTuple &pivot, const SGPoint &currDir, const SGPoint &newDir, 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.
 
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
 
list< SGPointthreatDirections
 
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
 
SGPoint payoffLB
 
SGPoint payoffUB
 
int numRedundDirs
 
int numEndogDirs
 
bool debugMode
 

Detailed Description

Class for solving stochastic games.

This class implements the max-min-max algorithm of Abreu, Brooks, and Sannikov (2019) for three 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 & Destructor Documentation

◆ SGSolver_MaxMinMax_3Player()

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

Constructor.

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

Member Function Documentation

◆ computeOptimalPolicies()

bool SGSolver_MaxMinMax_3Player::computeOptimalPolicies ( SGProductPolicy optPolicies,
const SGTuple pivot,
const SGPoint currDir,
const vector< list< SGAction_MaxMinMax > > &  actions 
) const

Compute all policies that are at least as high as the given pivot. Returns false if there is a strict improvement, and true otherwise. Will short circuit if it finds a strict improvement.

◆ getSolution()

const SGSolution_MaxMinMax& SGSolver_MaxMinMax_3Player::getSolution ( ) const
inline

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

◆ iterate()

double SGSolver_MaxMinMax_3Player::iterate ( const int  maxDirections,
const bool  dropRedundant,
const bool  addEndogenous 
)

One iteration of the algorithm.

Return the new error level.

◆ iterate_endogenous()

double SGSolver_MaxMinMax_3Player::iterate_endogenous ( )

One iteration of the endogenous algorithm.

Return the new error level.

◆ sensitivity()

double SGSolver_MaxMinMax_3Player::sensitivity ( SGPoint optSubDir,
const SGTuple pivot,
const SGPoint currDir,
const SGPoint newDir,
const vector< list< SGAction_MaxMinMax > > &  actions 
) const

Find the next clockwise direction at which the optimal tuple changes

◆ solve()

void SGSolver_MaxMinMax_3Player::solve ( const int  numDirsApprox = 200,
const bool  dropRedundant = true,
const bool  addEndogenous = true 
)

Fixed direction 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.

Drops redundant directions and adds new face directions.

◆ solve_endogenous()

void SGSolver_MaxMinMax_3Player::solve_endogenous ( )

Endogenous direction 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.

Member Data Documentation

◆ actions

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

Actions that can still be played.

◆ debugMode

bool SGSolver_MaxMinMax_3Player::debugMode
private

Indicator for whether the program is being debugged.

◆ delta

const double SGSolver_MaxMinMax_3Player::delta
private

The discount factor, copied from SGApprox_V2::game.

◆ directions

list<SGPoint> SGSolver_MaxMinMax_3Player::directions
private

List of directions in which the algorithm bounds payoffs.

◆ dueEast

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

The direction due east.

◆ dueNorth

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

The direction due north.

◆ eqActions

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

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

◆ errorLevel

double SGSolver_MaxMinMax_3Player::errorLevel
private

The current error level.

◆ levels

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

List of optimal levels attained in the corresponding directions.

◆ numActions

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

Number of actions in the game.

◆ numActions_totalByState

const vector< int > SGSolver_MaxMinMax_3Player::numActions_totalByState
private

Total number of actions in each state.

◆ numEndogDirs

int SGSolver_MaxMinMax_3Player::numEndogDirs
private

Number of endogenous directions added so far.

◆ numIter

int SGSolver_MaxMinMax_3Player::numIter
private

The number of iterations computed thus far.

◆ numPlayers

const int SGSolver_MaxMinMax_3Player::numPlayers
private

The number of players, always 2.

◆ numRedundDirs

int SGSolver_MaxMinMax_3Player::numRedundDirs
private

Number of redundant directions dropped so far.

◆ numStates

const int SGSolver_MaxMinMax_3Player::numStates
private

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

◆ payoffLB

SGPoint SGSolver_MaxMinMax_3Player::payoffLB
private

Lower bound on payoffs across all states and actions.

◆ payoffs

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

Constant reference to payoffs in the game.

◆ payoffUB

SGPoint SGSolver_MaxMinMax_3Player::payoffUB
private

Upper bound on payoffs across all states and actions.

◆ probabilities

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

Constant reference to transition probabilities in the game.

◆ threatTuple

SGTuple SGSolver_MaxMinMax_3Player::threatTuple
private

The current threat payoffs.


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