MultiAgentDecisionProcess
|
Perseus contains basic functionality for the Perseus planner. More...
#include <Perseus.h>
Public Member Functions | |
bool | CheckConvergence (const std::vector< double > &VB, const std::vector< double > &VBnew, int iter) const |
virtual void | ExportValueFunction (const std::string &filename) const =0 |
Exports the computed value function in a simple text format used by Tony Cassandra for .alpha files. More... | |
std::string | GetIdentification () const |
virtual double | GetQ (const JointBeliefInterface &b, Index jaI) const =0 |
virtual double | GetQ (const JointBeliefInterface &b, Index jaI, AlphaVector::BGPolicyIndex &betaMaxI) const =0 |
virtual double | GetQ (const JointBeliefInterface &b, Index t, Index jaI) const =0 |
virtual double | GetQ (const JointBeliefInterface &b, Index t, Index jaI, AlphaVector::BGPolicyIndex &betaMaxI) const =0 |
int | GetVerbose () const |
void | Initialize () |
Perseus (const PlanningUnitDecPOMDPDiscrete *pu) | |
(default) Constructor More... | |
Perseus (const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > &pu) | |
Perseus (const PlanningUnitFactoredDecPOMDPDiscrete *pu) | |
Perseus (const boost::shared_ptr< const PlanningUnitFactoredDecPOMDPDiscrete > &pu) | |
virtual void | Plan ()=0 |
int | SampleNotImprovedBeliefIndex (std::vector< bool > stillNeedToBeImproved, int nrNotImproved) const |
Sample an index of a belief in the set which has not been improved. More... | |
void | SetComputeVectorForEachBelief (bool compute) |
void | SetDryrun (bool dryrun) |
void | SetIdentification (const std::string &identification) |
void | SetInitializeWithImmediateReward (bool initReward) |
void | SetInitializeWithZero (bool initZero) |
void | SetMaximumNumberOfIterations (int nr) |
void | SetMinimumNumberOfIterations (int nr) |
void | SetResultsFilename (const std::string &filename) |
void | SetSaveIntermediateValueFunctions (bool save) |
void | SetSaveTimings (bool save) |
virtual void | SetValueFunction (const std::string &filename)=0 |
void | SetVerbose (int verbose) |
virtual | ~Perseus () |
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... | |
Static Public Member Functions | |
static std::string | BackupTypeToString (const QAVParameters ¶ms) |
static QAVParameters | ProcessArguments (const ArgumentHandlers::Arguments &args) |
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 VectorSet * | VectorOfVectorsToVectorSet (const std::vector< std::vector< double > > &vectors) |
static ValueFunctionPOMDPDiscrete | VectorSetToValueFunction (const VectorSet &VS, Index a=0, AlphaVector::BGPolicyIndex betaI=-1) |
Protected Attributes | |
bool | _m_beliefsInitialized |
Whether or not the belief set has been set. More... | |
double | _m_bestValue |
bool | _m_computeVectorForEachBelief |
bool | _m_dryrun |
std::string | _m_identification |
std::string | _m_resultsFilename |
bool | _m_storeIntermediateValueFunctions |
bool | _m_storeTimings |
std::string | _m_valueFunctionFilename |
Private Member Functions | |
size_t | GetSize (const ValueFunctionPOMDPDiscrete &V) const |
size_t | GetSize (const QFunctionsDiscrete &Q) const |
size_t | GetSize (const QFunctionsDiscreteNonStationary &Q) const |
Private Attributes | |
bool | _m_initializeWithImmediateReward |
bool | _m_initializeWithZero |
int | _m_maximumNumberOfIterations |
int | _m_minimumNumberOfIterations |
int | _m_verbose |
Perseus::Perseus | ( | const PlanningUnitDecPOMDPDiscrete * | pu | ) |
(default) Constructor
References SetMaximumNumberOfIterations(), SetMinimumNumberOfIterations(), and UpdateValueFunctionName().
Perseus::Perseus | ( | const boost::shared_ptr< const PlanningUnitDecPOMDPDiscrete > & | pu | ) |
Perseus::Perseus | ( | const PlanningUnitFactoredDecPOMDPDiscrete * | pu | ) |
Perseus::Perseus | ( | const boost::shared_ptr< const PlanningUnitFactoredDecPOMDPDiscrete > & | pu | ) |
|
virtual |
Destructor.
|
protected |
References AlphaVectorPlanning::BackProject(), GetIdentification(), and TimedAlgorithm::StartTimer().
Referenced by PerseusPOMDPPlanner::BackupStage(), PerseusConstrainedPOMDPPlanner::BackupStage(), PerseusBGPOMDPPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageAll(), PerseusBGPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageSampling(), PerseusBGPlanner::BackupStageSampling(), PerseusBGPOMDPPlanner::BackupStageSamplingAlt(), and PerseusBGPlanner::BackupStageSamplingAlt().
|
protected |
References GetIdentification(), PlanningUnitMADPDiscrete::GetNrJointActions(), PlanningUnitMADPDiscrete::GetNrJointObservations(), AlphaVectorPlanning::GetPU(), and TimedAlgorithm::StopTimer().
Referenced by PerseusPOMDPPlanner::BackupStage(), PerseusConstrainedPOMDPPlanner::BackupStage(), PerseusBGPOMDPPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageAll(), PerseusBGPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageSampling(), PerseusBGPlanner::BackupStageSampling(), PerseusBGPOMDPPlanner::BackupStageSamplingAlt(), and PerseusBGPlanner::BackupStageSamplingAlt().
|
static |
References QAVParameters::backup, BG, QAVParameters::bgBackupType, EVENT_POMDP, FACTORED_POMDP, and POMDP.
bool Perseus::CheckConvergence | ( | const std::vector< double > & | VB, |
const std::vector< double > & | VBnew, | ||
int | iter | ||
) | const |
|
pure virtual |
Exports the computed value function in a simple text format used by Tony Cassandra for .alpha files.
Implemented in PerseusStationary, and PerseusNonStationary.
Referenced by PlanEndOfIteration().
|
inline |
|
protectedpure virtual |
Implemented in PerseusStationary, and PerseusNonStationary.
Referenced by PrintMaxRewardInBeliefSet().
|
protected |
References PlanningUnit::GetHorizon(), GetInitialQFunctions(), and AlphaVectorPlanning::GetPU().
|
protected |
References _m_initializeWithImmediateReward, _m_initializeWithZero, GetInitialValueFunction(), PlanningUnitMADPDiscrete::GetNrJointActions(), PlanningUnitMADPDiscrete::GetNrStates(), AlphaVectorPlanning::GetPU(), AlphaVector::SetAction(), and AlphaVector::SetValue().
Referenced by GetInitialNonStationaryQFunctions(), PerseusQFunctionPlanner::Plan(), PerseusNonStationaryQPlanner::PlanAll(), and PerseusNonStationaryQPlanner::PlanSampling().
|
protected |
References _m_initializeWithImmediateReward, _m_initializeWithZero, PlanningUnitDecPOMDPDiscrete::GetDiscount(), PlanningUnit::GetHorizon(), PlanningUnitMADPDiscrete::GetNrJointActions(), PlanningUnitMADPDiscrete::GetNrStates(), AlphaVectorPlanning::GetPU(), PlanningUnitDecPOMDPDiscrete::GetReward(), Globals::MAXHORIZON, AlphaVector::SetAction(), and AlphaVector::SetValue().
Referenced by GetInitialQFunctions(), and PerseusPOMDPPlanner::Plan().
|
pure virtual |
Implemented in PerseusStationary, and PerseusNonStationary.
|
pure virtual |
Implemented in PerseusStationary, and PerseusNonStationary.
|
pure virtual |
Implemented in PerseusStationary, and PerseusNonStationary.
|
pure virtual |
Implemented in PerseusStationary, and PerseusNonStationary.
|
inlineprivate |
Referenced by GetSize(), and PlanStartOfIteration().
|
inlineprivate |
|
inlineprivate |
References GetSize().
|
inline |
Referenced by PerseusPOMDPPlanner::BackupStage(), PerseusConstrainedPOMDPPlanner::BackupStage(), PerseusBGPOMDPPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageAll(), PerseusBGPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageSampling(), PerseusBGPlanner::BackupStageSampling(), PerseusBGPOMDPPlanner::BackupStageSamplingAlt(), PerseusBGPlanner::BackupStageSamplingAlt(), CheckConvergence(), PlanLeadIn(), PlanLeadOut(), PlanStartOfIteration(), PrintMaxRewardInBeliefSet(), and UpdateValueFunctionName().
void Perseus::Initialize | ( | ) |
|
protectedpure virtual |
Implemented in PerseusStationary, and PerseusNonStationary.
Referenced by PlanLeadIn().
|
pure virtual |
Implemented in PerseusNonStationaryQPlanner, PerseusPOMDPPlanner, and PerseusQFunctionPlanner.
|
inlineprotected |
|
protected |
References _m_storeTimings, PlanningUnit::GetHorizon(), GetIdentification(), AlphaVectorPlanning::GetPU(), directories::MADPGetResultsDir(), TimedAlgorithm::PrintTimersSummary(), and TimedAlgorithm::SaveTimers().
Referenced by PerseusQFunctionPlanner::Plan(), PerseusPOMDPPlanner::Plan(), PerseusNonStationaryQPlanner::PlanAll(), PlanEndOfIteration(), and PerseusNonStationaryQPlanner::PlanSampling().
|
protected |
References _m_beliefsInitialized, GetIdentification(), GetVerbose(), InitializeBeliefs(), PrintMaxRewardInBeliefSet(), and TimedAlgorithm::StartTimer().
Referenced by PerseusQFunctionPlanner::Plan(), PerseusPOMDPPlanner::Plan(), PerseusNonStationaryQPlanner::PlanAll(), and PerseusNonStationaryQPlanner::PlanSampling().
|
protected |
References _m_storeTimings, PlanningUnit::GetHorizon(), GetIdentification(), AlphaVectorPlanning::GetPU(), GetVerbose(), directories::MADPGetResultsDir(), TimedAlgorithm::SaveTimers(), and TimedAlgorithm::StopTimer().
Referenced by PerseusQFunctionPlanner::Plan(), PerseusPOMDPPlanner::Plan(), PerseusNonStationaryQPlanner::PlanAll(), and PerseusNonStationaryQPlanner::PlanSampling().
|
inlineprotected |
References AlphaVectorPlanning::ExportValueFunction(), PlanningUnit::GetHorizon(), GetIdentification(), PlanningUnitMADPDiscrete::GetNewJointBeliefFromISD(), AlphaVectorPlanning::GetPU(), GetSize(), BeliefValue::GetValue(), GetVerbose(), and directories::MADPGetResultsDir().
Referenced by PerseusQFunctionPlanner::Plan(), PerseusPOMDPPlanner::Plan(), PerseusNonStationaryQPlanner::PlanAll(), and PerseusNonStationaryQPlanner::PlanSampling().
|
protected |
Prints the maximum immediate reward present in the belief set.
References _m_beliefsInitialized, GetIdentification(), GetImmediateRewardBeliefSet(), and GetVerbose().
Referenced by PlanLeadIn().
|
static |
int Perseus::SampleNotImprovedBeliefIndex | ( | std::vector< bool > | stillNeedToBeImproved, |
int | nrNotImproved | ||
) | const |
Sample an index of a belief in the set which has not been improved.
References PrintTools::PrintVectorCout().
Referenced by PerseusPOMDPPlanner::BackupStage(), PerseusConstrainedPOMDPPlanner::BackupStage(), PerseusBGNSPlanner::BackupStageSampling(), PerseusBGPlanner::BackupStageSampling(), PerseusBGPOMDPPlanner::BackupStageSamplingAlt(), and PerseusBGPlanner::BackupStageSamplingAlt().
|
inline |
|
inline |
void Perseus::SetIdentification | ( | const std::string & | identification | ) |
References _m_identification, and UpdateValueFunctionName().
|
inline |
|
inline |
Referenced by PerseusNonStationary::PerseusNonStationary().
|
inline |
Referenced by Perseus().
|
inline |
Referenced by Perseus().
void Perseus::SetResultsFilename | ( | const std::string & | filename | ) |
References _m_resultsFilename, and UpdateValueFunctionName().
|
inline |
|
inline |
|
pure virtual |
Implemented in PerseusStationary, and PerseusNonStationary.
|
inline |
|
protectedvirtual |
Reimplemented in PerseusStationary.
Referenced by PlanEndOfIteration().
|
protectedvirtual |
Reimplemented in PerseusStationary.
|
protectedvirtual |
Reimplemented in PerseusNonStationary.
|
protected |
References _m_resultsFilename, _m_valueFunctionFilename, PlanningUnit::GetHorizon(), GetIdentification(), AlphaVectorPlanning::GetPU(), and GetVerbose().
Referenced by Perseus(), SetIdentification(), and SetResultsFilename().
|
protected |
Whether or not the belief set has been set.
Referenced by PerseusStationary::ExportBeliefSet(), PlanLeadIn(), PrintMaxRewardInBeliefSet(), PerseusNonStationary::SetBeliefSet(), PerseusStationary::SetBeliefSet(), PerseusNonStationary::~PerseusNonStationary(), and PerseusStationary::~PerseusStationary().
|
protected |
|
protected |
|
protected |
Referenced by PerseusNonStationaryQPlanner::PlanAll(), and PerseusNonStationaryQPlanner::PlanSampling().
|
protected |
Referenced by SetIdentification().
|
private |
Referenced by GetInitialQFunctions(), and GetInitialValueFunction().
|
private |
Referenced by GetInitialQFunctions(), and GetInitialValueFunction().
|
private |
Referenced by CheckConvergence().
|
private |
Referenced by CheckConvergence().
|
protected |
Referenced by SetResultsFilename(), and UpdateValueFunctionName().
|
protected |
|
protected |
Referenced by PlanEndOfIteration(), and PlanLeadOut().
|
protected |
|
private |