heuristic.h
Go to the documentation of this file.
00001 #ifndef HEURISTIC_H
00002 #define HEURISTIC_H
00003 
00004 #include <map>
00005 #include <vector>
00006 
00007 class Operator;
00008 class TimeStampedState;
00009 
00010 class Heuristic
00011 {
00012         enum
00013         {
00014             NOT_INITIALIZED = -2
00015         };
00016         double heuristic;
00017         std::vector<const Operator *> preferred_operators;
00018         double waiting_time;
00019 
00020         struct EvaluationInfo
00021         {
00022             EvaluationInfo() {
00023                 heuristic = NOT_INITIALIZED;
00024             }
00025             EvaluationInfo(double heur, const std::vector<const Operator *> &pref) :
00026                 heuristic(heur), preferred_operators(pref)
00027             {
00028             }
00029             double heuristic;
00030             std::vector<const Operator *> preferred_operators;
00031         };
00032 
00033 
00034         unsigned long num_computations;     
00035 
00036     protected:
00037         enum
00038         {
00039             DEAD_END = -1
00040         };
00041         virtual void initialize()
00042         {
00043         }
00044         virtual double compute_heuristic(const TimeStampedState &state) = 0;
00045     public:
00046         inline void set_waiting_time(double time_increment);
00047         void set_preferred(const Operator *op);
00048         Heuristic();
00049         virtual ~Heuristic();
00050 
00051         double evaluate(const TimeStampedState &state);
00052         bool is_dead_end();
00053         double get_heuristic();
00054         void get_preferred_operators(std::vector<const Operator *> &result);
00055         inline double get_waiting_time();
00056         virtual bool dead_ends_are_reliable()
00057         {
00058             return true;
00059         }
00060         unsigned long get_num_computations() const { return num_computations; }
00061 };
00062 
00063 inline void Heuristic::set_waiting_time(double time_increment)
00064 {
00065     waiting_time = time_increment;
00066 }
00067 
00068 inline double Heuristic::get_waiting_time()
00069 {
00070     return waiting_time;
00071 }
00072 
00073 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


tfd_modules
Author(s): Maintained by Christian Dornhege (see AUTHORS file).
autogenerated on Tue Jan 22 2013 12:25:03