1 / 24

Constraint Propagation

Constraint Propagation. influenced by Dr. Rina Dechter, “Constraint Processing”. why propagate constraints?. tightens networks leaves fewer choices for search by eliminating dead ends BUT propagating can be costly in resources tradeoff between constraint propagation and search

finn-potts
Download Presentation

Constraint Propagation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Constraint Propagation influenced by Dr. Rina Dechter, “Constraint Processing”

  2. why propagate constraints? • tightens networks • leaves fewer choices for search by eliminating dead ends BUT • propagating can be costly in resources • tradeoff between constraint propagation and search • “bounded constraint propagation algorithms”

  3. how constraints improve search • used in partial solution searches where the start state is root of search tree (no variables have assigned values) • at any level of tree, some variables are assigned, some are not • constraints reduce choice for next variable assigned

  4. how constraints improve search - v1 v2 v3 v4 choosing v4 satisfy constraints on scopes containing v4 with v1, v2, v3

  5. v1 red green v2 v3 red green red green example - red/green graph - v1 v2 v3    

  6. arc-consistency • local consistency property • involves binary constraint and its two variables any value in the domain of one variable can be extended by a value of the other variable consistent with the constraint

  7. arc-consistency example x1, D1 = {1,2,4} {1,2} x2, D2 = {1,2,4} {2,4} C12: {(x1,x2) | x1 < x2 } = {(1,2),(1,4),(2,4)} x1 1 2 4 x2 1 2 4 x1 1 2 . x2 . 2 4 arc-inconsistent arc-consistent

  8. enforcing arc-consistency reduces domains • algorithm to make xi arc-consistent w.r.t. xj Revise(Di) w.r.t. Cij on Sij={xi,xj} for each ai Di if no aj Dj such that (ai,aj)  Cij delete ai from Di performance O(k2) in domain size

  9. reducing search spaces • apply arc-consistency to all constraints in problem space • removes infeasible solutions • focuses search • arc consistency may be applied repeatedly to same constraints

  10. interaction of constraints: example x1, D1 = {1,2,4} C12: {x1 = x2} x2, D2 = {1,2,4} C23: {x2 = x3} x3, D2 = {1,2,4} C31: {x1 = 2*x3} x1 1 2 4 x2 1 2 4 x3 1 2 4

  11. AC-3 arc-consistency algorithm problem: R =(X,D,C) AC-3(R) q = new Queue() for every constraint Cij C q.add((xi,xj)); q.add((xj,xi)); while !q.empty() (xi,xj) = q.get(); Revise(Di) wrt Cij if(Di changed) for all k ≠i or j q.add( (xk,xi) performance O(c.k3) c binary constraints, k domain size

  12. arc-consistency • automated version of problem-solving activity by people - propagating constraints

  13. loopholes in arc-consistency x1, D1 = {1,2} C12: {x1 ≠ x2} x2, D2 = {1,2} C23: {x2 ≠ x3} x3, D2 = {1,2} C31: {x1 ≠ x3} x1 1 2 ≠ ≠ x2 1 2 x2 1 2 ≠

  14. stronger constraint checking • path-consistency extends arc-consistency to three variables at once (tightening) • global constraints -specialized consistency for set of variables • e.g., alldifferent(x1, …, xm) - equivalent of permutation set • who owns the zebra? problem • fixed sum, cumulative maximum

  15. z 2,3,5 x l y 2,3,4 2,5,6 2,3,4 constraints in partial solution search space example problem: V = {x,y,l,z}, D = {Dx, Dy, Dl, Dz} Dx={2,3,4}, Dy={2,3,4}, Dl={2,5,6}, Dz={2,3,5} C = {Czx, Czy, Czl}: z must divide other variables

  16. reducing search space size • variable ordering • arc-consistency (or path-consistency, etc) • pre-search check to reduce domains • during search check for consistency with values already assigned

  17. reducing space size • variable ordering

  18. reducing space size • arc-consistency

  19. reducing space size • path-consistency (tightening) • Cxl, Cxy, Cyl (slashed subtrees)

  20. dfs with constraints - detail • extending a partial solution xk-1 xk xk+1 4 SELECT-VALUE(D`k+1) while (! D`k+1 .empty()) a = D`k+1 .pop() if (CONSISTENT(xk+1=a)) return a return null // dead end 2 ? D`k+1 = {1,2,3,4}

  21. dfs algorithm with constraints dfs(X,D,C) returns consistent solution i=1, D`i = Di while (1≤ i ≤ n) // n=|X| xi = SELECT-VALUE(D`i) if(xi == null) // dead end i-- // backtrack else i++ D`i = Di if (i==0) return “no solution” return (x1, x2, …, xn)

  22. improving search performance • changing the resource balance between • constraint propagation and • search • do more pruning by consistency checking • many strategies • e.g., look-ahead algorithms

  23. SELECT-VALUE(D`k+1) while (!D`k+1.empty()) a = D`k+1 .pop() if (CONSISTENT(xk+1=a)) return a return null look-aheadconsistency SELECT-FORWARD(D`k+1) while (!D`k+1.empty()) a = D`k+1 .pop() if (CONSISTENT(xk+1=a)) for (i; k+1 < i ≤ n) for all bD`i if(!CONSISTENT(xi=b)) remove b from D`i if(D`i.empty()) // xk+1=a is dead end reset all D`j, j>k+1 else return a return null

  24. optimization algorithms • same strategies can be used in other search algorithms • greedy, etc • example problem - sudoku

More Related