00001 /********** tell emacs we use -*- c++ -*- style comments ******************* 00002 $Revision: 2.28 $ $Author: duyanzhu $ $Date: 2009/01/07 05:10:04 $ 00003 00004 @file MDP.h 00005 @brief No brief 00006 00007 Copyright (c) 2005-2006, Trey Smith. All rights reserved. 00008 00009 Licensed under the Apache License, Version 2.0 (the "License"); you may 00010 not use this file except in compliance with the License. You may 00011 obtain a copy of the License at 00012 00013 http://www.apache.org/licenses/LICENSE-2.0 00014 00015 Unless required by applicable law or agreed to in writing, software 00016 distributed under the License is distributed on an "AS IS" BASIS, 00017 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 00018 implied. See the License for the specific language governing 00019 permissions and limitations under the License. 00020 00021 ***************************************************************************/ 00022 00023 #ifndef INCMDP_h 00024 #define INCMDP_h 00025 00026 #include <iostream> 00027 #include <string> 00028 #include <vector> 00029 00030 #include "Const.h" 00031 #include "SparseVector.h" 00032 #include "DenseVector.h" 00033 00034 using namespace momdp; 00035 namespace momdp 00036 { 00037 00038 struct AbstractBound; 00039 00040 // Represents an MDP where state is continuous, time is discrete, 00041 // actions are discrete, and the possible outcomes of an action form a 00042 // discrete probability distribution. This data structure can 00043 // represent the belief MDP corresponding to a discrete POMDP. 00044 struct MDP 00045 { 00046 int numStateDimensions, numActions; 00047 REAL_VALUE discount; 00048 00049 virtual ~MDP(void) {} 00050 00051 int getNumStateDimensions(void) { return numStateDimensions; } 00052 int getNumActions(void) { return numActions; } 00053 REAL_VALUE getDiscount(void) { return discount; } 00054 00055 // returns the initial state 00056 virtual state_vector& getInitialState(void) = 0; 00057 00058 // returns true if state is terminal 00059 virtual bool getIsTerminalState( state_vector& s) = 0; 00060 00061 // sets result to be the vector of outcome probabilities when from 00062 // state s action a is selected 00063 virtual outcome_prob_vector& getOutcomeProbVector(outcome_prob_vector& result, 00064 state_vector& s, int a) 00065 = 0; 00066 00067 // sets result to be the next state when from state s action a is 00068 // selected and outcome o results 00069 virtual state_vector& getNextState(state_vector& result, state_vector& s, int a, 00070 int o) = 0; 00071 00072 // returns the expected immediate reward when from state s action a is selected 00073 virtual REAL_VALUE getReward( state_vector& s, int a) = 0; 00074 00075 // returns a new lower bound or upper bound that is valid for 00076 // this MDP. notes: 00077 // * the resulting bound must be initialized before it is used, and 00078 // initialization may take significant computation time. 00079 // * some types of MDP might not define one of these bounds, which 00080 // could be signaled by returning NULL. so far this hasn't been 00081 // explored. 00082 // virtual AbstractBound* newLowerBound(void) = 0; //!! may be added back later 00083 // virtual AbstractBound* newUpperBound(void) = 0; //!! may be added back later 00084 }; 00085 00086 }; // namespace momdp 00087 00088 #endif // INCMDP_h 00089 00090 /*************************************************************************** 00091 * REVISION HISTORY: 00092 * $Log: MDP.h,v $ 00093 * Revision 2.28 2009/01/07 05:10:04 duyanzhu 00094 * added GES.h 00095 * 00096 * Revision 2.26 2009/01/07 05:05:59 duyanzhu 00097 * added evaluator_win 00098 * 00099 * Revision 2.24 2009/01/07 05:01:32 duyanzhu 00100 * add GES 00101 * 00102 * Revision 2.22 2009/01/07 04:59:00 duyanzhu 00103 * adding in UniqueBeliefHeap 00104 * 00105 * Revision 2.20 2009/01/07 04:33:54 duyanzhu 00106 * APPL 0.3, added Policy Evaluator, added Memory Limit option 00107 * 00108 * Revision 2.18 2008/09/17 14:08:35 duyanzhu 00109 * Fix: Prune now only starts 5 seconds after initialization 00110 * 00111 * Revision 2.16 2008/07/16 13:27:45 duyanzhu 00112 * Bring everything to version 2.16 00113 * 00114 * Revision 2.12 2008/07/16 08:38:15 duyanzhu 00115 * Add CPMemUtils class 00116 * 00117 * Revision 2.11 2008/07/16 08:34:48 duyanzhu 00118 * Added parser memory allocation check. Added release script 00119 * 00120 * Revision 2.10 2008/06/14 01:41:16 duyanzhu 00121 * 14 Jun 08 by Du Yanzhu. Added command line option percentageThreshold 00122 * 00123 * Revision 1.5 2007/08/17 01:44:35 duyanzhu 00124 * Change Alpha vector to DenseVector. Xan adds dump functions. Xan's bound propagation code is also included, but not added to Makefile 00125 * 00126 * Revision 1.4 2007/08/16 14:06:41 duyanzhu 00127 * Undo last commit 00128 * 00129 * Revision 1.2 2007/08/10 06:03:05 duyanzhu 00130 * *** empty log message *** 00131 * 00132 * Revision 1.1.1.1 2007/07/24 13:17:47 dyhsu 00133 * Approximate POMDP Planning Library (APPL) 00134 * 00135 * Revision 1.2 2007/03/25 18:13:19 elern 00136 * revised 00137 * 00138 * Revision 1.1 2007/03/22 07:19:16 elern 00139 * initial revision 00140 * 00141 * Revision 1.7 2006/04/28 17:57:41 trey 00142 * changed to use apache license 00143 * 00144 * Revision 1.6 2006/04/05 21:36:16 trey 00145 * moved OBS_IS_ZERO_EPS from MDP.h to zmdpCommonDefs.h 00146 * 00147 * Revision 1.5 2006/04/04 17:26:29 trey 00148 * moved OBS_IS_ZERO_EPS to MDP.h because it is used all over 00149 * 00150 * Revision 1.4 2006/02/06 19:29:23 trey 00151 * removed numOutcomes field; some MDPs have a varying number of outcomes depending on state 00152 * 00153 * Revision 1.3 2006/02/01 01:09:37 trey 00154 * renamed pomdp namespace -> zmdp 00155 * 00156 * Revision 1.2 2006/01/31 20:09:11 trey 00157 * added generic mechanism for getting bounds 00158 * 00159 * Revision 1.1 2006/01/28 03:01:05 trey 00160 * initial check-in 00161 * 00162 * 00163 ***************************************************************************/ 00164