3.4 Problem Reduction A Simple AND - OR Graph

advertisement
IF614 – Inteligensia Semu
04 / 01 - 10
3.4 Problem Reduction
A Simple AND - OR Graph
Goal : Acquire Tv set
Goal: Steal
TV set
Goal: Earn some
money
Goal : Buy
TV set
AND - OR Graphs
A
A
(9)
(38)
B
C
D
(5)
(3)
(4)
E
(5)
B
C
D
(17)
(9)
(27)
F
G
H
I
J
(10) (3)
(4)
(15)
(10)
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 02 - 10
Algoritm : Problem Reduction
1. Initialize the graph to the starting node
2. Loop until the starting node is labeled SOLVED
or until its cost goes above FUTILITY :
a) 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
b) 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
c) 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
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 03 - 10
The Operation of Problem
Reduction
Before step 1
Before step 2
A (5)
A
(6)
(9)
Before step 3
A
C
D
(3)
(4)
(5)
Before step 4
A
(9)
B
(3)
B
(12)
C
(4)
D (10)
B (6)
C
(4)
D (10)
(10)
E
(4)
(10)
F
(4)
G
(5)
H
(7)
E
(4)
F
(4)
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 04 - 10
3.5 Constraint Satisfaction
Algorithm : Constrain Satisfaction
1. 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 :
(a) Select an object OB from OPEN.
Strengthen the set of constraints that apply
to OB.
(b) 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.
(c) Remove OB from OPEN.
2. If solution, then quit and report the solution.
3. If contradiction, then return failure.
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 05 - 10
4. If neither, then guess : Loop until a solution is
found or all possible solution have been
eliminated :
(a) Select an object whose value is not yet
determined & select a way of strengthening
the constraints on that object.
(b) Recursively invoke constraint satisfaction
with the current set of constraints
augmented by the strengthening constraint
just selected.
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 06 - 10
A Criptarithmetic Problem
Problem :
Send
More
+
Money
Initial State :
 No two letters have the same value
 The sums of the digits must be as
shown in the problem
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 07 - 10
Solving A Criptarithmetic Problem
Initial
State
Send
+ More
Money
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
E=2
N = 3
R = 8 or 9
2+D = Y or 2+D = 10+Y
C1=0
2+D
N+R
R =
S =
C1=1
= Y
= 10+E
9
8
2+D = 10 + Y
D = 8+Y
D = 8 or 9
D=8
Y=1
Y=0
conflict
D=9
Y=1
conflict
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 08 - 10
3.6 Means-ends analysis
A Robot ’s Operators
Operator
Preconditions
PUSH (obj,loc)
Results
at(robot,obj) 
at(obj,loc) 
large(obj) 
at(robot,loc)
clear(obj) 
armempty
at(robot,obj) 
at(obj,loc) 
small(obj)
at(robot,loc)
WALK(loc)
none
at(robot,loc)
PICKUP(obj)
at(robot,obj)
holding(obj)
PUTDOWN(obj)
holding(obj)
 holding(obj)
PLACE(obj1,obj2)
at(robot,obj2) 
On(obj1,obj2)
CARRY(obj,loc)
holding(obj1)
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 09 - 10
A Difference Table
Push Carry Walk Pick
up
Move object
*
Put
Place
down
*
Move robot
*
Clear object
*
Get object on object
*
Get arm empty
*
Be holding object
*
*
The Progress of The Means-Ends
Analysis Method
A
B
C
Start
D
Push
A
Goal
B
Walk Pick up Put down Pick up Put down Push
Start
C D
E
Place
Goal
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
IF614 – Inteligensia Semu
04 / 010 - 10
Algorithm : Means-Ends Analysis
1. Compare CURRENT to GOAL.If there are
no differences between them, then return.
2. Otherwise, select the most important
difference and reduce it by doing the
following until success or failure is
signaled :
(a) Select an as yet untried operator O
that is applicable to the current
difference. If there are no such operators,
then signal failure.
(b) Attempt to apply O to CURRENT.
Generate descriptions of two states : OSTART, a state in which O ‘s
preconditions are satisfied and ORESULT, the state that would result if O
were applied in O-START.
(c) 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 FIRSTPART,O, and LAST-PART.
BINA NUSANTARA
Edisi :
1
Revisi :
3
Sept - 1999
Download