$search
00001 /* 00002 * Copyright (c) 2008, 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 __PLANNER_H_ 00030 #define __PLANNER_H_ 00031 00032 00033 #define GETSTATEIND(stateid, mapid) StateID2IndexMapping[mapid][stateid] 00034 00035 00036 //indices for the StateID2Index mapping 00037 enum STATEID2IND { STATEID2IND_SLOT0 = 0, 00038 STATEID2IND_SLOT1,//add more slots if necessary 00039 NUMOFINDICES_STATEID2IND 00040 }; 00041 00042 //use the slots above for the mutually exclusive algorithms 00043 #define VIMDP_STATEID2IND STATEID2IND_SLOT0 00044 #define ARAMDP_STATEID2IND STATEID2IND_SLOT0 00045 #define ADMDP_STATEID2IND STATEID2IND_SLOT0 00046 #define RSTARMDP_STATEID2IND STATEID2IND_SLOT0 00047 #define RSTARMDP_LSEARCH_STATEID2IND STATEID2IND_SLOT1 00048 00049 //for example 00050 //#define YYYPLANNER_STATEID2IND STATEID2IND_SLOT0 00051 //#define YYYPLANNER_STATEID2IND STATEID2IND_SLOT1 00052 00053 00054 typedef enum 00055 { //different state types if you have more than one type inside a single planner 00056 ABSTRACT_STATE = 0, 00057 ABSTRACT_STATEACTIONPAIR, 00058 ABSTRACT_GENERALSTATE 00059 } AbstractSearchStateType_t; 00060 00063 class AbstractSearchState 00064 { 00065 00066 public: 00070 struct listelement* listelem[2]; 00073 int heapindex; 00076 AbstractSearchStateType_t StateType; 00077 00078 public: 00079 AbstractSearchState(){StateType = ABSTRACT_GENERALSTATE;listelem[0] = listelem[1] = NULL; }; 00080 ~AbstractSearchState(){}; 00081 }; 00082 00083 class DiscreteSpaceInformation; 00084 00097 class StateChangeQuery; 00098 00101 class SBPLPlanner 00102 { 00103 00104 public: 00105 00110 virtual int replan(double allocated_time_sec, std::vector<int>* solution_stateIDs_V) = 0; 00113 virtual int replan(double allocated_time_sec, std::vector<int>* solution_stateIDs_V, int* solcost) = 0; 00114 00117 virtual int set_goal(int goal_stateID) = 0; 00118 00121 virtual int set_start(int start_stateID) = 0; 00122 00125 virtual int force_planning_from_scratch() = 0; 00126 00134 virtual int set_search_mode(bool bSearchUntilFirstSolution) = 0; 00135 00139 virtual void costs_changed(StateChangeQuery const & stateChange) = 0; 00140 00145 virtual double get_solution_eps() const {SBPL_ERROR("get_solution_eps is unimplemented for this planner\n"); return -1; } 00146 00149 virtual int get_n_expands() const {SBPL_ERROR("get_n_expands is unimplemented for this planner\n"); return -1; } 00150 00153 virtual double get_initial_eps(){SBPL_ERROR("get_initial_eps is unimplemented for this planner\n"); return -1;}; 00154 00157 virtual double get_initial_eps_planning_time(){SBPL_ERROR("get_initial_eps_planning_time is unimplemented for this planner\n"); return -1;} 00158 00161 virtual double get_final_eps_planning_time(){SBPL_ERROR("get_final_eps_planning_time is unimplemented for this planner\n"); return -1;}; 00162 00165 virtual int get_n_expands_init_solution(){SBPL_ERROR("get_n_expands_init_solution is unimplemented for this planner\n"); return -1;}; 00166 00169 virtual double get_final_epsilon(){SBPL_ERROR("get_final_epsilon is unimplemented for this planner\n"); return -1;}; 00170 00171 00176 virtual void set_initialsolution_eps(double initialsolution_eps) {}; 00177 00178 00179 virtual ~SBPLPlanner(){}; 00180 00181 protected: 00182 DiscreteSpaceInformation *environment_; 00183 00184 }; 00185 00186 00187 00188 #endif 00189