Download Constraint Programming: Bounds Consistency and Algorithms for Solving Inconsistencies and more Study notes Computer Numerical Control in PDF only on Docsity! Constraint Programming Solutions to problems on consistency 1. โข if Y has a singleton domain {v} and either v = min(X) or v = Max(X) then remove v from the domain of X โข if Y has an empty domain, then set the domain of X to the empty set. % The constraint is now bounds consistent from X to Y โข if X has a singleton domain {v} and either v = min(Y ) or v = Max(Y ) then remove v from the domain of Y โข if X has an empty domain, then set the domain of Y to the empty set. % The constraint is now bounds consistent from Y to X % Bounds consistency from X to Y has not been destroyed. 2. (a) A2 is correct. Counterexample to A1: X = 1โ Y = 1 where Dom(X) = {2}, Dom(Y ) = โ
. A1 yields Dom(X) = {2}, Dom(Y ) = โ
. This is wrong since the assignment of X to 2 cannot be extended to a solution. (Note: Correct algorithm should set Dom(X) = Dom(Y ) = โ
.) Counterexample to A3: X = 1โ Y = 1 where Dom(X) = {1}, Dom(Y ) = {2, 3}. A3 yields Dom(X) = {1}, Dom(Y ) = {1}. This is wrong since the assignment of X to 1 cannot be extended to a solution. (Note: Correct algorithm should set Dom(X) = Dom(Y ) = โ
.) (b) Counterexample to A2: X = 1โ X = 2, where Dom(X) = {1, 2}. A2 yields Dom(X) = {1, 2}. This is wrong since the assignment of X to 1 cannot be extended to a solution. It is also wrong because 1 has been added to the domain of Y . (Note: Correct algorithm should set Dom(X) = {2}.) (c) if c1 6= c2 then set Dom(X) to Dom(X)โ {c1}. 3. algorithm XC-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; if (x,y) is labelled โaโ then REVISEac(x,y) if REVISEac(x,y) changed min(x) or max(x) then to Q add all arcs of G that go into x, except (y,x) else if this changed the domain of x then to Q add all โaโ arcs of G that go into x, except (y,x) if (x,y) is labelled โbโ then REVISEbc(x,y) if REVISEbc(x,y) changed the domain of x then to Q add all arcs of G that go into x The key insight is that a โbโ arc only needs to be put on Q if the minimum or maximum elements of the domain of the constrained variable are pruned. Another point to notice is that if REVISEbc(x,y) changed the domain of x then the arc (y,x), which is a โbโ arc, needs to be put back on Q. 1