Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Constraint Propagation influenced by Dr. Rina Dechter, “Constraint Processing”"— 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 -v1v2v3v4-v1v2v3v4 choosing v 4 satisfy constraints on scopes containing v 4 with v 1, v 2, v 3 choosing v 4 satisfy constraints on scopes containing v 4 with v 1, v 2, v 3

5 example - red/green graph red green red green red green v1v1 v2v2 v3v3 -v1v2v3-v1v2v3 

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 x 1, D 1 = {1,2,4}{1,2} x 2, D 2 = {1,2,4}{2,4} C 12 : {(x 1,x 2 ) | x 1 < x 2 } = {(1,2),(1,4),(2,4)} x1124x1124 x1124x1124 x2124x2124 x2124x2124 x112.x112. x112.x112. x2.24x2.24 x2.24x2.24 arc-inconsistentarc-consistent

8 enforcing arc-consistency reduces domains  algorithm to make x i arc-consistent w.r.t. x j Revise(D i ) w.r.t. C ij on S ij ={x i,x j } for each a i  D i if no a j  D j such that (a i,a j )  C ij delete a i from D i performance O(k 2 ) 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 x 1, D 1 = {1,2,4} C 12 : {x 1 = x 2 } x 2, D 2 = {1,2,4} C 23 : {x 2 = x 3 } x 3, D 2 = {1,2,4} C 31 : {x 1 = 2*x 3 } x1124x1124 x1124x1124 x2124x2124 x2124x2124 x3124x3124 x3124x3124

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

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

13 loopholes in arc-consistency x 1, D 1 = {1,2} C 12 : {x 1 ≠ x 2 } x 2, D 2 = {1,2} C 23 : {x 2 ≠ x 3 } x 3, D 2 = {1,2} C 31 : {x 1 ≠ x 3 } x112x112 x112x112 x212x212 x212x212 x212x212 x212x212 ≠≠ ≠

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(x 1, …, x m ) - equivalent of permutation set  who owns the zebra? problem fixed sum, cumulative maximum

15 constraints in partial solution search space example problem: V = {x,y,l,z}, D = {D x, D y, D l, D z } D x ={2,3,4}, D y ={2,3,4}, D l ={2,5,6}, D z ={2,3,5} C = {C zx, C zy, C zl }: z must divide other variables 2,3,4 y 2,5,6 l 2,3,4 x 2,3,5 z

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

17 reducing space size 1.variable ordering

18 reducing space size 2.arc-consistency

19 reducing space size 2.path-consistency (tightening) C xl, C xy, C yl (slashed subtrees)

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

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

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 look-ahead consistency SELECT-FORWARD (D` k+1 ) while (!D` k+1.empty()) a = D` k+1.pop() if (CONSISTENT(x k+1 =a)) for (i; k+1 < i ≤ n) for all b  D` i if(!CONSISTENT(x i =b)) remove b from D` i if(D` i.empty()) // x k+1 =a is dead end reset all D` j, j>k+1 else return a return null SELECT-VALUE(D` k+1 ) while (!D` k+1.empty()) a = D` k+1.pop() if ( CONSISTENT (x k+1 =a)) return a return null SELECT-VALUE(D` k+1 ) while (!D` k+1.empty()) a = D` k+1.pop() if ( CONSISTENT (x k+1 =a)) return a return null

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


Download ppt "Constraint Propagation influenced by Dr. Rina Dechter, “Constraint Processing”"

Similar presentations


Ads by Google