25 #include "sgcommon.hpp"
29 #include "sgexception.hpp"
30 #include "sgsolution_pencilsharpening.hpp"
31 #include "sgnamespace.hpp"
85 vector< list<SGAction_PencilSharpening> >
actions;
165 vector<double> & changes,
167 const vector<double> & maxMovement,
168 const vector<SG::Regime> & maxMovementConstraints);
185 double distance(
int newStart,
int newEnd,
int oldStart,
int oldEnd)
const;
187 double distHelper(
const SGPoint & p,
199 const SGPoint & newDirection)
const;
203 int iter,
int rev,
const SGTuple & tuple,
204 int state,
int action);
265 double generate(
bool storeIteration =
true);
const int numStates
Definition: sgapprox.hpp:61
vector< bool > facingEastNorth
Definition: sgapprox.hpp:70
SGAction_PencilSharpening nullAction
Definition: sgapprox.hpp:114
int newWest
Definition: sgapprox.hpp:119
const vector< SGTuple > & getExtremeTuples() const
Returns the array of extreme tuples.
Definition: sgapprox.hpp:254
int oldWest
Definition: sgapprox.hpp:121
SGApprox(const SGEnv &_env, const SGGame &_game, SGSolution_PencilSharpening &_soln)
Constructor for SGApprox class.
Definition: sgapprox.hpp:208
SG::Regime bestRegime
Definition: sgapprox.hpp:110
vector< const SGAction_PencilSharpening * > actionTuple
Definition: sgapprox.hpp:95
const vector< const SGAction_PencilSharpening * > & getActionTuple() const
Returns the current action tuple.
Definition: sgapprox.hpp:241
Approximation of the equilibrium payoff correspondence.
Definition: sgapprox.hpp:49
SGTuple pivot
Definition: sgapprox.hpp:93
bool sufficiencyFlag
Definition: sgapprox.hpp:77
Describes a stochastic game.
Definition: sggame.hpp:40
void end()
Destructor.
Definition: sgapprox.cpp:24
int getNumIterations() const
Returns the number of iterations thus far.
Definition: sgapprox.hpp:227
bool improves(const SGPoint ¤t, const SGPoint &best, const SGPoint &newDirection) const
Checks whether or not newDirection is shallower than best, relative to current.
Definition: sgapprox.cpp:419
void calculateNewPivot()
Calculates the new pivot.
Definition: sgapprox.cpp:437
double distance(int newStart, int newEnd, int oldStart, int oldEnd) const
Calculates the distance between revolutions.
Definition: sgapprox.cpp:636
int getNumExtremeTuples() const
Returns the number of tuples in the extremeTuples array.
Definition: sgapprox.hpp:231
std::ofstream logfs
Definition: sgapprox.hpp:64
SGTuple threatTuple
Definition: sgapprox.hpp:91
int getNumRevolutions() const
Returns the number of revolutions of the pivot thus far.
Definition: sgapprox.hpp:229
Records the progress of SGSolver::solve().
Definition: sgsolution_pencilsharpening.hpp:41
void updateFlags()
Updates flags before the next iteration.
Definition: sgapprox.cpp:591
int numRevolutions
Definition: sgapprox.hpp:67
double updatePivot(vector< double > &movements, vector< double > &changes, vector< SG::Regime > ®imeTuple, const vector< double > &maxMovement, const vector< SG::Regime > &maxMovementConstraints)
Updates the pivot.
Definition: sgapprox.cpp:541
const SGGame & game
Definition: sgapprox.hpp:53
bool passedNorth() const
Algorithm just passed north.
Definition: sgapprox.hpp:270
const int numPlayers
Definition: sgapprox.hpp:60
vector< SGTuple > extremeTuples
Definition: sgapprox.hpp:89
void trimBindingContinuations()
Trims binding continuation values.
Definition: sgapprox.cpp:773
vector< list< SGAction_PencilSharpening > > actions
Definition: sgapprox.hpp:85
list< SGAction_PencilSharpening >::const_iterator bestAction
Definition: sgapprox.hpp:103
const SGTuple & getPivot() const
Returns the current pivot.
Definition: sgapprox.hpp:247
bool passNorth
Definition: sgapprox.hpp:74
int westPoint
Definition: sgapprox.hpp:116
const double delta
Definition: sgapprox.hpp:58
SGSolution_PencilSharpening & soln
Definition: sgapprox.hpp:55
void calculateBindingContinuations()
Calculates binding continuation values.
Definition: sgapprox.cpp:730
void logAppend(ofstream &logfs, int iter, int rev, const SGTuple &tuple, int state, int action)
Outputs progress to the log file every iteration.
Definition: sgapprox.cpp:103
const SGPoint & getBestDirection() const
Returns the best test direction.
Definition: sgapprox.hpp:239
vector< bool > updatedThreatTuple
Definition: sgapprox.hpp:80
Manages parameters for algorithm behavior.
Definition: sgenv.hpp:35
const SGEnv & env
Definition: sgapprox.hpp:51
SGPoint bestDirection
Definition: sgapprox.hpp:108
double generate(bool storeIteration=true)
Refines the approximation.
Definition: sgapprox.cpp:111
A vector in .
Definition: sgpoint.hpp:35
const SGPoint & getDirection() const
Returns the current direction.
Definition: sgapprox.hpp:245
const SGTuple & getThreatTuple() const
Returns the current threat tuple.
Definition: sgapprox.hpp:249
SG::Regime getBestRegime() const
Definition: sgapprox.hpp:234
Enhanced version of SGBaseAction.
Definition: sgaction_pencilsharpening.hpp:43
const vector< list< SGAction_PencilSharpening > > & getActions() const
Definition: sgapprox.hpp:252
int numIterations
Definition: sgapprox.hpp:66
vector< SG::Regime > regimeTuple
Definition: sgapprox.hpp:99
void findBestDirection()
Calculates the best direction.
Definition: sgapprox.cpp:181
std::string progressString() const
Returns a string indicating the algorithms progress.
Definition: sgapprox.cpp:159
SGPoint currentDirection
Definition: sgapprox.hpp:94
list< SGAction_PencilSharpening >::const_iterator getBestAction() const
Definition: sgapprox.hpp:237
Regime
Indicates which incentive constraints are binding.
Definition: sgnamespace.hpp:160
const vector< SG::Regime > & getRegimeTuple() const
Returns the current regime tuple.
Definition: sgapprox.hpp:243
void initialize()
Prepares the approximation for generation.
Definition: sgapprox.cpp:29
Definition: sgtuple.hpp:52
double errorLevel
Definition: sgapprox.hpp:68
void updateMinPayoffs()
Calculates the minimum IC continuation values.
Definition: sgapprox.cpp:708