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

Preview:

DESCRIPTION

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

Citation preview

Constraint Propagation

influenced by Dr. Rina Dechter, “Constraint Processing”

why propagate constraints? tightens networks leaves fewer choices for search by

eliminating dead endsBUT propagating can be costly in resources tradeoff between constraint propagation and

search “bounded constraint propagation algorithms”

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

how constraints improve search

-

v1

v2

v3

v4

choosing v4

satisfy constraints on scopes containing v4 with v1, v2, v3

example - red/green graph

redgreen

redgreen

redgreen

v1

v2 v3

-

v1

v2

v3

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

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

124

x2

124

x1

12.

x2

.24

arc-inconsistent arc-consistent

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

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

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

124

x2

124

x3

124

AC-3 arc-consistency algorithmproblem: 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 Cijif(Di changed)for all k ≠i or jq.add( (xk,xi)

performance O(c.k3) c binary constraints, k domain size

arc-consistency automated version of problem-solving

activity by people - propagating constraints

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

12

x2

12

x2

12

≠ ≠

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

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

2,3,4y

2,5,6l

2,3,4x

2,3,5z

reducing search space size

1. variable ordering2. arc-consistency (or path-consistency, etc)

i. pre-search check to reduce domainsii. during search check for consistency with

values already assigned

reducing space size1. variable ordering

reducing space size

2. arc-consistency

reducing space size2. path-consistency (tightening)

• Cxl, Cxy, Cyl (slashed subtrees)

dfs with constraints - detail

extending a partial solution

xk-1

xk

xk+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(xk+1=a)) return areturn null // dead end

dfs algorithm with constraints dfs(X,D,C) returns consistent solutioni=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)

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

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 bD`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 areturn null

SELECT-VALUE(D`k+1)

while (!D`k+1.empty())

a = D`k+1 .pop()

if (CONSISTENT(xk+1=a)) return areturn null

optimization algorithms same strategies can be used in other

search algorithms greedy, etc

example problem - sudoku

Recommended