Assignment Search Framework
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
non_goal_heuristic.h
Go to the documentation of this file.
1 /*
2  * non_goal_heuristic.h
3  *
4  * LICENSE HERE
5  *
6  * Created on: 2016-08-31
7  * Author: Rick Valenzano
8  */
9 
10 #ifndef NON_GOAL_HEURISTIC_H_
11 #define NON_GOAL_HEURISTIC_H_
12 
13 #include "heuristic.h"
14 #include "goal_test_function.h"
15 
16 // TODO Add debugging for invalid minimum action costs
17 
23 template<class state_t>
24 class NonGoalHeuristic: public Heuristic<state_t>
25 {
26 public:
32  NonGoalHeuristic(const GoalTestFunction<state_t> *g = 0, double min_cost = 0);
33 
37  virtual ~NonGoalHeuristic();
38 
45 
51  void setMinimumActionCost(double min_cost);
52 
53 protected:
54  virtual double computeHValue(const state_t &state) const;
55 
57  double min_action_cost;
58 };
59 
67 template<class state_t>
69 
70 template<class state_t>
72  : goal_test(g), min_action_cost(min_cost)
73 {
74 }
75 
76 template<class state_t>
78 {
79 }
80 
81 template<class state_t>
83 {
84  goal_test = g;
85 }
86 
87 template<class state_t>
89 {
90  min_action_cost = min_cost;
91 }
92 
93 template<class state_t>
94 double NonGoalHeuristic<state_t>::computeHValue(const state_t& state) const
95 {
96  if(goal_test && goal_test->isGoal(state))
97  return 0.0;
98  return min_action_cost;
99 }
100 
101 template<class state_t>
103 {
105  return h;
106 }
107 
108 #endif /* NON_GOAL_HEURISTIC_H_ */
Heuristic< state_t > * getBlindHeuristic()
Definition: non_goal_heuristic.h:102
void setMinimumActionCost(double min_cost)
Definition: non_goal_heuristic.h:88
virtual ~NonGoalHeuristic()
Definition: non_goal_heuristic.h:77
const GoalTestFunction< state_t > * goal_test
The stored goal test function.
Definition: non_goal_heuristic.h:56
void setGoalTestFunction(const GoalTestFunction< state_t > *g)
Definition: non_goal_heuristic.h:82
Definition: goal_test_function.h:19
Definition: non_goal_heuristic.h:24
NonGoalHeuristic(const GoalTestFunction< state_t > *g=0, double min_cost=0)
Definition: non_goal_heuristic.h:71
double min_action_cost
The minimum cost of any action.
Definition: non_goal_heuristic.h:57
virtual double computeHValue(const state_t &state) const
Definition: non_goal_heuristic.h:94
Definition: heuristic.h:23