# Pertemuan 4 Heuristic Search Techniques Problem Reduction

## Presentasi berjudul: "Pertemuan 4 Heuristic Search Techniques Problem Reduction"— Transcript presentasi:

Pertemuan 4 Heuristic Search Techniques Problem Reduction
Matakuliah : T0264/Inteligensia Semu Tahun : Juli 2006 Versi : 2/2 Pertemuan 4 Heuristic Search Techniques Problem Reduction

<< TIK-99 >> << TIK-99>>
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

3.4 Problem Reduction A Simple AND - OR Graph

3.4 Problem Reduction AND - OR Graphs

Algoritm : Problem Reduction
Initialize the graph to the starting node Loop until the starting node is labeled SOLVED or until its cost goes above FUTILITY : Traverse the graph, starting at the initial node and following the current best path, and accumulate the set of nodes that are on that path and have not yet been expanded or labeled as solved Pick one of these unecpanded nodes and expand it. If there are no successors, assign FUTILITY as the value of this node. Otherwise, add its successors to the graph abd for each of them computer f’. If f’ of any node is O, mark that node as SOLVED

Algoritm : Problem Reduction
Change the f’ estimate of the newly expanded node to reflect the new information provided by its successors. Propagate this change backward through the graph. If any node contains a successors arc whose descendants are all solved, label the node that is visited while going up the graph, decide which of its successor arcs is the most promising and mark it as part of the current best path

The Operation of Problem Reduction

3.5 Constraint Satisfaction
Algorithm : Constrain Satisfaction Propagate available constraints : First set OPEN to the set of all objects that must have values assigned to them in a complete solution. Then do until an inconsistency is detected or until OPEN is empty : Select an object OB from OPEN. Strengthen the set of constraints that apply to OB. If this set is different from the set that was assigned the last time OB was examined or if this is the first OB has been examined, then add to OPEN all objects that share anyconstraints with OB. Remove OB from OPEN.

3.5 Constraint Satisfaction
If solution, then quit and report the solution. If contradiction, then return failure. If neither, then guess : Loop until a solution is found or all possible solution have been eliminated : Select an object whose value is not yet determined & select a way of strengthening the constraints on that object. Recursively invoke constraint satisfaction with the current set of constraints augmented by the strengthening constraint just selected.

A Criptarithmetic Problem
S E N D + M O R E M O N E Y Initial State : No two letters have the same value The sums of the digits must be as shown in the problem

Solving a Criptarithmetic Problem
Initial State M = 1 S = 8 or 9 O = 0 or 1  O = 0 N = E or E+1  N = E+1 C2 = 1 N+R > 8 E <> 9 N = 3 R = 8 or 9 2+D = Y or 2+D = 10+Y E = 2 C1=0 C1=1 2+D = Y N+R = 10+E R = 9 S = 8 2+D = 10 + Y D = 8+Y D = 8 or 9 D = 8 D = 9 Y = 0 Y = 1 conflict Send More Money Solving a Criptarithmetic Problem

A Criptarithmetic Problem
Ulasan : Solusi Cryptarithmetic Problem dengan Constraint satisfaction                                                      C3   C2   C1            S     E    N    D                           S     E     N    D         M    Ø    R    E   +                      M    Ø    R    E   +     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯                      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯    M Ø     N    E    Y                       M Ø    N    E    Y C3 / C2 / C1 ( C ) = Carry yang bernilai 1 atau 0.

A Criptarithmetic Problem
Initial state : [if !supportLists] 1.  [endif]  No two letters have the same value. ( masing-masing huruf hanya memiliki 1 nilai dengan range [0-9] ) [if !supportLists]2.  [endif] The sums of the digit must be as shown in the problem. Jumlah digit antar huruf musti sama dengan soal. Mis : S+M = MØ, maka S+M harus bernilai belasan agar tercapai 2 digit) Steps for solving the problem

A Criptarithmetic Problem
S + M = MØ  nilai  S dan M harus berkisar diantara [0-9], karena hanya 1 digit. Maka nilai M adalah 1 (M = 1) karena  S+M+C3 tidak bisa lebih besar dari 19. Karena M = 1, maka (S + 1(M) + C3 = 1(M)Ø) nilai S adalah 8(+1) atau 9 agar didapat 2 digit nilai (10 atau 11). 8 (+1) maksudnya 8 ditambah Carry(C3). Nilai Ø adalah 0 (Ø = 0) karena  S + 1(M) + C3 harus bernilai 10 supaya didapat 2 digit. Nilai 11 bisa didapat kalau menggunakan S = 9 dan C3 = 1, tapi nilai 1 sudah buat M, karena itu nilai  Ø tidak boleh 1. Kemungkinan 1 :  S = 8 , C3 = 1 , Ø = 0 E + Ø = (1) N  nilai E + Ø harus bernilai min 10 agar bisa didapat nilai C3 = 1

A Criptarithmetic Problem
C2 + E + Ø = N ,  (1+) 9(E) + 0(Ø) = (1)N , maka 10 = (1)N maka N = 0,hal ini menciptakan kontradiksi karena nilai N = Ø. Jadi kemungkinan ini salah Kemungkinan 2 : S = 9 , C3 = 0 , Ø = 0 E + Ø = N,  C2 + E + Ø = N , maka nilai C2 harus 1 karena nilai E tidak boleh sama dengan  N. Didapat persamaan 1 + E + 0 = N, maka N = E+1. Karena Nilai pasti tidak didapat, maka  kita jalankan langkah 1. N + R = E (hasil disini harus bernilai belasan agar C2 = 1),D + E = Y. Langkah 1 sudah dijalankan , tapi tidak ketemu nilai variabel, karena itu kita jalankan langkah 4.

A Criptarithmetic Problem
Kita mulai dengan tebakan kalo E = 2, maka N = 3. Pemilihan nilai E, karena variabel E  paling banyak muncul dan paling banyak berinteraksi dengan huruf lain. C1 + N + R = (1)E , C R = (1)2, berapa nilai C1 + R + 3 agar didapat nilai 12? . Jawabannya  : C1 = 1, R = 8. Lalu kita masukan ke persamaan lanjutan, D + E = Y (Hasil disini harus belasan agar didapat C1 = 1), D + 2 = Y, dari sini didapatkan kesimpulan bahwa kemungkinan ini tidak mungkin, karena sebesar apapun nilai D + 2 tidak akan mencapai nilai belasan. Kita lanjutkan tebakan kalo E = 3, maka N = 4. C1 + N + R, C1 +  4 + R = (1)3, berapa C1 + R + 4 agar didapat 13? R = 8 dan C1 = 1.

A Criptarithmetic Problem
Kita masukan ke D + E = (1)Y, kemungkinan ini tidak mungkin karena D + 3 hanya bernilai paling besar 10(D = 7), dan menyebabkan Y = 0. (Ø = 0) Sekarang jika E = 4 ,maka N = 5. C1 + N + R, C R = (1)4, berapa C R  agar didapat 14 ? R = 8 dan C1 = 1. Kita masukan ke D + E = (1)Y kemungkinan ini tidak mungkin karena D(7) + 4 hanya bernilai paling besar 11, dan menyebabkan Y = 1. (M = 1) Sekarang jika E = 5 ,maka N = 6. C1 + N + R, C R = (1)5, berapa C R  agar didapat 15 ? R = 8 dan C1 = 1. Kita masukan ke D + E = (1)Y kemungkinan ini mungkin karena D(7) + 5  bernilai paling besar 12, dan menyebabkan Y = 2. Didapatkan jawaban, maka kita jalankan langkah 2.

A Criptarithmetic Problem
Jawaban nilai-nilai variabel agar didapat hasil yang sesuai dengan soal : M = 1                   C3   C2  C1                            0    1    1 Ø = 0                    S     E     N    D                      9    5    6    7 S  = 9    —>          M    Ø    R    E   +     —>       1    0    8    5   +       E  =  5             ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯              ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ N = 6                M Ø    N    E    Y                   1 0    6    5    2 R  = 8 D = 7 Y = 2 C1 = 1 C2 = 1 C3 = 0 Semoga Bisa Dimengerti

3.6 Means-ends analysis Collection of search strategy that can reason either forward or backward, but for given problem, one direction or the other must be chosen. A mixed strategy would make it possible to solve the major part of problem first and then go back and solve the small problem that arise “gluing” the big pieces together. The mean-ends analysis process centers around the detection of differences between the current state and the goal state.

The Robot ’s Operators Operator Preconditions Results PUSH (obj,loc)
at(robot,obj)  at(obj,loc)  large(obj)  at(robot,loc) clear(obj)  armempty CARRY(obj,loc) at(robot,obj)  small(obj) WALK(loc) none PICKUP(obj) at(robot,obj) holding(obj) PUTDOWN(obj)  holding(obj) PLACE(obj1,obj2) at(robot,obj2)  On(obj1,obj2) holding(obj1)

A Difference Table Push Carry Walk Pick up Put down Place Move object
* Move robot Clear object Get object on object Get arm empty Be holding object

Means-ends analysis The Progress of The Means-Ends Analysis Method

Algorithm : Means-Ends Analysis
Compare CURRENT to GOAL.If there are no differences between them, then return. Otherwise, select the most important difference and reduce it by doing the following until success or failure is signaled : Select an as yet untried operator O that is applicable to the current difference. If there are no such operators, then signal failure. Attempt to apply O to CURRENT. Generate descriptions of two states : O-START, a state in which O ‘s preconditions are satisfied and O-RESULT, the state that would result if O were applied in O-START.

Algorithm : Means-Ends Analysis
If (FIRST-PART  MEA(CURRENT,O-START)) And (LAST-PART  MEA(O-RESULT,GOAL)) are succesful, the signal success and return the result of concatenating FIRST-PART,O, and LAST-PART.

<< CLOSING>>
End of Pertemuan 4 Good Luck

Presentasi serupa