Problem solving. Chapter 3, Sections 1–3. Artificial Intelligence, spring 2013,
Peter Ljunglöf; based on AIMA Slides c Stuart Russel and Peter Norvig, 2004.
Problem solving
Chapter 3, Sections 1–3
c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
1
Problem types Deterministic, fully observable =⇒ single-state problem Agent knows exactly which state it will be in; solution is a sequence Non-observable =⇒ conformant problem Agent may have no idea where it is; solution (if any) is a sequence Nondeterministic and/or partially observable =⇒ contingency problem percepts provide new information about current state solution is a contingent plan or a policy often interleave search, execution Unknown state space =⇒ exploration problem (“online”)
c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
2
Example: Romania We are on holiday in Romania; currently in Arad Our flight leaves tomorrow from Bucharest Formulate goal: be in Bucharest Formulate problem: states: various cities actions: drive between cities Find solution: sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest Problem type: deterministic, fully observable =⇒ single-state problem
c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
3
Example: Romania Oradea
71
75
Neamt
Zerind
87
151
Iasi
Arad
140 Sibiu
92 99
Fagaras
118 Timisoara
111
Vaslui
80 Rimnicu Vilcea
Lugoj
Pitesti
97
142
211
70
98 Mehadia
75 Dobreta
146
85
101
86
138
Bucharest
120 Craiova
Hirsova
Urziceni
90 Giurgiu
c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Eforie
Chapter 3, Sections 1–3
4
Single-state problem formulation A problem is defined by five components: initial state, e.g., In(Arad) actions Actions(s) = set of actions for state s e.g., Actions(In(Arad)) = {Go(Sibiu), Go(T imisoara), Go(Zerind)} transitions Result(s, a) = the successor state e.g., Result(In(Arad), Go(Zerind)) = In(Zerind) goal test, can be an explicit set of states, e.g., {In(Bucharest)} or an implicit property, e.g., checkmate in chess path cost is the sum of the step costs c(s, a, s′) e.g., sum of distances, number of actions executed, etc. in this chapter we assume c to be positive A solution is a sequence of actions leading from the initial state to a goal state c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
5
Selecting a state space Real world is absurdly complex ⇒ state space must be abstracted for problem solving (Abstract) state = set of real states (Abstract) action = complex combination of real actions e.g., Result(In(Arad), Go(Zerind)) represents a complex set of possible routes, detours, rest stops, etc. (Abstract) solution = set of real paths that are solutions in the real world Each abstract action should be “easier” than the original problem!
c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
6
Example: vacuum world state space graph R L
R L S
S
R
R
L
R
L
R
L
L S
S
S
S R L
R L S
S
states??: integer dirt and robot locations (ignore dirt amounts etc.) initial state??: any state actions??: Left, Right, Suck, N oOp goal test??: no dirt in any location path cost??: 1 per action (0 for N oOp)
c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
7
Example: The 8-puzzle
states??: a 3 × 3 matrix of integers 0 ≤ n ≤ 8 initial state??: any state actions??: move the blank space: left, right, up, down goal test??: equal to goal state (given above) path cost??: 1 per move
c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
8
Example: The 8-queens problem
states??: any arrangement of 0 to 8 queens on the board initial state??: no queens on the board actions??: add a queen to any empty square goal test??: 8 queens on the board, none attacked path cost??: 1 per move Using this formulation, there are 64 · 63 · · · · 57 ≈ 1.8 × 1014 possible sequences to explore! c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
9
Example: The 8-queens problem (alternative)
states??: one queen per column in the leftmost columns, none attacked initial state??: no queens on the board actions??: add a queen to any square in the leftmost empty column, making sure that no queen is attacked goal test??: 8 queens on the board, none attacked path cost??: 1 per move Using this formulation, we have only 2,057 sequences! c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
10
Example: robotic assembly P R
R
R
R
R
states??: real-valued coordinates of robot joint angles parts of the object to be assembled actions??: continuous motions of robot joints goal test??: complete assembly of the object path cost??: time to execute
c Artificial Intelligence, spring 2013, Peter Ljungl¨ of; based on AIMA Slides Stuart Russel and Peter Norvig, 2004
Chapter 3, Sections 1–3
11