# Artificial Intelligence

## Presentasi berjudul: "Artificial Intelligence"— Transcript presentasi:

Artificial Intelligence
Informed Search 27/09/2010

Outline Informed Search Hill Climbing Search Greedy Best First Search
A* Search

Informed Search Heuristic (informed) search -> explore the node that is most “likely” to be the nearest to a goal state. There is no guarantee that the heuristic provided most “likely” node will get you closer to a goal state than any other. Add domain-specific information to select the best path along which to continue searching Define a heuristic function, h(n), that estimates the “goodness” of a node n. Specifically, h(n) = estimated cost (or distance) of minimal cost path from n to a goal state. The heuristic function is an estimate, based on domain- specific information that is computable from the current state description, of how close we are to a goal

Hill Climbing Search If there exists a successor s for the current state n such that h(s) < h(n) h(s) <= h(t) for all the successors t of n, then move from n to s. Otherwise, halt at n. Looks one step ahead to determine if any successor is better than the current state; if there is, move to the best successor. Similar to Greedy search in that it uses h, but does not allow backtracking or jumping to an alternative path since it doesn’t “remember” where it has been.

Hill Climbing Search (cont.)
Problem : may get stuck into local minima or in local maxima

Hill climbing example 2 8 3 1 6 4 7 5 1 3 8 4 7 6 5 2 start h = -4
goal h = 0 -2 -5 -5 2 8 3 1 4 7 6 5 1 3 8 4 7 6 5 2 h = -3 h = -1 -4 -3 2 3 1 8 4 7 6 5 3 1 8 4 7 6 5 2 h = -3 h = -2 -4 f(n) = -(number of tiles out of place)

Local Maximum Problem 1 2 5 7 4 8 6 3 -4 start 1 2 5 7 4 8 6 3 -3 1 2

Local Minimum Problem 1 2 5 8 4 7 6 3 start h = -3 -4 -4 1 2 5 8 4 7 6

Local-minimum problem
Robot Navigation Local-minimum problem f(N) = h(N) = straight distance to the goal

Greedy Best First Search
Evaluation function f(n) = h(n) (heuristic) = estimate of cost from n to goal e.g., hSLD(n) = straight-line distance from n to Bucharest Greedy best-first search expands the node that appears to be closest to goal

Romania with step costs in km

Greedy best-first search example

Greedy best-first search example

Greedy best-first search example

Greedy best-first search example

Properties of greedy best first search
Complete? No – can get stuck in loops, e.g., Iasi  Neamt  Iasi  Neamt  Time? O(bm), but a good heuristic can give dramatic improvement Space? O(bm) -- keeps all nodes in memory Optimal? No

Robot Navigation f(N) = h(N), with h(N) = Manhattan distance to the goal 2 1 5 8 7 3 4 6

Robot Navigation f(N) = h(N), with h(N) = Manhattan distance to the goal 8 7 6 5 4 3 2 3 4 5 6 7 5 4 3 5 6 3 2 1 1 2 4 What happened??? 7 7 6 5 8 7 6 5 4 3 2 3 4 5 6

Admissible heuristic Let h*(N) be the true cost of the optimal path from N to a goal node Heuristic h(N) is admissible if:  h(N)  h*(N) An admissible heuristic is always optimistic

A* Search Evaluation function: f(N) = g(N) + h(N) where:
g(N) is the cost of the best path found so far to N h(N) is an admissible heuristic Then, best-first search with this evaluation function is called A* search Important AI algorithm developed by Fikes and Nilsson in early 70s. Originally used in Shakey robot.

Robot Navigation f(N) = g(N)+h(N), with h(N) = Manhattan distance to goal and g(N) = the cost of the best path found so far between the initial node and N 7+2 8+3 2 1 5 8 7 3 4 6 8+3 7+4 7+4 6+5 5+6 6+3 4+7 5+6 3+8 4+7 3+8 2+9 2+9 3+10 7+2 6+1 2+9 3+8 6+1 8+1 7+0 2+9 1+10 1+10 0+11 7+0 7+2 6+1 8+1 7+2 6+3 6+3 5+4 5+4 4+5 4+5 3+6 3+6 2+7 2+7 3+8

Soal searching (a dan b)
Selesaikan pathfinding maze berikut ini menggunakan : BFS DFS Greedy Search Algoritma A* Keterangan: Gunakan Manhattan distance untuk menghitung H(N) dan G(N) S = Start Node G = Goal Node S G

Persiapan Pekan Depan Buat kelompok @ 4 – 5 orang => 8 kel
Masing-masing kelompok dibagi untuk mempelajari algoritma pencarian : a. greedy BFS = 2 kel b. A* = 2 kel c. Minimax = 2 kel d. Alpha Beta Prunning = 2 kel Tugas masing-masing kelompok mempelajari : - pengertian - algoritma - penyelesaian soal searching (salah satu saja sesuai tugas kelompoknya) - contoh coding (sunnah) dibuat file presentasinya, diburn jadi 1 cd (sekelas) disertai referensi yang digunakan Pekan depan = presentasi. Dengan aturan sbb : 1. masing-masing kelompok mengirim 2 wakilnya untuk presentasi ke kelompok yang lain. (gantian) 2. masing-masing kelompok mengirim 1 wakil yang lain lagi, untuk presentasi di depan (per algoritma pencarian)