Document

State space search
• Represented by a four-tuple [N,A,S,GD],
where:
•N is the problem space
• A is the set of arcs (or links) between
nodes. These correspond to the operators.
• S is a nonempty subset of N. It
represents the start state(s) of the problem.
State Space Search continued
• GD is a nonempty subset of N. It represents
the goal state(s) of the problem. The states
in GD are described using either:
a measurable property of the states
a property of the path developed in the
search (a solution path is a path from
node S to a node in GD )
The 8-puzzle problem as state space
search
• states: possible board positions
• operators: one for sliding each square in
each of four directions,
or, better, one for moving the blank square in
each of four directions
• initial state: some given board position
• goal state: some given board position
•Note: the “solution” is not interesting here,
we need the path.
Eight Puzzle
1
4
7
5
8
3
1
4
3
6
7
6
2
2
5
8
State space of the 8-puzzle generated by “move blank” operations
Eight Puzzle States
• Representation – The squares of the eight
puzzle can be represented by integers 1 .. 8
and 9 represents empty square.
• A state of the puzzle is a permutation of 1..9
where 1st three represent top row, 2nd three
represent middle row, and 3rd three
represent bottom row.
Eight puzzle transitions
• An eight puzzle transition consists of moving a square numbered
1..8 into the adjacent vacant square which can only be done if it
is adjacent to the numbered square.
• Representation of a board configuration is a permutation of 1..9
where 9 represents vacant square. Example – 132496758
represents 1st row 132, 2nd row 4 blnk 6, 3rd row 748.
• Since the blank is in the middle position, 3 can be moved down,
or 4 to the right, or 6 to the left, or 5 moved up.
• These transitions make 132496758 have neighbors 192436758,
132946758, 132469758, and 132456798.
Best First Search
•
•
•
•
Let X be an eight puzzle state
Let Y1 … Yk be the neighbors of X
Let G be the eight puzzle goal state
Let h(Yi,G) be a lower bound to the distance of Yi
to G.
– h(Yi,G) = 0 (uninformed search)
– h(Yi,G) = # squares in Yi out of place with respect to G
• Best First Search (based on h) selects Yi for which
h(Yi,G) is minimum.
Traveling salesperson problem as
state space search
•The salesperson has n cities to visit and must
then return home. Find the shortest path to
travel.
• state space:
• operators:
• initial state:
• goal state: