49
Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Embed Size (px)

Citation preview

Page 1: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Intelligent Systems (2II40)C3

Alexandra I. CristeaSeptember 2005

Page 2: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Outline

II. Intelligent agents

III. Search1. Uninformed

2. InformedA. Heuristic

B. Local

C. Online

Page 3: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search

• Depth first search with growing depth

ll = allowed maximal depth in tree

Page 4: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search example

Aradl = 0

Page 5: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search example

Aradl = 1

Page 6: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search example

l = 1Arad

Zerind Sibiu Timisoara

Page 7: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search example

Aradl = 2

Page 8: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search example

l = 2Arad

Zerind Sibiu Timisoara

Page 9: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search example

l = 2

Arad Oradea

Arad

Zerind Sibiu Timisoara

Page 10: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search example

l = 2

Arad

Arad

Sibiu Timisoara

Oradea Fagarash RamnicuValcea

Page 11: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Iterative deepening search example

l = 2Arad

Timisoara

Arad Lugoj

Page 12: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Proprieties of iterative deepening search

• Complete?Complete? Yes (b,d finite)

• Time?Time? (d+1) + db + (d-1)b2 + …+ bd = O(bd)

• Space?Space? O(bd)

• Optimal?Optimal? Yes (b,d finite & cost/step=1)

Page 13: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Outline

II. Intelligent agents

III. Search1. Uninformed

2. InformedA. Heuristic

B. Local

C. Online

Page 14: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost search

• Expand least cost node first

• Implementation: increasing cost order queue

• = min(cost/step): the smallest step cost

Page 15: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Ex: Romania w. step costs (km)

Page 16: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost example

Arad

Page 17: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost example

Arad

Zerind Sibiu Timisoara

75140

118

Page 18: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost example

Arad

Sibiu

75140

118

Arad Oradea

Zerind75+75=

150 75+71=146

Timisoara

Arad Lugoj236

111+118=229

Page 19: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost example

Arad

Sibiu

75140

118

Arad Oradea

Zerind

150 146

Timisoara

Arad Lugoj

220 229

Arad Oradea RamnicuValceaFagarash

280 239 291 236

Page 20: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost example

Arad

Sibiu

75140

118

Arad Oradea

Zerind

150 146

Timisoara

Arad Lugoj

220 229

Arad Oradea RamnicuValceaFagarash

280 239 291 236

Zerind Sibiu

297217

Page 21: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost example

Arad

Sibiu

75140

118

Arad Oradea

Zerind

150 146

Timisoara

Arad Lugoj

220 229

Arad Oradea RamnicuValceaFagarash

280 239 291 236

Zerind Sibiu

297217

225 290268

Page 22: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost example

Arad

Sibiu

75140

118

Arad Oradea

Zerind

150 146

Timisoara

Arad Lugoj

220 229

Arad Oradea RamnicuValceaFagarash

280 239 291 236

Zerind Sibiu

297217

225 290268

Sibiu Pitesti Craiova

300 317 382

Page 23: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Uniform cost example

Arad

Sibiu

75140

118

Arad Oradea

Zerind

150 146

Timisoara

Arad Lugoj

220 229

Arad Oradea RamnicuValceaFagarash

280 239 291 236

Zerind Sibiu

297217

225 290268

Sibiu Pitesti Craiova

300 317 382

Page 24: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Properties of uniform cost search

• Complete?Complete? Yes (b,d finite & cost/step )

• Optimal?Optimal? Yes (b,d finite & cost/step )• Time?Time? O(bC*/) (C* : cost optimal solution)

• Space?Space? O(bC*/)

Page 25: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

III.2. Informed search algorithms

Page 26: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

III.2. Informed Search Strategies

• A. Heuristic– Best-first search

• Greedy search

• A* search

• B. Local– Hill climbing– Simulated annealing– Genetic algorithms

Page 27: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Best first search

• f(n)f(n): evaluation function: – desirability of n

• Implementation: – queue of decreasing desirability

Page 28: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Greedy search

• f(n) = h(n)f(n) = h(n),

• h(n): heuristic : distance from n to goal

• expands n closest to goal

• Important: heuristic should be admissibleadmissible:– h(n) h*(n), with: – h*(n)= real cost from n to goal

Page 29: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Example Greedy search

• Map of Romania

• possible heuristic :hsld(n) = straight_line_distance (n, Bucharest)

Page 30: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Greedy search example

Arad 366

Page 31: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Greedy search example

366Arad

Zerind Timisoara374 253 329

Sibiu

Page 32: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Greedy search example

366Arad

Zerind Timisoara

366

253 329

Arad

Sibiu

Oradea RamnicuValcea

380 178 193Fagarash

374

Page 33: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Greedy search example

366Arad

Zerind Timisoara

366

253 329

Arad

Sibiu

Oradea RamnicuValcea

380 178 193Fagarash

Sibiu Bucharest253 0

374

Page 34: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Properties of Greedy search

• Complete?Complete? No (could get stuck in loops)

• Optimal?Optimal? No

• Time?Time? O(bm)

• Space?Space? O(bm)

Page 35: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Homework 3 – part 1

1. Check Dijkstra’s Greedy algorithm and shortly compare!

2. Give 3 recent applications of a (modified) Greedy algorithm. Explain in what consists the application, evtl. the modification, and give your source.

Page 36: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

A* search

• f(n) = g(n) + h(n)f(n) = g(n) + h(n): – g(n)g(n): real (!!) cost from start to n– h(n)h(n): heuristic: distance from n to goal

• NOTE:– considers the whole cost incurred from start to

goal at all times !!

Page 37: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

A* search example

Arad 366

Page 38: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

A* search example

366Arad

Zerind Timisoara374+75

=449393 447

Sibiu

75140

118

Page 39: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

A* search example

366Arad

Zerind Timisoara

646

393 447

Arad

Sibiu

Oradea RamnicuValcea

671 417 413Fagarash

75140

118

140 151 99 80

449

Page 40: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

A* search example

366Arad

Zerind Timisoara

646

393 447

Arad

Sibiu

Oradea RamnicuValcea

671 417 413Fagarash

75140

118

140 80

449

Sibiu Craiova Pitesti

80 146 97

553 526 415

151 99

Page 41: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

A* search example

366Arad

Zerind Timisoara

646

393 447

Arad

Sibiu

Oradea RamnicuValcea

671 417 413Fagarash

75140

118

140 80

449

Sibiu Craiova Pitesti

80 146 97

553 526 415

Rm.Vilcea Craiova Bucharest607 615 418

97 138 101

151 99

Page 42: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

A* search example

366Arad

Zerind Timisoara

646

393 447

Arad

Sibiu

Oradea RamnicuValcea

671 417 413Fagarash

75140

118

140 80

449

Sibiu Bucharest591 450

21199

Sibiu Craiova Pitesti

80 146 97

553 526 415

Rm.Vilcea Craiova Bucharest138 101

97

607 615 418

151 99

Page 43: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Properties of A* search

• Complete?Complete? Yes (if # nodes w. f C* finite)

• Optimal?Optimal? Yes; optimally efficient!! • Time?Time? O (b(rel. err. in h) x (length of solution))

• Space?Space? All nodes in memory

Page 44: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Optimality A*

• Be G optimal goal state (path cost f*)

• Be G2 suboptimal goal state (local minimum)f(G2) = g(G2) (heuristic zero in goal state)

f(G2) > f* (G2 suboptimal)

• n fringe node on optimal path to G

• h is admissible : f(n) = g(n) + h(n) g(n) + h*(n) = f*.

f(n) f*< f(G2)

• n will be chosen instead of G2, q.e.d.

Page 45: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Improved A* alg.

• IDA* = A* + iterative deepening depending on f• RBFS = recursive depth first search +

remembering value of best ancestor; space=O(bd)

• MA* = memory bound A* (use of available memo only)

• SMA* = simple MA* (A*; if memo full, discard worst node, but store f value of children w. parents)

Page 46: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Summary (un-)informed search

• Uninformed – ‘blind’

– computationally cheaper (heuristic?)

• Research continues on finding better search – i.e., problem solving algorithms

• Informed + uninformed: – global search algorithms

– exponential time+space (10120 molecules in universe)

Page 47: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Homework 3 - part 2

3. Read the LAO* paper find the different notations used by the author for the properties of the search algorithm and make a table of equivalences; Describe LAO* in terms of these properties; comment upon dimensions of AI (as in C1) that you find in the LAO* algorithm.

Page 48: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

II.2.B. Local Search

• Greedy local search (hill-climbing)

• Simulated annealing

• Genetic algorithms

Page 49: Intelligent Systems (2II40) C3 Alexandra I. Cristea September 2005

Homework 3 – part 2

7. Perform steps FAQ 5-6 of the project.