Top Banner
Inf2D 02: Problem Solving by Searching Valerio Restocchi School of Informatics, University of Edinburgh 16/01/20 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann, Vaishak Belle
24

Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Oct 17, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Inf2D 02: Problem Solving bySearching

Valerio Restocchi

School of Informatics, University of Edinburgh

16/01/20

Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann, Vaishak Belle

Page 2: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Outline

− Problem-solving agents

− Problem types

− Problem formulation

− Example problems

− Basic search algorithms

2

Page 3: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Problem-solving agents

Agent has a “ Formulate, Search, Execute”

3

Page 4: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: Romania

− On holiday in Romania; currently in Arad.

− Flight leaves tomorrow from Bucharest

− Formulate goal:

I be in Bucharest

− Formulate problem:

I states: various citiesI actions: drive between cities

− Find solution:

I sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest

4

Page 5: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: Romania

5

Page 6: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Problem types

− Deterministic, fully observable → single-state problem

I Agent knows exactly which state it will be in; solution isa sequence

− Non-observable → sensorless problem (conformantproblem)

I Agent may have no idea where it is; solution is asequence

− Nondeterministic and/or partially observable →contingency problem –

I percepts provide new information about current stateI often interleave search, execution

− Unknown state space → exploration problem

6

Page 7: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: vacuum world

− Single-state, start in #5.

Solution?

7

Page 8: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: vacuum world

− Single-state, start in #5.

Solution: [Right, Suck]

− Sensorless, start in {1, 2, 3, 4, 5, 6, 7, 8} e.g., Right goesto {2, 4, 6, 8}

Solution?

8

Page 9: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: vacuum world− Sensorless, start in {1, 2, 3, 4, 5, 6, 7, 8} e.g., Right goes

to {2, 4, 6, 8}

Solution: [Right, Suck, Left, Suck]

− Contingency

I Nondeterministic:Suck may dirty aclean carpet

I Partially observable:location, dirt atcurrent location.

I Percept: [L, Clean],i.e., start in #5 or #7

Solution?9

Page 10: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: vacuum world

− Contingency

I Nondeterministic:Suck may dirty aclean carpet

I Partially observable:location, dirt atcurrent location.

I Percept: [L, Clean],i.e., start in #5 or #7

Solution: [Right, if dirt then Suck]

10

Page 11: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Single-state problem formulationA problem is defined by four items:

− initial state e.g., “in Arad”

− actions or successor function S (x) =set of action–statepairsI e.g., S (Arad) = {〈Arad→ Zerind, Zerind 〉 , . . . }

− goal test, can beI explicit, e.g., x = “in Bucharest”I implicit, e.g., Checkmate(x)

− path cost (additive)I e.g., sum of distances, number of actions executed, etc.I c (x , a, y) is the step cost of taking action a in state x to

reach state y, assumed to be ≥ 0

− A solution is a sequence of actions leading from the initialstate to a goal state

11

Page 12: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Selecting a state space

− Real world is absurdly complex → state space must beabstracted for problem solving

− (Abstract) state = set of real states

− (Abstract) action = complex combination of real actions

I e.g., “Arad → Zerind” represents a complex set ofpossible routes, detours, rest stops, etc.

− For guaranteed realizability, any real state “in Arad” mustget to some real state “in Zerind”

− (Abstract) solution =

I set of real paths that are solutions in the real world

− Each abstract action should be “easier” than the originalproblem

12

Page 13: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Vacuum world state space graph

− states?

− actions?

− goal test?

− path cost?

13

Page 14: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Vacuum world state space graph

− states? Pair of dirt and robot locations

− actions? Left, Right, Suck

− goal test? no dirt at any location

− path cost? 1 per action

14

Page 15: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: The 8-puzzle

− states?

− actions?

− goal test?

− path cost?

15

Page 16: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: The 8-puzzle

− states? locations of tiles

− actions? move blank left, right, up, down

− goal test? = goal state (given)

− path cost? 1 per move

16

Page 17: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Example: robotic assembly

− 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

− path cost?: time to execute

17

Page 18: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Tree search algorithms

− Basic idea:

I offline, simulated exploration of state space bygenerating successors of already-explored states (a.k.a.expanding states)

18

Page 19: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Tree search example

19

Page 20: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Tree search example

20

Page 21: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Tree search example

21

Page 22: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Implementation: general tree search

22

Page 23: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Implementation: states vs. nodes− A state is a (representation of) a physical configuration

− A node is a book-keeping data structure constituting partof a search tree includes state, parent node, action, pathcost

− Using these it is easy to compute the components for achild node. (The CHILD-NODE function)

23

Page 24: Inf2D 02: Problem Solving by Searching · Non-observable !sensorless problem (conformant problem) I Agent may have no idea where it is; solution is a sequence Nondeterministic and/or

Summary

− Problem formulation usually requires abstracting awayreal-world details to define a state space that can feasiblybe explored.

24