You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d4e78f1
Browse filesBrowse the repository at this point in the historyBrowse files
Added template interface to better define expected functions of UserState
- Created a template interface AStarState which defines all the necessary functions that AStarSearch will require of the UserState. This serves as a quick reference and can also ensure a properly implemented class is provided to AStarSearch (enforcable only with C++11 features).
static_assert(is_base_of<AStarState<UserState>, UserState>::value, "UserState must be derived from AStarState!");
60
+
#endif
61
+
56
62
public:// data
57
63
58
64
enum
@@ -778,6 +784,17 @@ template <class UserState> class AStarSearch
778
784
779
785
};
780
786
787
+
template <classT> classAStarState
788
+
{
789
+
public:
790
+
virtual~AStarState() {}
791
+
virtualfloatGoalDistanceEstimate( T &nodeGoal ) = 0; // Heuristic function which computes the estimated cost to the goal node
792
+
virtualboolIsGoal( T &nodeGoal ) = 0; // Returns true if this node is the goal node
793
+
virtualboolGetSuccessors( AStarSearch<T> *astarsearch, T *parent_node ) = 0; // Retrieves all successors to this node and adds them via astarsearch.addSuccessor()
794
+
virtualfloatGetCost( T &successor ) = 0; // Computes the cost of travelling from this node to the successor node
795
+
virtualboolIsSameState( T &rhs ) = 0; // Returns true if this node is the same as the rhs node
0 commit comments