summaryrefslogtreecommitdiffstats
path: root/test_cases/q4/astar_1_graph_heuristic.test
blob: b5afd793fa7232f4142beeb7275b63ab7408cce8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class: "GraphSearchTest"
algorithm: "aStarSearch"

diagram: """
     2     3     2
  S --- A --- C ---> G
  | \       /       ^
3 |  \ 5   / 1     / 
  |   \   /       / 
  B --- D -------/
     4         5  

S is the start state, G is the goal.  Arrows mark possible state 
transitions.  The number next to the arrow is the cost of that transition.

The heuristic value of each state is:
	S 6.0
	A 2.5
	B 5.25
	C 1.125
	D 1.0625
	G 0
"""
# The following section specifies the search problem and the solution.
# The graph is specified by first the set of start states, followed by
# the set of goal states, and lastly by the state transitions which are
# of the form: 
#      <start state> <actions> <end state> <cost>
graph: """
start_state: S
goal_states: G
S 0 A 2.0
S 1 B 3.0
S 2 D 5.0
A 0 C 3.0
A 1 S 2.0
B 0 D 4.0
B 1 S 3.0
C 0 A 3.0
C 1 D 1.0
C 2 G 2.0
D 0 B 4.0
D 1 C 1.0
D 2 G 5.0
D 3 S 5.0
"""
heuristic: """
S 6.0
A 2.5
B 5.25
C 1.125
D 1.0625
G 0
"""