AlphaPlanePoolSet.h
Go to the documentation of this file.
00001 #ifndef AlphaPlanePoolSet_H
00002 #define AlphaPlanePoolSet_H
00003 
00004 #include <exception>
00005 #include <list>
00006 #include <vector>
00007 #include <stdexcept>
00008 #include "Bound.h"
00009 #include "Backup.h"
00010 #include "AlphaPlane.h"
00011 #include "AlphaPlanePool.h"
00012 #include "MOMDP.h"
00013 
00014 #define sparse_vector
00015 
00016 using namespace std;
00017 using namespace momdp;
00018 namespace momdp 
00019 {
00020         class AlphaPlanePoolSet :       public Bound<AlphaPlane>
00021         {
00022         private:
00023         public:
00024                 vector<AlphaPlanePool*> set;
00025                 SharedPointer<MOMDP> problem;
00026                 
00027                 void setProblem(SharedPointer<MOMDP> p)
00028                 {
00029                         problem = p;
00030                 }
00031                 void setSolver(PointBasedAlgorithm *p)
00032                 {
00033                         solver = p;
00034                 }
00035 
00036                 vector<BeliefCache *> beliefCacheSet;
00037                 void setBeliefCache(vector<BeliefCache *> p)
00038                 {
00039                         beliefCacheSet = p;
00040                         for(int i = 0 ; i < set.size(); i ++)
00041                         {
00042                                 set[i]->setBeliefCache(p[i]);
00043                         }
00044                 }
00045                 vector<IndexedTuple<AlphaPlanePoolDataTuple> *> dataTableSet;
00046                 void setDataTable(vector<IndexedTuple<AlphaPlanePoolDataTuple> *> p)
00047                 {
00048                         dataTableSet = p;
00049                         for(int i = 0 ; i < set.size(); i ++)
00050                         {
00051                                 set[i]->setDataTable(p[i]);
00052                         }
00053                 }
00054                 
00055                 AlphaPlanePoolSet(Backup<AlphaPlane> *_backupEngine)
00056                 {
00057                         this->setBackupEngine(_backupEngine);
00058                 }
00059                 void initialize()
00060                 {
00061                         set.resize(problem->XStates->size());
00062                         for(States::iterator iter = problem->XStates->begin(); iter != problem->XStates->end(); iter ++ )
00063                         {
00064                                 AlphaPlanePool *bound = new AlphaPlanePool(NULL);
00065                                 bound->setProblem(problem);
00066                                 bound->setSolver(solver);
00067                                 bound->pruneEngine = new PruneAlphaPlane();
00068                                 bound->pruneEngine->setup(problem, bound);
00069                                 set[iter.index()] = bound;
00070                         }
00071                 }
00072                 virtual ~AlphaPlanePoolSet(void)
00073                 {
00074                 }
00075                 virtual void appendOnBackupHandler(BackupCallback _onBackup)
00076                 {
00077                         for(int i = 0 ; i < set.size(); i ++)
00078                         {
00079                                 set[i]->appendOnBackupHandler(_onBackup);
00080                         }
00081                 }
00082                 virtual void removeOnBackupHandler(BackupCallback _onBackup)
00083                 {
00084                         for(int i = 0 ; i < set.size(); i ++)
00085                         {
00086                                 set[i]->removeOnBackupHandler(_onBackup);
00087                         }
00088                 }
00089 
00090                 virtual REAL_VALUE getValue(SharedPointer<BeliefWithState>& belief);
00091                 virtual SharedPointer<AlphaPlane> backup(BeliefTreeNode * node);
00092                 virtual SharedPointer<AlphaPlane> getValueAlpha(SharedPointer<BeliefWithState>& belief);
00093 
00094 
00095                 SharedPointer<AlphaPlane> getBestAlphaPlane(BeliefWithState& b);
00096                 SharedPointer<AlphaPlane> getBestAlphaPlane(BeliefTreeNode& cn);
00097                 SharedPointer<AlphaPlane> getBestAlphaPlane1(BeliefWithState& beliefandState);
00098                 
00099                 void writeToFile(const std::string& outFileName, string problemName) ; //write in new XML format
00100 //              void writeToFile(const std::string& outFileName) ; //write in out IV format
00101         };
00102 }
00103 
00104 #endif 
00105 


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