• No results found

Artificial Intelligence

N/A
N/A
Protected

Academic year: 2021

Share "Artificial Intelligence"

Copied!
67
0
0

Loading.... (view fulltext now)

Full text

(1)

CS 4700:

Foundations of

Artificial Intelligence

Spring 2020

Prof. Haym Hirsh

Lecture 4

(2)

Reminder: Technology Policy

(3)

Reminder: Due Feb 4

• Special accommodations letter:

Scan documentation letter and email to

[email protected]

(4)

First Karma Lecture

The Principal-Agent Value Alignment Problem in Artificial Intelligence

(5)

Textbook

So far:

“Uninformed” Search: Sections 3.1-3.5 Upcoming:

“Informed” Search: Sections 3.6.1, 4.1

(6)

1 10 6 2 3 4 5 7 8 9 11 12 13

Depth-First Search

(7)

1 4 3 2 5 6 7 8 9 11 12 13

Breadth-First Search

10

(8)

DFS vs BFS

(9)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

(10)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

Space O(bm) O(bd)

Complete: If there’s a solution you will find it

Optimal: You will find the

(11)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

Space O(bm) O(bd)

DFS can miss optimal solutions BFS won’t

Complete: If there’s a solution you will find it

Optimal: You will find the

(12)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

(13)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

Space O(bm) O(bd)

(14)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

Space O(bm) O(bd)

Loosely, number of nodes expanded Worst-case exponential DFS: in depth of search space

(15)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

Space O(bm) O(bd)

Loosely, number of nodes expanded Worst-case exponential DFS: in depth of search space

(16)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

(17)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

Space O(bm) O(bd)

(18)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

Space O(bm) O(bd)

Loosely, number of nodes in Open

(19)

DFS vs BFS: more detail

(20)

DFS vs BFS: more detail

• b: branching factor (finite) • d: depth of solution (finite) • Assume a tree of depth m

(21)

DFS vs BFS: more detail

(22)

DFS vs BFS: more detail

• b: branching factor (finite) • d: depth of solution (finite) • Assume a tree of depth m

(23)

DFS vs BFS: more detail

• b: branching factor (finite) • d: depth of solution (finite) • Assume a tree of depth m

But search space is a graph not a tree!

(24)

DFS vs BFS: more detail

• b: branching factor (finite) • d: depth of solution (finite) • Assume a tree of depth m

Space = # of nodes in Open – what about Closed? Because we check if a state has already been visited,

(25)

DFS vs BFS: more detail

• b: branching factor (finite) • d: depth of solution (finite) • Assume a tree of depth m

(26)

DFS vs BFS: more detail

• b: branching factor (finite) • d: depth of solution (finite) • Assume a tree of depth m

Space = # of nodes in Open – what about Closed? (Handwavy response, see book for more handwaving)

(27)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

(28)

DFS vs BFS:

Handwavy Analysis

Method DFS BFS

Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd)

Space O(bm) O(bd)

(29)

DFS vs BFS

(30)

DFS vs BFS

(31)

Search Algorithm Template

Initial call: Search(initialstate,ops,{},{})

Search(s,ops,open,closed) =

If goal(s) Then return(s); Else If not(s  closed)

Then

successors  {}; add(s,closed); For each o  ops that applies to s

add apply(o,s) to successors open  add successors to open;

If not(empty(open))

s’  select(open);

open  remove(s’,open);

(32)

DFS

Initial call: DFS(initialstate,ops,{},{})

DFS(s,ops,open,closed) =

If goal(s) Then return(s); Else If not(s  closed)

Then

successors  {}; add(s,closed); For each o  ops that applies to s

add apply(o,s) to successors open  add successors to open;

If not(empty(open))

s’  newest(open);

open  remove(s’,open);

(33)

Depth-Bounded Depth-First Search

Initial call: DBDFS(initialstate,ops,{},{},bound)

DBDFS(s,ops,open,closed,bound) = If goal(s) Then return(s);

Else If not(s  closed) and bound>0

Then

successors  {}; add(s,closed); For each o  ops that applies to s

add apply(o,s) to successors open  add successors to open;

If not(empty(open))

s’  newest(open);

open  remove(s’,open);

(34)

Iterative Deepening Search

IDS(s,ops) i=0

loop {result = DBDFS(s,ops,{},{},i) if result = fail then i=i+1 else return(result)}

(35)

Depth-Bounded Depth-First Search

Initial call: DBDFS(initialstate,ops,{},{},bound)

DBDFS(s,ops,open,closed,bound) = If goal(s) Then return(s);

Else If not(s  closed) and bound>0

Then

successors  {}; add(s,closed); For each o  ops that applies to s

add apply(o,s) to successors open  add successors to open;

If not(empty(open))

s’  newest(open);

open  remove(s’,open);

(36)
(37)
(38)

Iterative Deepening Search

1,2

(39)

Iterative Deepening Search

1,2

(40)

Iterative Deepening Search

1,2

(41)

Iterative Deepening Search

1,2,6

(42)

Iterative Deepening Search

1,2,6

(43)

Iterative Deepening Search

8

1,2,6

(44)

Iterative Deepening Search

8 9

1,2,6

(45)

Iterative Deepening Search

8 9 10

1,2,6

(46)

Iterative Deepening Search

8 9 10

1,2,6

(47)

Iterative Deepening Search

8 9 10 12

1,2,6

(48)

Iterative Deepening Search

8 9 10 12 13

1,2,6

(49)

Iterative Deepening Search

8 9 10 12 13 14

1,2,6

(50)

Iterative Deepening Search

8 9 10 12 13 14

1,2,6

(51)

Iterative Deepening Search

8 9 10 12 13 14 16

1,2,6

(52)

Iterative Deepening Search

8 9 10 12 13 14 16 17

1,2,6

(53)

Iterative Deepening Search

8 9 10 12 13 14 16 17 18

1,2,6

(54)

Iterative Deepening Search

What???

(55)

b=2 # States Visited

Level Depth-First Iterative Deepening Ratio

(56)

b=2 # States Visited

Level Depth-First Iterative Deepening Ratio

(57)

b=10 # States Visited

Level Depth-First Iterative Deepening Ratio

(58)
(59)

DFS vs BFS vs IDS

Method DFS BFS IDS Complete? Yes Yes

Optimal? No Yes

Time O(bm) O(bd) O()

(60)

DFS vs BFS vs IDS

Method DFS BFS IDS Complete? Yes Yes Yes

Optimal? No Yes Yes

Time O(bm) O(bd) O(bd)

Space O(bm) O(bd) O(bd)

(61)

Time Complexity of IDS

• Time for depth-bounded depth-first search to level i: O(bi)

(62)

Time Complexity of IDS

• Time for depth-bounded depth-first search to level i: O(bi)

• Time for IDS is the sum of this time for i = 0, …, d

(63)

Time Complexity of IDS

• Time for depth-bounded depth-first search to level i: O(bi)

• Time for IDS is the sum of this time for i = 0, …, d

(64)

Time Complexity of IDS

• Time for depth-bounded depth-first search to level i: O(bi)

• Time for IDS is the sum of this time for i = 0, …, d

𝑖=0 𝑑

𝑏𝑖 = 𝑏

𝑑+1 − 1

(65)

Time Complexity of IDS

• Time for depth-bounded depth-first search to level i: O(bi)

• Time for IDS is the sum of this time for i = 0, …, d

(66)

Time Complexity of IDS

• Time for depth-bounded depth-first search to level i: O(bi)

• Time for IDS is the sum of this time for i = 0, …, d

෍ 𝑖=0 𝑑 𝑏𝑖 = 𝑏 𝑑+1 − 1 𝑏 − 1 This is O(bd)

(67)

Iterative Deepening Search

• The amount of wasted effort is a fraction of the time for the final stage of the search

• That fraction gets smaller as the branching factor gets bigger

• In exchange for that, you get linear space! (In d, not m!) Looks like BFS in the right ways

References

Related documents

The objectives of estimating the model for provider choice in health care and finding the price elasticities of demand can be listed as: (a) to investigate the implications for

To fill this gap, we conducted a large empirical study over the change history of 200 open source projects from different software ecosystems and investigated when bad smells

To be able to simulate a concrete population and policy scenario, the model realistically reproduces (1) individual life cycle wage and consumption profiles ; (2) the skill

All apprentices who have completed all levels of the Motor Vehicle Body Repairer (Metal and Paint) (Automotive Collision Repair Technician) program with a FINAL level mark of 70% or

Marbling texture did not affect collagen characteristics, as coarse marbled steaks were similar ( P > 0.05) to both fine and medium marbled steaks for soluble collagen,

The identification of further actors was facilitated via documentation review of Federal, State and Local government regulatory environments, including management and

Social media site monitoring tools can help organizations keep track of malicious activities and threats against them.Technology can help to check the reliability of the

In this study, we not only showed that NPC1L1 deficiency prevents HFD-induced hepatic steatosis, weight gain, and insulin resistance, but also demonstrated that these