

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Constraint Programming Problems on consistency
Algorithm A1: if Dom(X) = ∅ then set Dom(Y ) to ∅ else if Dom(X) = {cx} then set Dom(Y ) to Dom(Y ) − {v|v 6 = cy}; if cy 6 ∈ Dom(Y ) then set Dom(X) to Dom(X) − {cx}; Algorithm A2: if Dom(X) = ∅ then set Dom(Y ) to ∅ else if Dom(X) = {cx} then set Dom(Y ) to Dom(Y ) − {v|v 6 = cy}; if Dom(Y ) = ∅ then set Dom(X) to ∅ else if cy 6 ∈ Dom(Y ) then set Dom(X) to Dom(X) − {cx}; Algorithm A3: if Dom(X) = ∅ then set Dom(Y ) to ∅ else if Dom(X) = {cx} then set Dom(Y ) to {cy}; if Dom(Y ) = ∅ then set Dom(X) to ∅ else if cy 6 ∈ Dom(Y ) then set Dom(X) to Dom(X) − {cx};
(a) Given a constraint of this form in which X and Y are distinct variables, exactly one of these three algorithms is guaranteed to make the given constraint arc-consistent. Which is it? For each of the other two algorithms argue, through use of an example, that it can fail to make the given constraint arc-consistent. (b) If we assume that in this constraint X and Y are the same variable, then even the correct algorithm goes wrong. Through use of an example, show this. (c) Give an algorithm that takes a constraint of the form X = c 1 → X = c 2 and prunes the domain of X to make the constraint arc consistent without losing any solutions.
algorithm AC-3(G) Let Q be the set of (directed) arcs of G while Q not empty do select and remove any arc (x,y) from Q; REVISEac(x,y); if REVISEac(x,y) changed the domain of x then to Q add all arcs of G that go into x, except (y,x);
The input to the AC-3 algorithm is a directed constraint graph; every binary constraint between variables x and y is represented by an arc from x to y (written (x,y)) and an arc from y to x (written (y,x)). We assume that the graph contains no self arcs, (x,x), and that there is at most one arc from any node to any other node. REVISEac is a procedure that takes an arc (x,y) and achieves arc consistency from x to y. For this question you are to present a new algorithm XC-3 that is to take a graph in the same form as that given to AC-3 except that each edge is labelled with either “a” or “b”. These labels are such that every arc (x,y) has the same label as its inverse arc (y,x). The algorithm is to prune the domains of the variables so that 1) no solutions to the constraints are lost, 2) every constraint whose arcs are labelled “a” is arc consistent, and 3) every constraint whose arcs are labelled “b” is bounds consistent. Your algorithm may use REVISEac and REVISEbc without specifying their operation. REVISEbc is a procedure that takes an arc (x,y) and achieves bounds consistency from x to y.
1
Your algorithm should follow the spirit of AC-3 by not adding more arcs to Q than necessary.