230 likes | 439 Views
Pertemuan 3 Heuristic Search Techniques Generate-and-Test. Matakuliah : T0264/Inteligensia Semu Tahun : Juli 2006 Versi : 2/1. Learning Outcomes. Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : << TIK-99 >> << TIK-99>>. Outline Materi. Materi 1 Materi 2 Materi 3
E N D
Pertemuan 3Heuristic Search Techniques Generate-and-Test Matakuliah : T0264/Inteligensia Semu Tahun : Juli 2006 Versi : 2/1
Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : • << TIK-99 >> • << TIK-99>>
Outline Materi • Materi 1 • Materi 2 • Materi 3 • Materi 4 • Materi 5
Search Strategis A. Blind Search : • Breadth-first search • Depth-first search B. Heuristic Search : • Generate-and-test • Hill climbing • Best-first search • Problem reduction • Constrain satisfaction • Means-ends analysis
3.1 Generate-and-Test Algorithm : Generate-and-Test • Generate a possible solution. • Test to see if this actually a solution by comparing the chosen point or the endpoint of the chosen path to the set of acceptable goal states. • If a solution has been found, quit. Otherwise, return to step1.
8 A B 7 5 4 3 C D 6 Generate-and-Test • Sales Traveling Problem Dengan Menggunakan Generate and test bisa ditentukan lintasan terpendek yang harus ditempuh oleh sales.
3.2 Hill-Climbing Algorithm : Simple Hill – Climbing • Evaluate the initial state. If it is also a goal state, then return it and quit. Otherwise, continue with the initial state as the current state. • Loop until a solution is found or until there are no new operators left to be applied in the current state : • Select an operator that has not yet been applied to the current state and apply it to produce a new state.
Algorithm : Simple Hill – Climbing • Evaluate the new state. i. If it is a goal state, then return it and quit. • If it is not a goal state but it is better than the current state, then make it the current state. iii. If it is not better than the current state, then continue in the loop.
Algorithm : Steepest – Ascent Hill Climbing • Evaluate the initial state. If it is also a goal state, then return it and quit. Otherwise, continue with the initial state as the current state. • Loop until a solution is found or until a complete iteration produces no change to current state : a. Let SUCC be a state such that any possible sucessor of the current state will be better than SUCC.
Algorithm : Steepest – Ascent Hill Climbing • For each operator that applies to current state do : i. Apply the operator and generate a new state. ii. Evaluate the new state. If it is goal state, then return it and quit. If not, compare it to SUCC. If it is better, then set SUCC to this state. If it is not better, leave SUCC alone. c. If the SUCC is better than current state, then set current state to SUCC.
Kasus Sales Hill Climbing Operator yang digunakan : • Tukar kota 1 dengan 2 • Tukar kota 2 dengan 3 • Tukar kota 3 dengan 4 • Tukar kota 4 dengan 1 • Tukar kota 2 dengan 4 • Tukar kota 1 dengan 3
ABCD/19 BACD/12 ACBD/12 ABDC/18 DBCA/12 ADCB/18 CBAD/20 ABCD/19 BCAD/15 BADC/12 DACB/12 BDCA/15 CABD/16 Simple H. C. Steepest Acsent H. C. Kasus Sales dengan Hill Climbing
A H H G G F F E E D D C C B B A Initial State Goal State A Hill Climbing Problem
G F E D H C B A (b) A H G G F F E E D D C C B A H B (c) (a) Three Possible Moves
A A (3) (5) B C D (1) B (3) C (5) D E (4) F (6) A A B C D B C D (5) (5) G (6) H (5) G (6) H (5) E (4) F (6) E F (6) I (2) J (1) 3.3 Best – First Search Step 1 Step 2 Step 3 Step 4 Step 5 A
Algorithm : Best - First Search • Start with Open containing just the initial state • Until a goal is found or there are no nodes left on Open do: (a) Pick the best node on Open. (b) Generate its successors. (c) For each successor do : • If it has not been generate before, evaluate it, add it to Open, and record its parent. • If it has been generate before, change the parent if this new path is better than previous one. In that case, update the cost of getting to this node and to any successors that this node may already have.
A B (3+1) C (4+1) D (5+1) E (3+2) F (3+3) Underestimates
A B (3+1) C (4+1) D (5+1) E (2+2) F (1+3) G (0+4) Overestimates
<< CLOSING>> End of Pertemuan 3 Good Luck