planner.h
Go to the documentation of this file.
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 #define anaMDP_STATEID2IND STATEID2IND_SLOT0
00049 
00050 //for example
00051 //#define YYYPLANNER_STATEID2IND STATEID2IND_SLOT0
00052 //#define YYYPLANNER_STATEID2IND STATEID2IND_SLOT1
00053 
00054 
00055 typedef enum 
00056         {       //different state types if you have more than one type inside a single planner
00057                 ABSTRACT_STATE = 0,
00058                 ABSTRACT_STATEACTIONPAIR,
00059                 ABSTRACT_GENERALSTATE
00060 } AbstractSearchStateType_t; 
00061 
00064 class AbstractSearchState
00065 {
00066 
00067 public:
00071         struct listelement* listelem[2];
00074         int heapindex;
00077         AbstractSearchStateType_t StateType; 
00078 
00079 public:
00080         AbstractSearchState(){StateType = ABSTRACT_GENERALSTATE;listelem[0] = listelem[1] = NULL; };
00081         ~AbstractSearchState(){};
00082 };
00083 
00084 class DiscreteSpaceInformation;
00085 
00098 class StateChangeQuery;
00099 
00102 class SBPLPlanner
00103 {
00104 
00105 public:
00106 
00111   virtual int replan(double allocated_time_sec, std::vector<int>* solution_stateIDs_V) = 0;
00114   virtual int replan(double allocated_time_sec, std::vector<int>* solution_stateIDs_V, int* solcost) = 0;
00115 
00118     virtual int set_goal(int goal_stateID) = 0;
00119 
00122     virtual int set_start(int start_stateID) = 0;
00123 
00126     virtual int force_planning_from_scratch() = 0; 
00127 
00135         virtual int set_search_mode(bool bSearchUntilFirstSolution) = 0;
00136 
00140         virtual void costs_changed(StateChangeQuery const & stateChange) = 0;
00141   
00146    virtual double get_solution_eps() const {SBPL_ERROR("get_solution_eps is unimplemented for this planner\n"); return -1; }
00147 
00150   virtual int get_n_expands() const {SBPL_ERROR("get_n_expands is unimplemented for this planner\n");  return -1; }
00151 
00154   virtual double get_initial_eps(){SBPL_ERROR("get_initial_eps is unimplemented for this planner\n"); return -1;};
00155 
00158   virtual double get_initial_eps_planning_time(){SBPL_ERROR("get_initial_eps_planning_time is unimplemented for this planner\n"); return -1;}
00159 
00162   virtual double get_final_eps_planning_time(){SBPL_ERROR("get_final_eps_planning_time is unimplemented for this planner\n"); return -1;};
00163 
00166   virtual int get_n_expands_init_solution(){SBPL_ERROR("get_n_expands_init_solution is unimplemented for this planner\n"); return -1;};
00167 
00170   virtual double get_final_epsilon(){SBPL_ERROR("get_final_epsilon is unimplemented for this planner\n"); return -1;};
00171 
00172 
00177    virtual void set_initialsolution_eps(double initialsolution_eps) {};
00178 
00179 
00180     virtual ~SBPLPlanner(){};
00181 
00182 protected:
00183         DiscreteSpaceInformation *environment_;
00184 
00185 };
00186 
00187 
00188 
00189 #endif
00190 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


sbpl
Author(s): Maxim Likhachev/maximl@seas.upenn.edu
autogenerated on Fri Jan 18 2013 13:41:53