$search
00001 /* 00002 * Copyright (c) 2009, Maxim Likhachev 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of the University of Pennsylvania nor the names of its 00014 * contributors may be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 #ifndef __PPCPPLANNER_H_ 00030 #define __PPCPPLANNER_H_ 00031 00032 00033 00036 typedef class PPCPPLANNERSTATEDATA : public AbstractSearchState 00037 { 00038 public: 00039 00042 CMDPSTATE* MDPstate; 00045 int v; 00048 unsigned int iteration; 00049 00052 CMDPACTION *bestnextaction; 00053 00054 private: 00055 //probability of reaching this state (intermediate variable used by the algorithm) 00056 float Pc; 00057 00058 00059 public: 00060 PPCPPLANNERSTATEDATA() {}; 00061 ~PPCPPLANNERSTATEDATA() {}; 00062 } PPCPState; 00063 00064 00065 00066 00067 00068 00069 00072 typedef struct PPCPSTATESPACE 00073 { 00076 CMDP MDP; 00079 CMDPSTATE* StartState; 00082 CMDPSTATE* GoalState; 00083 00084 int iteration; 00085 int searchiteration; 00086 00087 //TODO - vector<PolicyFullState_t*> CurrentPolicy; //current policy 00088 double currentpolicyconfidence; 00089 00092 bool bReinitializeSearchStateSpace; 00093 00094 }PPCPStateSpace_t; 00095 00096 00097 00098 00099 00100 00101 00102 00103 00108 class PPCPPlanner : public SBPLPlanner 00109 { 00110 00111 public: 00112 00117 int replan(double allocated_time_secs, vector<sbpl_PolicyStatewithBinaryh_t>* SolutionPolicy, float* ExpectedCost, float* ProbofReachGoal); 00118 00121 PPCPPlanner(DiscreteSpaceInformation* environment, int sizeofS, int sizeofH); 00124 ~PPCPPlanner(); 00125 00128 int set_goal(int goal_stateID); 00131 int set_start(int start_stateID); 00132 00135 int replan(double allocated_time_sec, vector<int>* solution_stateIDs_V){ 00136 SBPL_ERROR("ERROR: this version of replan not supported in PPCP planner\n"); 00137 throw new SBPL_Exception(); 00138 }; 00139 00142 int replan(double allocated_time_sec, vector<int>* solution_stateIDs_V, int* solcost){ 00143 SBPL_ERROR("ERROR: this version of replan not supported in PPCP planner\n"); 00144 throw new SBPL_Exception(); 00145 }; 00146 00149 int force_planning_from_scratch(); 00150 00151 00154 int set_search_mode(bool bSearchUntilFirstSolution){ 00155 SBPL_ERROR("ERROR: set_search_mode not supported in PPCP planner\n"); 00156 throw new SBPL_Exception(); 00157 }; 00158 00159 00163 void costs_changed(StateChangeQuery const & stateChange); 00166 void costs_changed(); 00167 00168 00169 private: 00170 00171 //member variables 00172 PPCPStateSpace_t* pStateSpace; 00173 FILE* fDeb; 00174 00175 00176 //deallocates memory used by SearchStateSpace 00177 void DeleteStateSpace(PPCPStateSpace_t* pStateSpace); 00178 int CreateSearchStateSpace(PPCPStateSpace_t* pStateSpace); 00179 00180 00181 00182 }; 00183 00184 00185 00186 00187 #endif