MultiAgentDecisionProcess
MonahanPlanner Class Referenceabstract

MonahanPlanner provides shared functionality for MonahanPOMDPPlanner and MonahanBGPlanner. More...

#include <MonahanPlanner.h>

Inheritance diagram for MonahanPlanner:
[legend]

Public Member Functions

size_t GetNrVectors () const
 Returns the total number of alpha-vectors stored (summed over all time steps). More...
 
double GetQ (Index jaohI, Index jaI) const
 
double GetQ (const JointBeliefInterface &b, Index jaI) const
 
double GetQ (const JointBeliefInterface &b, Index t, Index jaI) const
 
virtual void Initialize ()=0
 
void Load (const std::string &filename)
 
 MonahanPlanner (const PlanningUnitDecPOMDPDiscrete *pu, bool doIncPrune=true)
 (default) Constructor More...
 
 MonahanPlanner (const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &pu, bool doIncPrune=true)
 
virtual void Plan ()
 
virtual void PlanWithCache (const std::string &filenameCache, bool computeIfNotCached=true)
 
void Save (const std::string &filename) const
 
void SetMaxNrAlphas (const std::vector< size_t > &maxNrAlphas)
 
void SetResultsFilename (const std::string &filename)
 
virtual std::string SoftPrintBrief () const =0
 
virtual ~MonahanPlanner ()
 Destructor. More...
 
- Public Member Functions inherited from AlphaVectorPlanning
 AlphaVectorPlanning (const PlanningUnitDecPOMDPDiscrete *pu)
 (default) Constructor More...
 
 AlphaVectorPlanning (const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &pu)
 
 AlphaVectorPlanning (const PlanningUnitFactoredDecPOMDPDiscrete *pu)
 
 AlphaVectorPlanning (const boost::shared_ptr< const PlanningUnitFactoredDecPOMDPDiscrete > &pu)
 
GaoVectorSet BackProject (const ValueFunctionPOMDPDiscrete &v) const
 Back projects a value function. More...
 
GaoVectorSet BackProject (const VectorSet &v) const
 Back projects a value function, represented as a VectorSet. More...
 
VectorSet CrossSum (const VectorSet &A, const VectorSet &B) const
 Compute the cross-sum of two vector sets. More...
 
void ExportPOMDPFile (const std::string &filename) const
 Exports the POMDP to file named filename. More...
 
size_t GetAcceleratedPruningThreshold () const
 
ValueFunctionPOMDPDiscrete GetImmediateRewardValueFunction () const
 Returns the value function induced by the reward model. More...
 
const
PlanningUnitDecPOMDPDiscrete
GetPU () const
 Returns a ref to the PlanningUnit. More...
 
void Initialize ()
 
QFunctionsDiscrete Prune (const QFunctionsDiscrete &Q) const
 Prune a Q-valuefunction. More...
 
ValueFunctionPOMDPDiscrete Prune (const ValueFunctionPOMDPDiscrete &V) const
 Prune a POMDP valuefunction. More...
 
VectorSet Prune (const VectorSet &V) const
 Prune a VectorSet. More...
 
BeliefSet SampleBeliefs (const ArgumentHandlers::Arguments &args) const
 Sample a belief set according to the arguments. More...
 
BeliefSetNonStationary SampleBeliefsNonStationary (const ArgumentHandlers::Arguments &args) const
 Sample a non-stationary belief set according to the arguments. More...
 
BeliefSetNonStationary SampleBeliefsNonStationary (int nrBeliefs=10, int uniqueBeliefs=0, int resetAfter=0, int useQMDPforSamplingBeliefs=0, double QMDPexploreProb=0.1) const
 Sample a non-stationary belief set specifying each argument. More...
 
void SetAcceleratedPruningThreshold (size_t acceleratedPruningThreshold)
 
VectorSet Union (const VectorSet &A, const VectorSet &B) const
 Computes the union of two vector sets. More...
 
QFunctionsDiscrete ValueFunctionToQ (const ValueFunctionPOMDPDiscrete &V) const
 
virtual ~AlphaVectorPlanning ()
 Destructor. More...
 
- Public Member Functions inherited from TimedAlgorithm
void AddTimedEvent (const std::string &id, clock_t duration)
 Adds event of certain duration, e.g., an external program call. More...
 
std::vector< double > GetTimedEventDurations (const std::string &id)
 Returns all stored durations (in s) for a particular event. More...
 
void LoadTimers (const std::string &filename)
 Load timing info from file filename. More...
 
void PrintTimers () const
 Print stored timing info. More...
 
void PrintTimersSummary () const
 Sums data and prints out a summary. More...
 
void SaveTimers (const std::string &filename) const
 Save collected timing info to file filename. More...
 
void SaveTimers (std::ofstream &of) const
 Save collected timing info to ofstream of. More...
 
void StartTimer (const std::string &id) const
 Start to time an event identified by id. More...
 
void StopTimer (const std::string &id) const
 Stop to time an event identified by id. More...
 
 TimedAlgorithm ()
 (default) Constructor More...
 
virtual ~TimedAlgorithm ()
 Destructor. More...
 

Protected Member Functions

virtual QFunctionsDiscrete BackupStage (const QFunctionsDiscrete &Q, size_t maxNrAlphas=0)=0
 Compute a backup stage. More...
 
void CheckMaxNrVectors (size_t maxNrAlphas, size_t nrAlphas) const
 
int GetTimeStep () const
 

Protected Attributes

bool _m_alreadyComputed
 
bool _m_doIncPrune
 
bool _m_initialized
 
std::vector< size_t > _m_maxNrAlphas
 
QFunctionsDiscreteNonStationary _m_qFunction
 
std::string _m_resultsFilename
 

Private Attributes

int _m_timeStep
 

Additional Inherited Members

- Static Public Member Functions inherited from AlphaVectorPlanning
static void CrossSum (const std::vector< AlphaVector > &A, const std::vector< AlphaVector > &B, std::vector< AlphaVector > &output)
 Compute the cross-sum of two vector sets. More...
 
static bool EqualVS (const VectorSet &VS1, const VectorSet &VS2)
 
static void ExportBeliefSet (const BeliefSet &B, const std::string &filename)
 Exports a belief set to a file. More...
 
static void ExportPOMDPFile (const std::string &filename, const DecPOMDPDiscreteInterface *decpomdp)
 Exports the POMDP represented by pu to file named filename. More...
 
static void ExportValueFunction (const std::string &filename, const ValueFunctionPOMDPDiscrete &V, bool includeBGindices=true)
 Exports a value function V to file named filename. More...
 
static void ExportValueFunction (const std::string &filename, const QFunctionsDiscrete &Q, bool includeBGindices=true)
 Exports a Q functions Q to file named filename. More...
 
static void ExportValueFunction (const std::string &filename, const QFunctionsDiscreteNonStationary &Q, bool includeBGindices=true)
 Exports a Q functions Q to file named filename. More...
 
static std::vector< int > GetDuplicateIndices (const VectorSet &V)
 Returns a vector<int> which for each vector k in V specifies whether it is unique, in which case vector<int>[k] is set to -1, or whether it is a duplicate of another vector l in V, in which case vector<int>[k] is set to the index of l, where 0 <= l < V.size()). More...
 
static ValueFunctionPOMDPDiscrete GetImmediateRewardValueFunction (const PlanningUnitDecPOMDPDiscrete *pu)
 Returns the value function induced by the reward model of pu. More...
 
static ValueFunctionPOMDPDiscrete ImportValueFunction (const std::string &filename)
 Imports a value function from a file named filename. More...
 
static
QFunctionsDiscreteNonStationary 
ImportValueFunction (const std::string &filename, size_t nr, size_t nrA, size_t nrS)
 
static ValueFunctionPOMDPDiscrete QFunctionsToValueFunction (const QFunctionsDiscrete &Q)
 Takes all the vectors from the Q-function Q and throws them together as a 'V' function. More...
 
static std::string SoftPrint (const VectorSet &VS)
 
static QFunctionsDiscrete ValueFunctionToQ (const ValueFunctionPOMDPDiscrete &V, size_t nrA, size_t nrS)
 
static VectorSet ValueFunctionToVectorSet (const ValueFunctionPOMDPDiscrete &V)
 
static bool VectorIsDominated (const AlphaVector &alpha, const ValueFunctionPOMDPDiscrete &V)
 
static bool VectorIsDominated (Index i, const VectorSet &V, const std::vector< bool > &vectorsInVtoConsider)
 
static bool VectorIsInValueFunction (const AlphaVector &alpha, const ValueFunctionPOMDPDiscrete &V)
 
static VectorSetVectorOfVectorsToVectorSet (const std::vector< std::vector< double > > &vectors)
 
static ValueFunctionPOMDPDiscrete VectorSetToValueFunction (const VectorSet &VS, Index a=0, AlphaVector::BGPolicyIndex betaI=-1)
 

Detailed Description

MonahanPlanner provides shared functionality for MonahanPOMDPPlanner and MonahanBGPlanner.

Constructor & Destructor Documentation

MonahanPlanner::MonahanPlanner ( const PlanningUnitDecPOMDPDiscrete pu,
bool  doIncPrune = true 
)

(default) Constructor

MonahanPlanner::MonahanPlanner ( const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &  pu,
bool  doIncPrune = true 
)
MonahanPlanner::~MonahanPlanner ( )
virtual

Destructor.

Member Function Documentation

virtual QFunctionsDiscrete MonahanPlanner::BackupStage ( const QFunctionsDiscrete Q,
size_t  maxNrAlphas = 0 
)
protectedpure virtual

Compute a backup stage.

Implemented in QBGPlanner_TreeIncPruneBnB, TreeIncPruneBGPlanner, MonahanPOMDPPlanner, and MonahanBGPlanner.

Referenced by Plan().

void MonahanPlanner::CheckMaxNrVectors ( size_t  maxNrAlphas,
size_t  nrAlphas 
) const
protected
size_t MonahanPlanner::GetNrVectors ( ) const

Returns the total number of alpha-vectors stored (summed over all time steps).

References _m_qFunction.

Referenced by MonahanBGPlanner::BackupStage(), MonahanPOMDPPlanner::BackupStage(), MonahanPOMDPPlanner::MonahanCrossSum(), and Plan().

double MonahanPlanner::GetQ ( const JointBeliefInterface b,
Index  jaI 
) const
double MonahanPlanner::GetQ ( const JointBeliefInterface b,
Index  t,
Index  jaI 
) const
int MonahanPlanner::GetTimeStep ( ) const
inlineprotected
virtual void MonahanPlanner::Initialize ( )
pure virtual
void MonahanPlanner::Load ( const std::string &  filename)
void MonahanPlanner::PlanWithCache ( const std::string &  filenameCache,
bool  computeIfNotCached = true 
)
virtual
void MonahanPlanner::Save ( const std::string &  filename) const
void MonahanPlanner::SetMaxNrAlphas ( const std::vector< size_t > &  maxNrAlphas)
inline
void MonahanPlanner::SetResultsFilename ( const std::string &  filename)

References _m_resultsFilename.

virtual std::string MonahanPlanner::SoftPrintBrief ( ) const
pure virtual

Member Data Documentation

bool MonahanPlanner::_m_alreadyComputed
protected

Referenced by Load(), and Plan().

bool MonahanPlanner::_m_doIncPrune
protected
std::vector<size_t> MonahanPlanner::_m_maxNrAlphas
protected

Referenced by Plan().

std::string MonahanPlanner::_m_resultsFilename
protected

Referenced by Plan(), and SetResultsFilename().

int MonahanPlanner::_m_timeStep
private

Referenced by Plan().