MultiAgentDecisionProcess
|
QHybrid is a class that represents the QHybrid heuristic. More...
#include <QHybrid.h>
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... | |
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.
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 | ||
) |
References QFunctionForDecPOMDP::GetPU().
|
virtual |
Destructor.
References _m_QlastTimeSteps, and DeInitialize().
|
virtual |
Compute the heuristic.
Implements QFunctionInterface.
References _m_initialized, _m_QlastTimeSteps, QFunctionInterface::Compute(), ComputeQ(), and Initialize().
Referenced by ComputeWithCachedQValues().
|
private |
This function starts the recursive computing of Qvalues.
References _m_horizonLastTimeSteps, _m_QlastTimeSteps, _m_QValuesFirstTimeSteps, ComputeRecursively(), PlanningUnitDecPOMDPDiscrete::GetDiscount(), BeliefInterface::GetIterator(), PlanningUnitMADPDiscrete::GetNewJointBeliefFromISD(), PlanningUnitMADPDiscrete::GetNrJointActions(), BeliefIteratorGeneric::GetProbability(), QFunctionForDecPOMDP::GetPU(), QFunctionJointBeliefInterface::GetQ(), PlanningUnitDecPOMDPDiscrete::GetReward(), BeliefIteratorGeneric::GetStateIndex(), Globals::INITIAL_JAOHI, and BeliefIteratorGeneric::Next().
Referenced by Compute().
Recursively compute the heuristic.
This is called by Compute().
References _m_horizonFirstTimeSteps, _m_nrJAOHinFirstTS, _m_QheurTypeFirstTS, _m_QlastTimeSteps, _m_QValuesFirstTimeSteps, Globals::CastLIndexToIndex(), BGIP_BnB::DescendingProbability, qheur::eQBG, qheur::eQPOMDP, PlanningUnitDecPOMDPDiscrete::GetDiscount(), BeliefInterface::GetIterator(), PlanningUnitMADPDiscrete::GetJAOHProbGivenPred(), PlanningUnitMADPDiscrete::GetJointBeliefInterface(), PlanningUnitMADPDiscrete::GetNrJointActions(), PlanningUnitMADPDiscrete::GetNrJointObservations(), BeliefIteratorGeneric::GetProbability(), QFunctionForDecPOMDP::GetPU(), QFunctionJointBeliefInterface::GetQ(), PlanningUnitDecPOMDPDiscrete::GetReward(), BeliefIteratorGeneric::GetStateIndex(), BeliefIteratorGeneric::Next(), Globals::PROB_PRECISION, and BGIP_SolverBruteForceSearch< JP >::Solve().
Referenced by ComputeQ().
|
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().
|
private |
References _m_initialized, and _m_QValuesFirstTimeSteps.
Referenced by ~QHybrid().
Returns Q(joint A-O history jaohI, jaI).
Implements QFunctionJAOHInterface.
References _m_horizonFirstTimeSteps, _m_nrJAOHinFirstTS, _m_QlastTimeSteps, _m_QValuesFirstTimeSteps, PlanningUnitMADPDiscrete::GetJAOHProb(), PlanningUnitMADPDiscrete::GetJointBeliefInterface(), QFunctionForDecPOMDP::GetPU(), QFunctionJointBeliefInterface::GetQ(), and PlanningUnitMADPDiscrete::GetTimeStepForJAOHI().
Referenced by BayesianGameWithClusterInfo::Extend().
|
inline |
References QFunctionJointBeliefInterface::GetQ().
|
private |
References _m_horizonFirstTimeSteps, _m_horizonLastTimeSteps, _m_initialized, _m_nrJAOHinFirstTS, _m_QheurTypeFirstTS, _m_QlastTimeSteps, _m_QValuesFirstTimeSteps, qheur::eQBG, qheur::eQPOMDP, PlanningUnitMADPDiscrete::GetNrActionHistories(), PlanningUnitMADPDiscrete::GetNrAgents(), PlanningUnitMADPDiscrete::GetNrObservationHistories(), QFunctionForDecPOMDP::GetPU(), QTable::SetToZero(), and SoftPrintBrief().
|
virtual |
Load the Qvalues from disk from a file named filename.
Implements QFunctionInterface.
References _m_horizonLastTimeSteps, _m_initialized, _m_nrJAOHinFirstTS, _m_QlastTimeSteps, _m_QValuesFirstTimeSteps, PlanningUnitMADPDiscrete::GetNrJointActions(), QFunctionForDecPOMDP::GetPU(), Initialize(), QFunctionInterface::Load(), QTable::Load(), and SetOptimizedHorLast().
|
virtual |
Stores the Qvalues to disk in file named filename.
Implements QFunctionInterface.
References _m_horizonLastTimeSteps, _m_optimizedHorLast, _m_QlastTimeSteps, _m_QValuesFirstTimeSteps, QFunctionInterface::Save(), and QTable::Save().
|
inline |
Referenced by ArgumentUtils::GetHybridQheuristicFromArgs(), and Load().
|
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 |
References _m_horizonFirstTimeSteps.
Referenced by BayesianGameWithClusterInfo::Extend().
|
private |
Referenced by ComputeRecursively(), GetQ(), Initialize(), and StageRepresentedAsTree().
|
private |
Referenced by ComputeQ(), Initialize(), Load(), Save(), and SoftPrintBrief().
|
private |
Referenced by Compute(), DeInitialize(), Initialize(), and Load().
|
private |
Referenced by ComputeRecursively(), GetQ(), Initialize(), and Load().
|
private |
Whether _m_horizonLastTimeSteps was externally optimized or not.
Referenced by Save(), and SoftPrintBrief().
|
private |
The type of Qheuristic used for the first time steps.
Referenced by ComputeRecursively(), Initialize(), and SoftPrintBrief().
|
private |
Pointer to QFunction used for the last time steps.
Referenced by Compute(), ComputeQ(), ComputeRecursively(), GetQ(), Initialize(), Load(), Save(), SoftPrintBrief(), and ~QHybrid().
|
private |
Table in which the Qvalues are stored for the first time steps.
Referenced by ComputeQ(), ComputeRecursively(), DeInitialize(), GetQ(), Initialize(), Load(), and Save().