SGSolve
SGAction_MaxMinMax Class Reference

Enhanced version of SGBaseAction. More...

#include <sgaction_maxminmax.hpp>

Inheritance diagram for SGAction_MaxMinMax:
Collaboration diagram for SGAction_MaxMinMax:

Public Member Functions

 SGAction_MaxMinMax ()
 Default constructor.
 
 SGAction_MaxMinMax (const SGEnv &_env)
 Constructor. More...
 
 SGAction_MaxMinMax (const SGEnv &_env, int _state, int _action)
 Constructor. More...
 
 SGAction_MaxMinMax (const SGEnv &_env, int _numPlayers, int _state, int _action)
 Constructor. More...
 
void resetTrimmedPoints ()
 Resets the trimmed points for two players. More...
 
void resetTrimmedPoints (const SGPoint &payoffUB)
 Resets the trimmed points for three players. More...
 
void updateTrim ()
 Sets points equal to the trimmed points.
 
double distToTrimmed () const
 Calculates the distance between points and trimmedPoints in the sup norm.
 
bool intersectHalfSpace (const SGPoint &normal, const double level, int player, SGTuple &segment, SGTuple &segmentDirs)
 Intersects the segment with a half space.
 
bool intersectPolygonHalfSpace (const SGPoint &normal, const double level, int player, SGTuple &extPnts, SGTuple &extPntDirs)
 Intersects the IC polygon with a half space.
 
bool trim (const SGPoint &normal, double level)
 Trims the trimmedPoints using intersectRaySegment. More...
 
void mergeDuplicatePoints (const double tol)
 Merges duplicates up to the given tolerance.
 
void calculateMinIC (const SGGame &game, const vector< bool > &update, const SGTuple &threatTuple)
 Calculates the minimum incentive compatible continuation payoff.
 
void calculateMinIC (const SGGame &game, const SGTuple &threatTuple)
 Calculates the minimum incentive compatible continuation payoff.
 
const vector< SGTuple > & getTrimmedPoints () const
 Get method for trimmed points.
 
const vector< SGTuple > & getTrimmedBndryDirs () const
 Get method for trimmed points.
 
const SGPoint getBndryDir (const int player, const int point) const
 Get boundary direction for 3 players. More...
 
bool supportable () const
 
- Public Member Functions inherited from SGBaseAction
 SGBaseAction ()
 Constructor. More...
 
 SGBaseAction (int _state, int _action)
 Constructor. More...
 
 SGBaseAction (int _numPlayers, int _state, int _action)
 Constructor. More...
 
 ~SGBaseAction ()
 Destructor.
 
bool getIsNull () const
 Returns true if the action is null.
 
int getAction () const
 Returns the action.
 
const vector< SGTuple > & getPoints () const
 Returns the points array.
 
const vector< SGTuple > & getBndryDirs () const
 Get method for bndry dirs.
 
const vector< vector< int > > & getTuples () const
 Returns the tuples array.
 
int getState () const
 Returns the state.
 
bool hasCorner () const
 Returns whether or not the action has a corner.
 
const SGPointgetMinICPayoffs () const
 Returns the minimum IC continuation values.
 
const vector< SGTuple > & getBindingContinuations () const
 Returns the array of binding continuation values.
 
void setMinICPayoffs (const SGPoint &newMinIC)
 Sets the minimum IC continuation values.
 
void setTuples (const vector< vector< int > > &newTuples)
 Sets the tuples array.
 
void setPoints (const vector< SGTuple > &newPoints)
 Sets the points array

 
void setPointsAndTuples (const vector< SGTuple > &newPoints, const vector< vector< int > > &newTuples)
 Sets the points and tuples arrays.
 
void setCorner (bool tf)
 Sets the corner indicator. More...
 
bool isCorner (const int p, const int k) const
 Returns whether or not the minimum IC payoff is feasible.
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serializes the action using the boost::serialization library.
 

Static Public Member Functions

static double calculateMinIC (int action, int state, int player, const SGGame &game, const SGTuple &threatTuple)
 Calculates the IC constraint. More...
 

Private Attributes

const SGEnvenv
 
vector< SGTupletrimmedPoints
 
vector< SGTupletrimmedBndryDirs
 

Additional Inherited Members

- Protected Attributes inherited from SGBaseAction
int numPlayers
 
int state
 
int action
 
SGPoint minIC
 
vector< SGTuplepoints
 
vector< SGTuplebndryDirs
 
vector< vector< int > > tuples
 
bool isNull
 
bool corner
 

Detailed Description

Enhanced version of SGBaseAction.

Same functionality as SGBaseAction, but includes additional methods for computing payoffs and a reference to a parent SGEnv object to control parameters for the computation.

This class is used by SGSolver_MaxMinMax to implement the max-min-max algorithm.

Constructor & Destructor Documentation

◆ SGAction_MaxMinMax() [1/3]

SGAction_MaxMinMax::SGAction_MaxMinMax ( const SGEnv _env)
inline

Constructor.

Constructs a null action associated with the given SGEnv.

◆ SGAction_MaxMinMax() [2/3]

SGAction_MaxMinMax::SGAction_MaxMinMax ( const SGEnv _env,
int  _state,
int  _action 
)
inline

Constructor.

Grandfather in old two player code.

◆ SGAction_MaxMinMax() [3/3]

SGAction_MaxMinMax::SGAction_MaxMinMax ( const SGEnv _env,
int  _numPlayers,
int  _state,
int  _action 
)
inline

Constructor.

Constructs an action for the given state and action index in the given environment.

Member Function Documentation

◆ calculateMinIC()

double SGAction_MaxMinMax::calculateMinIC ( int  action,
int  state,
int  player,
const SGGame game,
const SGTuple threatTuple 
)
static

Calculates the IC constraint.

Calculates the minimum incentive compatible expected continuation value for the given action, relative to the given threat tuple and for the given SGGame.

◆ getBndryDir()

const SGPoint SGAction_MaxMinMax::getBndryDir ( const int  player,
const int  point 
) const

Get boundary direction for 3 players.

< Returns the cross product of the boundary directions at the given point, i.e., the direction along an edge of the boundary that points into the feasible and IC region. Only works for three players.

◆ resetTrimmedPoints() [1/2]

void SGAction_MaxMinMax::resetTrimmedPoints ( )

Resets the trimmed points for two players.

< Sets the trimmed points to rays that point from the minimum incentive compatible continuation value along the positive coordinate axes.

◆ resetTrimmedPoints() [2/2]

void SGAction_MaxMinMax::resetTrimmedPoints ( const SGPoint payoffUB)

Resets the trimmed points for three players.

< Sets the trimmed points to a large box in the coordinate plane between the minimum incentive compatible payoff and the payoff upper bound.

◆ trim()

bool SGAction_MaxMinMax::trim ( const SGPoint normal,
double  level 
)

Trims the trimmedPoints using intersectRaySegment.

< Returns true if the action was actually trimmed.

Member Data Documentation

◆ env

const SGEnv* SGAction_MaxMinMax::env
private

Pointer to the parent environment.

◆ trimmedBndryDirs

vector<SGTuple> SGAction_MaxMinMax::trimmedBndryDirs
private

Stores the boundary directions for the trimmed points.

◆ trimmedPoints

vector<SGTuple> SGAction_MaxMinMax::trimmedPoints
private

Stores the "trimmed" points before updating.


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