You are on page 1of 1

CS-E3200 Spring 2017

Discrete Models and Search


Tutorial 5

Demonstration problems

1. Consider the CSP

hC1 (x, y, z), C2 (x, z); x {1, 2, 3}, y {1, 2, 3}, z {1, 2, 3}i

where C1 = {(1, 1, 2), (1, 1, 3), (1, 2, 3), (2, 1, 3)}, and
C2 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (3, 2)}
Apply the Projection rule introduced in the lecture slides until the CSP becomes
hyper-arc consistent.

2. Consider the CSP

hC1 (x, y, z), C3 (x, z), C3 (y, z), C3 (x, y); x {1, 2, 3}, y {1, 2, 3}, z {1, 2, 3}i

where C1 is the same as in the previous problem and

C3 = {(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)}.

Simulate a run of the MCH algorithm starting from the initial assignment {x 7
1, y 7 1, z 7 1}.

Homework problems

3. Simulate the behaviour of the Solve procedure (introduced in the lecture slides)
when the CSP

hC1 (z, y, x), C3 (x, z), C3 (y, z), C3 (x, y); x {1, 2, 3}, y {1, 2, 3}, z {1, 2, 3}i

is given as input, the goal is to find one solution, Constraint Propagation is


based on the Projection rule, splitting is based on labeling and search (Proceed
by Cases) on depth first backtracking search. Here C1 is as given in the first
problem and C3 in the second.

4. Consider the global cardinality constraint gccl,u (X) where X is a vector (x1 , . . . , xn )
of variables and l, u are functions from the union of domains D1 , . . . , Dn of vari-
ables x1 , . . . , xn to non-negative integers. A tuple t = (a1 , ..., an ) D1 Dn
belongs to gccl,u (X) iff l(ai ) #(ai , t) u(ai ) for all 1 i n, where #(ai , t)
denotes the number of times the value ai appears in the tuple t.
(i) Express the alldiff(X) constraint using gccl,u (X).
(ii) Consider the constraint gccl,u (x1 , . . . , x8 ) where for all i = 1, . . . , 8, Di =
{1, 2, 3} and for all a {1, 2, 3}, l(a) = 0, u(a) = 2. Is this constraint hyper-arc
consistent? Give reasons for your answer.

You might also like