40 lines
848 B
Plaintext
40 lines
848 B
Plaintext
|
class: "GraphSearchTest"
|
||
|
algorithm: "uniformCostSearch"
|
||
|
|
||
|
diagram: """
|
||
|
C
|
||
|
^
|
||
|
| 2
|
||
|
2 V 4
|
||
|
*A <----> B -----> [H]
|
||
|
|1
|
||
|
1.5 V 2.5
|
||
|
G <----- D -----> E
|
||
|
|
|
||
|
2 |
|
||
|
V
|
||
|
[F]
|
||
|
|
||
|
A is the start state, F and H is the goal. Arrows mark possible state
|
||
|
transitions. The number next to the arrow is the cost of that transition.
|
||
|
"""
|
||
|
# 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: A
|
||
|
goal_states: H F
|
||
|
A Right B 2.0
|
||
|
B Right H 4.0
|
||
|
B Down D 1.0
|
||
|
B Up C 2.0
|
||
|
B Left A 2.0
|
||
|
C Down B 2.0
|
||
|
D Right E 2.5
|
||
|
D Down F 2.0
|
||
|
D Left G 1.5
|
||
|
"""
|
||
|
|