Announcements Survey about recita)on )mes will be posted - - PowerPoint PPT Presentation

announcements
SMART_READER_LITE
LIVE PREVIEW

Announcements Survey about recita)on )mes will be posted - - PowerPoint PPT Presentation

Introduc)on to Ar)ficial Intelligence Lecture 2 Uninformed Search CS/CNS/EE 154 Andreas Krause TexPoint fonts used in EMF. Announcements Survey


slide-1
SLIDE 1

Introduc)on ¡to ¡ ¡

Ar)ficial ¡Intelligence ¡

Lecture ¡2 ¡– ¡Uninformed ¡Search ¡

CS/CNS/EE ¡154 ¡ Andreas ¡Krause ¡ TexPoint ¡fonts ¡used ¡in ¡EMF. ¡ ¡

slide-2
SLIDE 2

Announcements ¡

Survey ¡about ¡recita)on ¡)mes ¡will ¡be ¡posted ¡today ¡ Please ¡check ¡website ¡for ¡updates ¡

2 ¡

slide-3
SLIDE 3

Agents ¡and ¡environments ¡

Agents: ¡Alice, ¡Poker ¡player, ¡Robo ¡recep)onist, ¡… ¡

Agent ¡maps ¡sequence ¡of ¡percepts ¡to ¡ac)on ¡ Implemented ¡as ¡algorithm ¡running ¡on ¡physical ¡architecture ¡

Environment ¡maps ¡sequence ¡of ¡ac)ons ¡to ¡percept ¡

3 ¡

slide-4
SLIDE 4

Example: ¡Vacuum ¡cleaning ¡robot ¡

Percepts ¡P ¡= ¡{[A,Clean], ¡[A,Dirty], ¡[B,Clean], ¡[B,Dirty]} ¡ Ac)ons ¡A ¡= ¡{Le], ¡Right, ¡Suck, ¡NoOp} ¡ Agent ¡func)on: ¡ Example: ¡ ¡

4 ¡

slide-5
SLIDE 5

Modeling ¡the ¡environment ¡

Set ¡of ¡states ¡S ¡(not ¡necessarily ¡finite) ¡ State ¡transi)ons ¡depend ¡on ¡current ¡state ¡and ¡ac)ons ¡

(can ¡be ¡stochas)c ¡or ¡nondeterminis)c) ¡

5 ¡

slide-6
SLIDE 6

Ra)onality: ¡Performance ¡evalua)on ¡

Fixed ¡performance ¡measure ¡

evaluates ¡environment ¡seq. ¡

For ¡example: ¡

One ¡point ¡for ¡each ¡clean ¡square ¡a]er ¡10 ¡rounds? ¡ Time ¡it ¡takes ¡un)l ¡all ¡squares ¡clean? ¡ One ¡point ¡per ¡clean ¡square ¡per ¡round, ¡minus ¡one ¡point ¡per ¡move ¡

Goal: ¡find ¡agent ¡func)on ¡(program) ¡to ¡maximize ¡

performance ¡

6 ¡

slide-7
SLIDE 7

Environment ¡types ¡

Sudoku ¡ Poker ¡ Spam ¡Filter ¡ Taxi ¡ Observable? ¡ Determinis>c? ¡ Episodic? ¡ Sta>c? ¡ Discrete? ¡ Single-­‑agent? ¡

7 ¡

slide-8
SLIDE 8

Simple ¡reflex ¡agent ¡

¡Ac)on ¡only ¡func)on ¡of ¡last ¡percept ¡

8 ¡

slide-9
SLIDE 9

Example ¡

9 ¡

Will ¡never ¡stop ¡(noop), ¡since ¡we ¡can’t ¡remember ¡state ¡ This ¡is ¡a ¡fundamental ¡problem ¡of ¡simple ¡reflex ¡agents ¡in ¡

par)ally ¡observable ¡environments! ¡

Percept ¡ Ac>on ¡ [A,dirty] ¡ Suck ¡ [B,dirty] ¡ Suck ¡ [A,clean] ¡ Right ¡ [B,clean] ¡ Le] ¡

slide-10
SLIDE 10

Reflex ¡agent ¡with ¡state ¡

¡Ac)on ¡func)on ¡of ¡percept ¡and ¡internal ¡state ¡

10 ¡

slide-11
SLIDE 11

Example ¡

State ¡vars: ¡cleanA ¡= ¡cleanB ¡= ¡false ¡

11 ¡

Percept ¡ cleanA ¡ cleanB ¡ Ac>on ¡ State ¡change ¡ [X,dirty] ¡ ? ¡ ? ¡ Suck ¡ cleanX ¡= ¡true ¡ [A,clean] ¡ ? ¡ true ¡ NoOp ¡ [A,clean] ¡ ? ¡ false ¡ Right ¡ cleanA ¡= ¡true ¡ [B,clean] ¡ true ¡ ? ¡ NoOp ¡ [B,clean] ¡ false ¡ ? ¡ Le] ¡ cleanB ¡= ¡true ¡

? ¡means ¡“don’t ¡care” ¡

slide-12
SLIDE 12

Goal-­‑based ¡agents ¡

12 ¡

slide-13
SLIDE 13

Search ¡

“Get ¡from ¡state ¡A ¡to ¡B ¡as ¡quickly ¡as ¡possible” ¡ A ¡fundamental ¡problem ¡in ¡many ¡AI ¡problems ¡

Naviga)on, ¡VLSI ¡layout, ¡resource ¡alloca)on, ¡planning, ¡… ¡

For ¡now ¡assume ¡

Fully ¡observable ¡environment ¡and ¡determinis)c ¡ac)ons ¡

13 ¡

slide-14
SLIDE 14

Path ¡planning ¡in ¡Romania ¡

Travel ¡from ¡Arad ¡to ¡Bucharest ¡ Cost: ¡Length ¡of ¡path ¡

14 ¡

slide-15
SLIDE 15

Search ¡with ¡goal ¡based ¡agents ¡

Agent ¡has ¡ ¡

model ¡of ¡environment ¡(map, ¡puzzle ¡rules, ¡mechanics,…) ¡

How ¡will ¡the ¡environment ¡change ¡if ¡I ¡do ¡X? ¡

Goal ¡checker: ¡

Declares ¡some ¡environment ¡states ¡as ¡goals ¡

Performance ¡measure: ¡

Sum ¡of ¡ac)on ¡costs ¡ If ¡all ¡ac)ons ¡cost ¡the ¡same ¡this ¡is ¡called ¡unit ¡cost ¡model ¡

Agent ¡func)on: ¡

Find ¡cheapest ¡sequence ¡of ¡ac)ons ¡to ¡get ¡to ¡a ¡goal ¡state ¡

15 ¡

slide-16
SLIDE 16

Example: ¡Vacuum ¡

In ¡unit ¡cost ¡model, ¡op)mal ¡solu)on ¡is: ¡

16 ¡

Goals ¡ Start ¡state ¡

slide-17
SLIDE 17

State ¡spaces ¡

Vacuum ¡robot: ¡ ¡8 ¡states ¡ Rubik’s ¡cube: ¡

¡10^19 ¡states… ¡

Climbing ¡stairs: ¡ ¡∞ ¡states! ¡ Cannot ¡represent ¡search ¡graph ¡explicitly! ¡ Implicit ¡representa)on: ¡

Successor ¡func)ons ¡maps ¡states ¡to ¡set ¡of ¡(ac)on,state) ¡pairs ¡ Specifies ¡which ¡states ¡can ¡be ¡reached ¡immediately ¡from ¡any ¡

given ¡state ¡

17 ¡

slide-18
SLIDE 18

Example: ¡8 ¡Puzzle ¡

Swap ¡)les ¡to ¡

  • rder ¡pieces ¡

Cost: ¡#moves ¡ States: ¡config’s ¡ Successor ¡fn: ¡

18 ¡

slide-19
SLIDE 19

State ¡space ¡representa)on ¡

Place ¡8 ¡queens ¡that ¡don’t ¡auach ¡

each ¡other. ¡

States: ¡(par)al) ¡board ¡configura)ons ¡ Successor ¡func)ons ¡(ac)ons): ¡

19 ¡

slide-20
SLIDE 20

Tree ¡search ¡

Basic ¡algorithm ¡for ¡search ¡problems ¡ Organize ¡possible ¡sequences ¡into ¡a ¡tree ¡ Expand ¡tree ¡one ¡node ¡at ¡a ¡)me ¡

20 ¡

slide-21
SLIDE 21

Nodes ¡in ¡tree ¡search ¡

21 ¡

slide-22
SLIDE 22

Tree ¡search ¡in ¡Romania ¡

22 ¡

slide-23
SLIDE 23

General ¡tree ¡search ¡

¡func>on ¡treeSearch(problem,strategy) ¡ ¡Ini)alize ¡tree ¡with ¡ini)al ¡state ¡of ¡problem ¡ ¡Repeat ¡ ¡If ¡no ¡leaf ¡node ¡available ¡for ¡expansion ¡then ¡Fail ¡ ¡Use ¡strategy ¡to ¡select ¡leaf ¡node ¡for ¡expansion ¡ ¡If ¡node ¡contains ¡a ¡goal ¡state ¡then ¡return ¡corresponding ¡solu)on ¡ ¡Else ¡expand ¡the ¡node ¡and ¡add ¡resul)ng ¡nodes ¡to ¡search ¡tree ¡

23 ¡

slide-24
SLIDE 24

Implementa)on ¡of ¡general ¡search ¡

Maintain ¡fringe ¡of ¡unexpanded ¡nodes ¡

Typically ¡implemented ¡as ¡some ¡form ¡of ¡queue ¡(FIFO, ¡LIFO, ¡…) ¡ Expanding ¡a ¡node ¡means ¡inser)ng ¡successor ¡states ¡into ¡fringe ¡

24 ¡

Fringe ¡= ¡[Sibiu, ¡Timisoara, ¡Zerind] ¡

slide-25
SLIDE 25

Implementa)on: ¡Tree ¡search ¡

25 ¡

slide-26
SLIDE 26

Quality ¡of ¡a ¡search ¡strategy ¡

¡Completeness ¡

Does ¡it ¡always ¡find ¡a ¡solu)on ¡if ¡one ¡exists? ¡

¡Time ¡complexity ¡

Number ¡of ¡nodes ¡expanded ¡

¡Space ¡complexity ¡

Maximum ¡size ¡of ¡the ¡queue ¡(fringe) ¡

¡Op)mality ¡

Does ¡it ¡always ¡find ¡the ¡op)mal ¡solu)on ¡if ¡one ¡exists? ¡

¡Time/space ¡complexity ¡measured ¡as ¡

b: ¡maximum ¡branching ¡factor ¡ d: ¡depth ¡of ¡least-­‑cost ¡solu)on ¡ m: ¡maximum ¡depth ¡of ¡tree ¡

26 ¡

slide-27
SLIDE 27

Informed ¡vs. ¡uninformed ¡search ¡

Uninformed ¡search ¡

Can ¡only ¡dis)nguish ¡goals ¡from ¡non-­‑goal ¡states ¡ Topic ¡of ¡this ¡lecture ¡

Informed ¡search ¡

Have ¡informa)on ¡about ¡progress ¡towards ¡the ¡op)mal ¡solu)on ¡ Can ¡dras)cally ¡improve ¡)me ¡complexity ¡ Next ¡lecture ¡

27 ¡

slide-28
SLIDE 28

Breadth-­‑first ¡search ¡(BFS) ¡

Strategy: ¡fringe ¡implemented ¡as ¡a ¡FIFO ¡queue ¡ Expands ¡shallowest ¡unexpanded ¡node ¡

28 ¡

slide-29
SLIDE 29

Proper)es ¡of ¡Breadth ¡first ¡search ¡

Complete? ¡ Time ¡complexity? ¡ Space ¡complexity? ¡ Op)mal? ¡

¡Memory ¡usage ¡is ¡o]en ¡prohibi)ve! ¡

29 ¡

slide-30
SLIDE 30

Uniform ¡cost ¡search ¡

Expand ¡least ¡cost ¡node ¡ Implementa)on: ¡ ¡

Fringe ¡is ¡cost-­‑ordered ¡queue ¡(priority ¡queue) ¡

Equivalent ¡to ¡BFS ¡in ¡the ¡unit ¡cost ¡case ¡ Complete? ¡ Time ¡complexity? ¡ Space ¡complexity? ¡ Op)mal? ¡

30 ¡

slide-31
SLIDE 31

Depth ¡first ¡search ¡(DFS) ¡

Strategy: ¡fringe ¡implemented ¡as ¡a ¡LIFO ¡queue ¡ Expands ¡deepest ¡unexpanded ¡node ¡

31 ¡

slide-32
SLIDE 32

Proper)es ¡of ¡Depth ¡first ¡search ¡

Complete? ¡ Time ¡complexity? ¡ Space ¡complexity? ¡ Op)mal? ¡

¡Not ¡op)mal! ¡Fails ¡in ¡graphs ¡with ¡loops! ¡ ¡

32 ¡

slide-33
SLIDE 33

Depth-­‑limited ¡search ¡

Try ¡to ¡fix ¡DFS ¡by ¡imposing ¡depth ¡limit ¡ Implementa)on: ¡Do ¡not ¡expand ¡nodes ¡with ¡depth ¡> ¡l ¡ Complete? ¡ Time ¡complexity? ¡ Space ¡complexity? ¡ Op)mal? ¡

33 ¡

slide-34
SLIDE 34

Itera)ve ¡deepening ¡

Itera)vely ¡use ¡depth-­‑limited ¡search ¡with ¡increasing ¡depth ¡

34 ¡

slide-35
SLIDE 35

Itera)ve ¡deepening ¡

Itera)vely ¡use ¡depth-­‑limited ¡search ¡with ¡increasing ¡depth ¡

35 ¡

slide-36
SLIDE 36

Itera)ve ¡deepening ¡

Itera)vely ¡use ¡depth-­‑limited ¡search ¡with ¡increasing ¡depth ¡

36 ¡

slide-37
SLIDE 37

Itera)ve ¡deepening ¡

Itera)vely ¡use ¡depth-­‑limited ¡search ¡with ¡increasing ¡depth ¡

37 ¡

slide-38
SLIDE 38

Proper)es ¡of ¡itera)ve ¡deepening ¡

Complete? ¡ Time ¡complexity? ¡ Space ¡complexity? ¡ Op)mal? ¡

38 ¡

slide-39
SLIDE 39

Bidirec)onal ¡search ¡

Idea: ¡start ¡BFS ¡from ¡ ¡

start ¡and ¡end ¡state ¡ ¡ (only ¡possible ¡if ¡ ¡ end ¡state ¡is ¡known!) ¡

39 ¡

slide-40
SLIDE 40

Proper)es ¡of ¡bidirec)onal ¡search ¡

Complete? ¡ Time ¡complexity? ¡ Space ¡complexity? ¡ Op)mal? ¡

40 ¡

slide-41
SLIDE 41

Comparison ¡with ¡algorithms ¡

41 ¡

Strategy ¡

BFS ¡ Uniform ¡ cost ¡ DFS ¡ Itera>ve ¡ deepening ¡

  • Bidirect. ¡

Complete ¡ Yes* ¡ Yes* ¡ No ¡ Yes ¡ Yes ¡ Time ¡ bd+1 ¡ bC/ε ¡ bm ¡ bd ¡ bd/2 ¡ Space ¡ bd+1 ¡ bC/ε ¡ b ¡m ¡ b ¡d ¡ bd/2 ¡ Op>mal ¡ Yes* ¡ Yes ¡ No ¡ Yes* ¡ Yes* ¡

slide-42
SLIDE 42

Repeated ¡states ¡

Repeated ¡states ¡can ¡lead ¡to ¡exponen)al ¡increase ¡in ¡

complexity ¡

Remedy: ¡Remember ¡states ¡already ¡visited ¡

42 ¡

slide-43
SLIDE 43

Graph ¡Search ¡

43 ¡

slide-44
SLIDE 44

Graph ¡search ¡example ¡

Uniform ¡cost ¡search ¡on ¡graphs ¡also ¡known ¡as ¡

Dijkstra’s ¡algorithm ¡

44 ¡

slide-45
SLIDE 45

Search ¡in ¡con)nuous ¡domains ¡

45 ¡

slide-46
SLIDE 46

Configura)ons ¡

46 ¡

slide-47
SLIDE 47

Probabilis)c ¡roadmap ¡

Sample ¡points ¡in ¡free ¡(feasible) ¡space ¡ Form ¡search ¡graph ¡on ¡these ¡sampled ¡points ¡ Can ¡get ¡probabilis)c ¡guarantees ¡for ¡completeness ¡ ¡

47 ¡