Sie sind auf Seite 1von 12

15-381 Artificial Intelligence

Means-Ends Analysis and


Constraint Propagation
Jaime Carbonell
4 September 2001

Topics Covered:
Means-Ends Analysis
Search Control Rules in MEA
Constraint-Based Search

SearchPlanning:
Parameterized Operations
Multi-State Transitions
Instead of: Opi,j: Si Sj, We have Opk,l: {Sk}{ Sl}

Preconditions and Post-Conditions


Conjunctive set of first-order predicates
Arguments can be constants or (typed) variables
Intentional description of subset of all states

Pre-image {Sk} states where preconditions are true


Post-image {S1} states where post-conditions are true

Requires Consistent variable bindings within and


across preconditions and post-conditions

SearchPlanning:
Parameterized Operations
First Example
OPERATOR DRIVE-CAR(<car>, <driver>, <keys>, <loc-1>)
[PRE: (AT <car> <loc-1>)
(AT <driver> <loc-1>)
(CONTAINS-GAS <car>)
(HAVE <keys> <driver>)
(CORRESPOND <keys> <car>)]
[POST: (AT <car> <loc-2>)
(AT <driver> <loc-2>)
(NOT (AT <car> <loc-1>))
(NOT (AT <driver> <loc-1>))]]

SearchPlanning:
Parameterized Operations
Second Example
(Previous example: LISP-style, Current one: PROLOG-style)
OPERATOR: move-robot(r,x,y)
TYPE:
ROBOT(r) & LOC(x) & LOC(y)
PRE:
AT(r,x) & EMPTY(y) & CONNECTED(x,y)
POST:
AT(r,y), NOT(AT(r,x))
OPERATOR: pick-up(r,z)
TYPE:
ROBOT(r) & LOC(x) & LOC(y)
PRE:
AT(r,x) & AT(z,y) & NEXT-TO(x,y) & NOT(holding(r,w,))
POST:
HOLDING(r,z)
NOT(AT(z,y))

SearchPlanning:
Parameterized Operations
Interpretation
A plan is an o-path: S0 followed by a sequence of
instantiated operators which result in the goal state.
Variables match objects in state of specified types
only for which the preconditions hold at plan
execution time.
Planning can proceed by forward or backward (or
any other) search method.
More on Planning from Veloso (later lecture)

Means-Ends Analysis
Backchaining/Subgoaling Search
1.
2.
3.
4.
5.
6.

Let Scurr:= S0
If Scurr = SG, then go to next goal (or DONE)
Let OPSapp := match(SG {POST(Opi)}) Goals(Mill(p,s), Drill(p,l,d),
Polish(p))
If OPSapp=empty, then BACKTRACK
Select OP OPSapp, (save alt's)
If match(PRE(OP), Scurr),
a. let Scurr:= apply(OP, Scurr)
b. Go to step 2

7.

Else (i.e. if NOT(match(PRE(OP), S curr)))


a. MEA(SG):= {unmatched(PRE(OP))}, SI := Scurr)
b. If fail, backtrack
c. If succeed, apply OP as above

Control Rules for MEA


Choice Points in MEA

Choose Operator, if several applicable


Choose Goal, if > 1 subgoals pending
Choose Variable Bindings, if > 1 tuple

Types of Control Rules

Select choose an alternative


and eliminate other contenders
Reject Reject an alternative
and retain other contenders
Prefer Try one alternative first
and retain others for possible backtracking

Control Rules for MEA


Example
CONTROL-RULE: Carry-before-move
TYPE:
SELECT
PRE:
Goals(Move(r,x,y), Pick-up(r,z,v)))
POST:
Pick-up(r,z)
CONTROL-RULE: Dont polish before machining
TYPE:
REJECT
PRE:
Goals(Mill(p,f), Drill(p,l,d,s), Polish(p))
POST:
Polish(p)

Constraints
Example
Find a way to fit components (1,2,3,4) into slots
(A,B,C,D) such that:

Each slot only takes one component


Slots are in LEFT-RIGHT sequence A, B, C, D
Slots A and C are T-shaped
Slots B and D are I-shaped
Components 1,2, are 3-pronged
Components 3,4 are 2-pronged
2-pronged fit into T-shaped or I-shaped
3-pronged fit only into T-shaped
Component 3 must be LEFT of component 2

Constraints
Least Commitment Method
1.
2.
3.
4.
5.
6.
7.

For each Variable find all legal unary-constrained


assignments.
If no assignments possible, return FAILURE
Assign most-constrained unassigned variable.
If all variables assigned, return SUCCESS
If the assigned variable is a member of a binary
constraint, propagate instantiation
Delete all residual un-viable assignments
Go to 2

Constraint-Based Search
B4

A = {1,2,3}
C = {1,2,3}
D = {3}
D3
FAILURE

A = {1,2,3,4}
B = {3,4}
C = {1,2,3,4}
D = {3,4}

B3
A = {1,2,4}
C = {1,2,4}
D = {4}
D4
A = {1,2}
C = {1,2}C = {2}
C2
A = {1}
A1
SUCCESS

(Dis)Advantages of Constraints
Reduce the search space
Early failure (upon constraint violation)
Generate minimal-uncertainty step (least
commitment strategy)

Only applicable to satisfiability problems


Finds an answer, not necessarily optimal
Not all problems can be cast as constraints to
satisfy

Das könnte Ihnen auch gefallen