MultiAgentDecisionProcess
QHybrid Class Reference

QHybrid is a class that represents the QHybrid heuristic. More...

#include <QHybrid.h>

Inheritance diagram for QHybrid:
[legend]

Public Member Functions

void Compute ()
 Compute the heuristic. More...
 
void ComputeWithCachedQValues (bool computeIfNotCached=true)
 Compute Qvalue function, while caching the Qvalues to disk. More...
 
double GetQ (Index jaohI, Index jaI) const
 Returns Q(joint A-O history jaohI, jaI). More...
 
double GetQ (const JointBeliefInterface &b, Index time_step, Index jaI) const
 
void Load (const std::string &filename)
 Load the Qvalues from disk from a file named filename. More...
 
 QHybrid (const PlanningUnitDecPOMDPDiscrete *pu, qheur::Qheur_t QheurTypeFirstTimeSteps, QFunctionJointBeliefInterface *QlastTimeSteps, size_t horizonLastTimeSteps)
 (default) Constructor More...
 
 QHybrid (const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &pu, qheur::Qheur_t QheurTypeFirstTimeSteps, QFunctionJointBeliefInterface *QlastTimeSteps, size_t horizonLastTimeSteps)
 
void Save (const std::string &filename) const
 Stores the Qvalues to disk in file named filename. More...
 
void SetOptimizedHorLast (bool opt)
 
std::string SoftPrintBrief () const
 Returns a short description of the heuristic, can be used for constructing filenames. More...
 
bool StageRepresentedAsTree (Index ts) const
 
virtual ~QHybrid ()
 Destructor. More...
 
- Public Member Functions inherited from QFunctionJAOHInterface
 QFunctionJAOHInterface ()
 
virtual ~QFunctionJAOHInterface ()
 Destructor. More...
 
- Public Member Functions inherited from QFunctionForDecPOMDPInterface
 QFunctionForDecPOMDPInterface ()
 (default) Constructor More...
 
virtual ~QFunctionForDecPOMDPInterface ()
 Destructor. More...
 
- Public Member Functions inherited from QFunctionInterface
virtual void Load ()
 Load the Qvalues from disk. More...
 
virtual void Save () const
 Stores the Qvalues to disk. More...
 
virtual ~QFunctionInterface ()
 
- Public Member Functions inherited from QFunctionForDecPOMDP
virtual std::string GetCacheFilename () const
 Gets the filename where the Qvalues should be stored. More...
 
const
PlanningUnitDecPOMDPDiscrete
GetPU () const
 
 QFunctionForDecPOMDP (const PlanningUnitDecPOMDPDiscrete *pu)
 (default) Constructor More...
 
 QFunctionForDecPOMDP (const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &pu)
 
void SetPU (const PlanningUnitDecPOMDPDiscrete *pu)
 
void SetPU (const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &pu)
 

Private Member Functions

void ComputeQ ()
 This function starts the recursive computing of Qvalues. More...
 
double ComputeRecursively (size_t time_step, LIndex joahI, Index lastJAI)
 Recursively compute the heuristic. More...
 
void DeInitialize ()
 
void Initialize ()
 

Private Attributes

size_t _m_horizonFirstTimeSteps
 
size_t _m_horizonLastTimeSteps
 
bool _m_initialized
 
size_t _m_nrJAOHinFirstTS
 
bool _m_optimizedHorLast
 Whether _m_horizonLastTimeSteps was externally optimized or not. More...
 
qheur::Qheur_t _m_QheurTypeFirstTS
 The type of Qheuristic used for the first time steps. More...
 
QFunctionJointBeliefInterface_m_QlastTimeSteps
 Pointer to QFunction used for the last time steps. More...
 
QTable _m_QValuesFirstTimeSteps
 Table in which the Qvalues are stored for the first time steps. More...
 

Detailed Description

QHybrid is a class that represents the QHybrid heuristic.

It is associated with a PlanningUnitDecPOMDPDiscrete which it uses for things as horizon, action-/observation(history) indices, etc.

Constructor & Destructor Documentation

QHybrid::QHybrid ( const PlanningUnitDecPOMDPDiscrete pu,
qheur::Qheur_t  QheurTypeFirstTimeSteps,
QFunctionJointBeliefInterface QlastTimeSteps,
size_t  horizonLastTimeSteps 
)

(default) Constructor

References QFunctionForDecPOMDP::GetPU().

QHybrid::QHybrid ( const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &  pu,
qheur::Qheur_t  QheurTypeFirstTimeSteps,
QFunctionJointBeliefInterface QlastTimeSteps,
size_t  horizonLastTimeSteps 
)
QHybrid::~QHybrid ( )
virtual

Destructor.

References _m_QlastTimeSteps, and DeInitialize().

Member Function Documentation

void QHybrid::Compute ( )
virtual
void QHybrid::ComputeWithCachedQValues ( bool  computeIfNotCached = true)
virtual

Compute Qvalue function, while caching the Qvalues to disk.

Before computing them, the function checks whether the Qvalues have been computed before, and if so, loads them from disk. If not, it computes them, and afterwards saves them for re-use. This behavior can be changed by settings computeIfNotCached to false, in which case an Exception will be thrown if the Q function has not been previously stored on disk.

Implements QFunctionInterface.

References Compute(), QFunctionForDecPOMDP::GetCacheFilename(), QFunctionInterface::Load(), and QFunctionInterface::Save().

void QHybrid::DeInitialize ( )
private

References _m_initialized, and _m_QValuesFirstTimeSteps.

Referenced by ~QHybrid().

double QHybrid::GetQ ( const JointBeliefInterface b,
Index  time_step,
Index  jaI 
) const
inline
void QHybrid::Save ( const std::string &  filename) const
virtual
void QHybrid::SetOptimizedHorLast ( bool  opt)
inline
string QHybrid::SoftPrintBrief ( ) const
virtual

Returns a short description of the heuristic, can be used for constructing filenames.

Implements QFunctionInterface.

References _m_horizonLastTimeSteps, _m_optimizedHorLast, _m_QheurTypeFirstTS, _m_QlastTimeSteps, PrintTools::SoftPrint(), and QFunctionInterface::SoftPrintBrief().

Referenced by Initialize().

bool QHybrid::StageRepresentedAsTree ( Index  ts) const

Member Data Documentation

size_t QHybrid::_m_horizonFirstTimeSteps
private
size_t QHybrid::_m_horizonLastTimeSteps
private
bool QHybrid::_m_initialized
private
size_t QHybrid::_m_nrJAOHinFirstTS
private
bool QHybrid::_m_optimizedHorLast
private

Whether _m_horizonLastTimeSteps was externally optimized or not.

Referenced by Save(), and SoftPrintBrief().

qheur::Qheur_t QHybrid::_m_QheurTypeFirstTS
private

The type of Qheuristic used for the first time steps.

Referenced by ComputeRecursively(), Initialize(), and SoftPrintBrief().

QFunctionJointBeliefInterface* QHybrid::_m_QlastTimeSteps
private

Pointer to QFunction used for the last time steps.

Referenced by Compute(), ComputeQ(), ComputeRecursively(), GetQ(), Initialize(), Load(), Save(), SoftPrintBrief(), and ~QHybrid().

QTable QHybrid::_m_QValuesFirstTimeSteps
private

Table in which the Qvalues are stored for the first time steps.

Referenced by ComputeQ(), ComputeRecursively(), DeInitialize(), GetQ(), Initialize(), Load(), and Save().