MultiAgentDecisionProcess
QBGPlanner_TreeIncPruneBnB Class Reference

QBGPlanner_TreeIncPruneBnB computes vector-based QBG functions using tree-based incremental pruning. More...

#include <QBGPlanner_TreeIncPruneBnB.h>

Inheritance diagram for QBGPlanner_TreeIncPruneBnB:
[legend]

Public Member Functions

QFunctionsDiscrete GetQFunctions (size_t horizon)
 
ValueFunctionPOMDPDiscrete GetValueFunction (size_t horizon)
 
 QBGPlanner_TreeIncPruneBnB (const PlanningUnitDecPOMDPDiscrete *pu)
 (default) Constructor More...
 
 QBGPlanner_TreeIncPruneBnB (const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &pu)
 
std::string SoftPrintBrief () const
 
std::string SoftPrintStats () const
 
 ~QBGPlanner_TreeIncPruneBnB ()
 Destructor. More...
 
- Public Member Functions inherited from MonahanBGPlanner
QFunctionsDiscrete GetQFunctions (size_t horizon)
 
ValueFunctionPOMDPDiscrete GetValueFunction (size_t horizon)
 
 MonahanBGPlanner (const PlanningUnitDecPOMDPDiscrete *pu, bool doIncPrune=true)
 (default) Constructor More...
 
 MonahanBGPlanner (const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &pu, bool doIncPrune=true)
 
 ~MonahanBGPlanner ()
 Destructor. More...
 
- Public Member Functions inherited from MonahanPlanner
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
 
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 ~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

bool CheckDomination (const AlphaVector &v, const std::vector< AlphaVector > &vSet)
 
bool CheckDominationLP (const AlphaVector &v, const std::vector< AlphaVector > &vSet)
 
bool CheckDominationPointWise (const AlphaVector &v, const std::vector< AlphaVector > &vSet)
 
bool CheckNotDominatedLP_POMDPSolve (const AlphaVector &v, const std::vector< AlphaVector > &vSet)
 
- Protected Member Functions inherited from MonahanBGPlanner
GaobetaVectorSet ComputeAllGaoa (const ValueFunctionPOMDPDiscrete &V) const
 
VectorSetComputeGaoa (const GaoVectorSet &Gao, const ValueFunctionPOMDPDiscrete &V, Index a, Index o, Index aPrime) const
 This function need V for the following reason: the Gao set does not specify which action (aPrime) is taken at the next stage. More...
 
- Protected Member Functions inherited from MonahanPlanner
void CheckMaxNrVectors (size_t maxNrAlphas, size_t nrAlphas) const
 
int GetTimeStep () const
 

Private Member Functions

virtual QFunctionsDiscrete BackupStage (const QFunctionsDiscrete &Qs, size_t maxNrAlphas=0)
 Compute a backup stage. More...
 
void CrossSumNode (Index a, Index depth, const std::vector< std::vector< Index > > &jpol, std::vector< AlphaVector > &L, std::vector< AlphaVector > &G)
 
std::vector< AlphaVector > * GetGaoa (Index a, const std::vector< Index > &os, const std::vector< Index > &as) const
 
std::vector< AlphaVector > * GetGaoa (Index a, Index o, Index aPrime) const
 
Index GetJointObservationsFromDepth (Index depth) const
 
std::vector< IndexGetObservationsFromDepth (Index depth) const
 
std::vector< ScopeGetValidActions (Index depth, const std::vector< std::vector< Index > > &jpol) const
 
std::vector< ScopeGetValidJointActions (Index depth, const std::vector< std::vector< Index > > &jpol) const
 
void Initialize ()
 
void InitializeHeuristicsForJA (Index ja)
 This initializes H using Gao vectors for ja. More...
 
bool IsDominatedNode (Index depth, std::vector< AlphaVector > &L, std::vector< AlphaVector > &G)
 
std::string SoftPrintJpol (const std::vector< std::vector< Index > > &jpol) const
 
void UnionNode (Index a, Index depth, const std::vector< std::vector< Index > > &jpol, std::vector< AlphaVector > &L, std::vector< AlphaVector > &G)
 

Private Attributes

std::vector< LIndex_m_cs_nodes_at_level
 
boost::multi_array
< std::vector< AlphaVector >, 2 > * 
_m_Gao_storage
 
boost::multi_array
< std::vector< AlphaVector > *, 3 > * 
_m_Gaoa
 
boost::multi_array
< std::vector< AlphaVector >, 3 > * 
_m_Gaoa_storage
 
std::vector< std::vector
< AlphaVector > > 
_m_heuristic_for_depth
 The sets H that represent the heuristic function h. More...
 
Index _m_maxDepth
 
LIndex _m_nodes_visited
 
LIndex _m_nr_backtracks
 
LIndex _m_nr_bottom_hits
 
bool _m_pruneAfterCrossSum
 
bool _m_pruneAfterUnion
 
Timing _m_timing
 
std::vector< LIndex_m_union_nodes_at_level
 
bool _m_useVectorCache
 

Static Private Attributes

static const Index UNSPECIFIED_ACTION =INDEX_MAX
 

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)
 
- Protected Attributes inherited from MonahanPlanner
bool _m_alreadyComputed
 
bool _m_doIncPrune
 
bool _m_initialized
 
std::vector< size_t > _m_maxNrAlphas
 
QFunctionsDiscreteNonStationary _m_qFunction
 
std::string _m_resultsFilename
 

Detailed Description

QBGPlanner_TreeIncPruneBnB computes vector-based QBG functions using tree-based incremental pruning.

Constructor & Destructor Documentation

QBGPlanner_TreeIncPruneBnB::QBGPlanner_TreeIncPruneBnB ( const PlanningUnitDecPOMDPDiscrete pu)

(default) Constructor

QBGPlanner_TreeIncPruneBnB::QBGPlanner_TreeIncPruneBnB ( const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &  pu)
QBGPlanner_TreeIncPruneBnB::~QBGPlanner_TreeIncPruneBnB ( )

Destructor.

References _m_Gao_storage, _m_Gaoa, and _m_Gaoa_storage.

Member Function Documentation

bool QBGPlanner_TreeIncPruneBnB::CheckDomination ( const AlphaVector v,
const std::vector< AlphaVector > &  vSet 
)
protected
bool QBGPlanner_TreeIncPruneBnB::CheckDominationLP ( const AlphaVector v,
const std::vector< AlphaVector > &  vSet 
)
protected
bool QBGPlanner_TreeIncPruneBnB::CheckDominationPointWise ( const AlphaVector v,
const std::vector< AlphaVector > &  vSet 
)
protected
bool QBGPlanner_TreeIncPruneBnB::CheckNotDominatedLP_POMDPSolve ( const AlphaVector v,
const std::vector< AlphaVector > &  vSet 
)
protected

Referenced by CheckDominationLP().

void QBGPlanner_TreeIncPruneBnB::CrossSumNode ( Index  a,
Index  depth,
const std::vector< std::vector< Index > > &  jpol,
std::vector< AlphaVector > &  L,
std::vector< AlphaVector > &  G 
)
private
std::vector< AlphaVector > * QBGPlanner_TreeIncPruneBnB::GetGaoa ( Index  a,
const std::vector< Index > &  os,
const std::vector< Index > &  as 
) const
private
std::vector< AlphaVector > * QBGPlanner_TreeIncPruneBnB::GetGaoa ( Index  a,
Index  o,
Index  aPrime 
) const
private

References _m_Gaoa, and UNSPECIFIED_ACTION.

Index QBGPlanner_TreeIncPruneBnB::GetJointObservationsFromDepth ( Index  depth) const
private
vector< Index > QBGPlanner_TreeIncPruneBnB::GetObservationsFromDepth ( Index  depth) const
private
QFunctionsDiscrete QBGPlanner_TreeIncPruneBnB::GetQFunctions ( size_t  horizon)
inline
vector< Scope > QBGPlanner_TreeIncPruneBnB::GetValidActions ( Index  depth,
const std::vector< std::vector< Index > > &  jpol 
) const
private
vector< Scope > QBGPlanner_TreeIncPruneBnB::GetValidJointActions ( Index  depth,
const std::vector< std::vector< Index > > &  jpol 
) const
private
ValueFunctionPOMDPDiscrete QBGPlanner_TreeIncPruneBnB::GetValueFunction ( size_t  horizon)
void QBGPlanner_TreeIncPruneBnB::InitializeHeuristicsForJA ( Index  ja)
private
bool QBGPlanner_TreeIncPruneBnB::IsDominatedNode ( Index  depth,
std::vector< AlphaVector > &  L,
std::vector< AlphaVector > &  G 
)
private
string QBGPlanner_TreeIncPruneBnB::SoftPrintBrief ( void  ) const
virtual

Reimplemented from MonahanBGPlanner.

string QBGPlanner_TreeIncPruneBnB::SoftPrintJpol ( const std::vector< std::vector< Index > > &  jpol) const
private
string QBGPlanner_TreeIncPruneBnB::SoftPrintStats ( ) const

Referenced by BackupStage().

void QBGPlanner_TreeIncPruneBnB::UnionNode ( Index  a,
Index  depth,
const std::vector< std::vector< Index > > &  jpol,
std::vector< AlphaVector > &  L,
std::vector< AlphaVector > &  G 
)
private

Member Data Documentation

std::vector<LIndex> QBGPlanner_TreeIncPruneBnB::_m_cs_nodes_at_level
private

Referenced by BackupStage().

boost::multi_array< std::vector<AlphaVector>, 2>* QBGPlanner_TreeIncPruneBnB::_m_Gao_storage
private
boost::multi_array< std::vector<AlphaVector>*, 3>* QBGPlanner_TreeIncPruneBnB::_m_Gaoa
private
boost::multi_array< std::vector<AlphaVector>, 3>* QBGPlanner_TreeIncPruneBnB::_m_Gaoa_storage
private
std::vector< std::vector<AlphaVector> > QBGPlanner_TreeIncPruneBnB::_m_heuristic_for_depth
private

The sets H that represent the heuristic function h.

Referenced by InitializeHeuristicsForJA().

Index QBGPlanner_TreeIncPruneBnB::_m_maxDepth
private
LIndex QBGPlanner_TreeIncPruneBnB::_m_nodes_visited
private

Referenced by BackupStage().

LIndex QBGPlanner_TreeIncPruneBnB::_m_nr_backtracks
private

Referenced by BackupStage().

LIndex QBGPlanner_TreeIncPruneBnB::_m_nr_bottom_hits
private

Referenced by BackupStage().

bool QBGPlanner_TreeIncPruneBnB::_m_pruneAfterCrossSum
private
bool QBGPlanner_TreeIncPruneBnB::_m_pruneAfterUnion
private
Timing QBGPlanner_TreeIncPruneBnB::_m_timing
private

Referenced by BackupStage().

std::vector<LIndex> QBGPlanner_TreeIncPruneBnB::_m_union_nodes_at_level
private

Referenced by BackupStage().

bool QBGPlanner_TreeIncPruneBnB::_m_useVectorCache
private
const Index QBGPlanner_TreeIncPruneBnB::UNSPECIFIED_ACTION =INDEX_MAX
staticprivate

Referenced by BackupStage(), and GetGaoa().