Fawkes API
Fawkes Development Version
astar_state.h
1
2
/***************************************************************************
3
* astar_state.h - Abstract class of a astar state.
4
*
5
* Generated: Mon Sep 15 18:48:00 2002
6
* Copyright 2002 Stefan Jacobs
7
* 2007 Martin Liebenberg
8
* 2012-2014 Tim Niemueller [www.niemueller.de]
9
****************************************************************************/
10
11
/* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version. A runtime exception applies to
15
* this software (see LICENSE.GPL_WRE file mentioned below for details).
16
*
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU Library General Public License for more details.
21
*
22
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23
*/
24
25
#ifndef _ASTAR_ABSTRACT_STATE_H_
26
#define _ASTAR_ABSTRACT_STATE_H_
27
28
#include <cstdlib>
29
#include <vector>
30
31
namespace
fawkes
{
32
33
/** @class AStarState <utils/search/astar_state.h>
34
* This is the abstract(!) class for an A* State.
35
*
36
* @author Stefan Jacobs
37
*/
38
class
AStarState
39
{
40
public
:
41
/** Constructor.
42
* @param cost_sofar costs for the path so far
43
* @param parent parent search state (maybe NULL for first state)
44
*/
45
AStarState
(
float
cost_sofar,
AStarState
*
parent
) :
parent
(
parent
),
path_cost
(cost_sofar){};
46
47
/** Destructor. */
48
virtual
~AStarState
(){};
49
50
// ***** You have to implement the following 4 methods! ***** //
51
// ***** ============================================== ***** //
52
53
/** Generates a unique key for this state.
54
* There has to be a unique key for each state (fast closed list -> bottleneck!)
55
* @return unique key
56
*/
57
virtual
size_t
key
() = 0;
58
59
/** Estimate the heuristic cost to the goal.
60
* @return estimated cost
61
*/
62
virtual
float
estimate
() = 0;
63
64
/** Check, wether we reached a goal or not.
65
* @return true, if this state is a goal, else false
66
*/
67
virtual
bool
is_goal
() = 0;
68
69
/** Generate all successors and put them to this vector.
70
* @return a vector of pointers of AStarState to a successor
71
*/
72
virtual
std::vector<AStarState *>
children
() = 0;
73
74
/** Predecessor. */
75
AStarState
*
parent
;
76
77
/** Cost of path leading to this search state. */
78
float
path_cost
;
79
80
/** Total estimated cost. */
81
float
total_estimated_cost
;
82
};
83
84
}
// end namespace fawkes
85
86
#endif
fawkes::AStarState::total_estimated_cost
float total_estimated_cost
Total estimated cost.
Definition:
astar_state.h:86
fawkes::AStarState::estimate
virtual float estimate()=0
Estimate the heuristic cost to the goal.
fawkes::AStarState::is_goal
virtual bool is_goal()=0
Check, wether we reached a goal or not.
fawkes
fawkes::AStarState
Definition:
astar_state.h:43
fawkes::AStarState::~AStarState
virtual ~AStarState()
Destructor.
Definition:
astar_state.h:53
fawkes::AStarState::key
virtual size_t key()=0
Generates a unique key for this state.
fawkes::AStarState::AStarState
AStarState()
This is the standard constructor.
Definition:
astar_state.h:56
fawkes::AStarState::parent
AStarState * parent
Predecessor.
Definition:
astar_state.h:80
fawkes::AStarState::path_cost
float path_cost
Cost of path leading to this search state.
Definition:
astar_state.h:83
fawkes::AStarState::children
virtual std::vector< AStarState * > children()=0
Generate all successors and put them to this vector.
src
libs
utils
search
astar_state.h
Generated by
1.8.16