130 likes | 260 Views
15-381 Artificial Intelligence. Means-Ends Analysis and Constraint Propagation Jaime Carbonell 24 January 2002 Topics Covered: Homework 1 (generalized state-space search) Means-Ends Analysis (backchaining) Search Control Rules in MEA Constraint-Based Search.
E N D
15-381 Artificial Intelligence Means-Ends Analysis and Constraint Propagation Jaime Carbonell 24 January 2002 Topics Covered: • Homework 1 (generalized state-space search) • Means-Ends Analysis (backchaining) • 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 expected from Veloso (later lecture)
Means-Ends Analysis • Backchaining/Subgoaling Search • Let Scurr:= S0 • If Scurr = SG, then go to next goal (or DONE) • Let OPSapp := match(SG {POST(Opi)}) • If OPSapp= empty, then FAIL • Else Select OP OPSapp, (save alt's) • If match(PRE(OP), Scurr), a. let Scurr:= apply(OP, Scurr) b. Go to step 2 • Else (i.e. if NOT(match(PRE(OP), Scurr))) a. MEA(SG):= {unmatched(PRE(OP))}, SI := Scurr) b. If fail, go to step 4 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: Don’t polish before machining TYPE: REJECT PRE: Goals(Mill(p,f), Drill(p,l,d,s), Polish(p)) POST: Polish(p)
Constraint-Based Search • Satisfiability problems • Find consistent bindings to a set of variables • Consistent = satisfy all constraints • Example: (X v Y) & (~X v ~Y) • Example: Match applicants to positions • Two families of search methods apply • State-space search on bindings • Satisfiability-search on constraints
Constraint-Based Search • Example: How fast can you solve this? 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 • 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 A = {1,2,3,4} B = {3,4} C = {1,2,3,4} D = {3,4} B4 B3 A = {1,2,4} C = {1,2,4} D = {4} A = {1,2,3} C = {1,2,3} D = {3} FAILURE D4 D3 A = {1,2} C = {1,2}C = {2} C2 A = {1} SUCCESS A1
(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