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

Preview:

Citation preview

Intelligent Systems (2II40)C3

Alexandra I. CristeaSeptember 2005

Outline

II. Intelligent agents

III. Search1. Uninformed

2. InformedA. Heuristic

B. Local

C. Online

Iterative deepening search

• Depth first search with growing depth

ll = allowed maximal depth in tree

Iterative deepening search example

Aradl = 0

Iterative deepening search example

Aradl = 1

Iterative deepening search example

l = 1Arad

Zerind Sibiu Timisoara

Iterative deepening search example

Aradl = 2

Iterative deepening search example

l = 2Arad

Zerind Sibiu Timisoara

Iterative deepening search example

l = 2

Arad Oradea

Arad

Zerind Sibiu Timisoara

Iterative deepening search example

l = 2

Arad

Arad

Sibiu Timisoara

Oradea Fagarash RamnicuValcea

Iterative deepening search example

l = 2Arad

Timisoara

Arad Lugoj

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)

Outline

II. Intelligent agents

III. Search1. Uninformed

2. InformedA. Heuristic

B. Local

C. Online

Uniform cost search

• Expand least cost node first

• Implementation: increasing cost order queue

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

Ex: Romania w. step costs (km)

Uniform cost example

Arad

Uniform cost example

Arad

Zerind Sibiu Timisoara

75140

118

Uniform cost example

Arad

Sibiu

75140

118

Arad Oradea

Zerind75+75=

150 75+71=146

Timisoara

Arad Lugoj236

111+118=229

Uniform cost example

Arad

Sibiu

75140

118

Arad Oradea

Zerind

150 146

Timisoara

Arad Lugoj

220 229

Arad Oradea RamnicuValceaFagarash

280 239 291 236

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

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

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

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

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*/)

III.2. Informed search algorithms

III.2. Informed Search Strategies

• A. Heuristic– Best-first search

• Greedy search

• A* search

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

Best first search

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

• Implementation: – queue of decreasing desirability

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

Example Greedy search

• Map of Romania

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

Greedy search example

Arad 366

Greedy search example

366Arad

Zerind Timisoara374 253 329

Sibiu

Greedy search example

366Arad

Zerind Timisoara

366

253 329

Arad

Sibiu

Oradea RamnicuValcea

380 178 193Fagarash

374

Greedy search example

366Arad

Zerind Timisoara

366

253 329

Arad

Sibiu

Oradea RamnicuValcea

380 178 193Fagarash

Sibiu Bucharest253 0

374

Properties of Greedy search

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

• Optimal?Optimal? No

• Time?Time? O(bm)

• Space?Space? O(bm)

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.

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 !!

A* search example

Arad 366

A* search example

366Arad

Zerind Timisoara374+75

=449393 447

Sibiu

75140

118

A* search example

366Arad

Zerind Timisoara

646

393 447

Arad

Sibiu

Oradea RamnicuValcea

671 417 413Fagarash

75140

118

140 151 99 80

449

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

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

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

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

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.

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)

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)

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.

II.2.B. Local Search

• Greedy local search (hill-climbing)

• Simulated annealing

• Genetic algorithms

Homework 3 – part 2

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

Recommended