MOMDP.h
Go to the documentation of this file.
00001 #ifndef MOMDP_H
00002 #define MOMDP_H
00003 
00004 #include <string>
00005 #include <vector>
00006 #include <map>
00007 #include <sstream>
00008 #include <stdexcept>
00009 
00010 #include "Observations.h"
00011 #include "Actions.h"
00012 #include "States.h"
00013 
00014 #include "Rewards.h"
00015 
00016 #include "ObservationProbabilities.h"
00017 #include "StateTransitionX.h"
00018 #include "StateTransitionXY.h"
00019 #include "StateTransitionXXpY.h"
00020 #include "StateTransitionY.h"
00021 
00022 #include "Belief.h"
00023 #include "BeliefTransition.h"
00024 
00025 #include "POMDP.h"
00026 #include "MObject.h"
00027 #include "MathLib.h"
00028 #include "FacmodelStructs.h"
00029 #include "POMDPLayer.h"
00030 #include "State.h"
00031 #include "ObsAct.h"
00032 #include "Cache.h"
00033 
00034 using namespace std;
00035 using namespace momdp;
00036 namespace momdp 
00037 {
00038         class FactoredPomdp;
00039 
00040         class MOMDP : public MObject
00041         {
00042         private:
00043                 vector<State> stateList;
00044                 vector<ObsAct> observationList;
00045                 vector<ObsAct> actionList;
00046                 vector<ObsAct> rewardList;
00047 
00048 
00049                 virtual void deleteMatrixVector(vector<SharedPointer<SparseMatrix> > *m);
00050 
00051         public:
00052         SharedPointer<SparseVector> initialBeliefY;
00053         vector<SharedPointer<SparseVector> > initialBeliefYByX;
00054 
00055                 Cache<SharedPointer<SparseMatrix> > cache;
00056                                 
00057                 MOMDP(void); // default constructor
00058 
00059                 
00060                 static SharedPointer<MOMDP> convertMOMDPFromPOMDP(POMDP* pomdpProblem);
00061                 static SharedPointer<MOMDP> convertMOMDPFromPOMDPX(FactoredPomdp* factoredPomdp, bool assumeUnknownFlag,unsigned int probType);
00062 
00063                 virtual ~MOMDP(void);
00064 
00065                 virtual string ToString();
00066                 // functions
00067                 BeliefTransition* beliefTransition;
00068 
00069                 // data
00070 
00071                 REAL_VALUE discount;
00072 
00073                 SharedPointer<BeliefWithState>  initialBeliefStval;
00074                 SharedPointer<DenseVector> initialBeliefX;
00075 
00076                 States* XStates;
00077                 States* YStates;
00078                 Actions* actions;
00079                 Observations* observations;
00080 
00081                 StateTransitionX* XTrans;
00082                 StateTransitionY* YTrans;
00083                 ObservationProbabilities* obsProb;
00084                 Rewards* rewards;
00085 
00086                 // TODO: remove the following pomdpXXX variables
00087                 SharedPointer<SparseMatrix> pomdpR;
00088                 vector<SharedPointer<SparseMatrix> > *pomdpT, *pomdpTtr, *pomdpO;
00089 
00090                 vector<vector<int> > isPOMDPTerminalState;
00091 
00092                 // If some parts do not support intraslice yet, they can check this and complain
00093                 bool hasIntraslice; 
00094 
00095                 inline SharedPointer<SparseVector> getInitialBeliefY(int obsState)
00096                 {
00097                   if( initialBeliefY != NULL ) {
00098                     return initialBeliefY;
00099                   } else {
00100                     return initialBeliefYByX[obsState];
00101                   }
00102                 }
00103 
00104                 virtual REAL_VALUE getDiscount ()
00105                 {
00106                         return discount;
00107                 }
00108 
00109                 virtual bool hasPOMDPMatrices();
00110                 virtual void deletePOMDPMatrices();
00111                 
00112                 virtual obsState_prob_vector& getObsStateProbVector(obsState_prob_vector& result, SharedPointer<belief_vector>& belY, DenseVector& belX, int a);
00113                 virtual obsState_prob_vector& getObsStateProbVector(obsState_prob_vector& result, BeliefWithState& b, int a);
00114                 // Xn: next X
00115                 virtual SparseVector& getJointUnobsStateProbVector(SparseVector& result, SharedPointer<BeliefWithState> b, int a, int Xn);
00116 
00117                 virtual int getNumActions();
00118                 virtual int getBeliefSize();
00119 
00120                 virtual bool getIsTerminalState(BeliefWithState &b);
00121 
00122                 virtual void getObsProbVectorFast(obs_prob_vector& result, int a, int Xn, SparseVector& tmp1);
00123                 virtual void getObsProbVector(obs_prob_vector& result, const BeliefWithState& b, int a, int Xn);
00124                 virtual void getObsProbVector(obs_prob_vector& result, SharedPointer<belief_vector>& belY, obsState_prob_vector& belX, int a, int Xn);
00125 
00126                 //
00127                 virtual map<string, string> getActionsSymbols(int actionNum);
00128                 virtual map<string, string> getFactoredObservedStatesSymbols(int stateNum) ;
00129                 virtual map<string, string> getFactoredUnobservedStatesSymbols(int stateNum) ;
00130                 virtual map<string, string> getObservationsSymbols(int observationNum) ;
00131         };
00132 }
00133 #endif


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29