Sunteți pe pagina 1din 1

CS-E3200 Discrete Models and Search Tutorial 4

Solutions to demonstration problems


1. C is the less-or-equal-to relation () and hence it is equivalent to
z y x z,
which is equivalent to
x = y = z.
Hence, the feasible solutions are (1, 1, 1), (2, 2, 2) and (3, 3, 3).
2. The task is to formulate the SET-COVER decisions problem as a con-
straint satisfaction problem. Define n (binary) variables xj with domains
{0, 1}, where 1 j n, as
(
1 if set Sj is chosen to be in the cover.
xj =
0 otherwise.
Let us use the short-hand notation introduced in the lecture, that lets us
specify a constraint by a condition that is required to hold on an ordered
subset of the set of variables. The constraint that the selection of sets that
is determined by the assignment to the variables xj covers the elements
in U can then be formulated as the condition
[
cond1 (x1 , x2 , . . . , xn ) := Sj = U.
j:xj =1

Note that the expression on the right forms the union of all the sets j
such that the value of their variable xj was chosen to be 1. Additionally,
one requires the constraint that not more than k sets are chosen to be
part of the cover. This constraint can be formulated via the condition
cond2 (x1 , x2 , . . . , xn ) that requires
X
cond2 (x1 , x2 , . . . , xn ) := xj k,
j

which completes the CSP encoding.


3. The TSP optimization problem can be encoded by modeling a tour as a
permutation of the cities. Define n variables xi , 1 i n, each with
domain {1, 2, . . . , n}, which determine the i-th city in the permutation.
We then introduce constraints that ensure that the value assignment to
the variables x1 , . . . , xn is indeed a valid permutation (each city appears
exactly once). This constraint has the form of the NotEq constraint of the
lecture notes.
N otEq(xi , xj ) := xi 6= xj
and we add one such constraint NotEq(xi , xj ) for every pair 1 i, j n
such that i < j. Then the objective function is defined as
n1
X
dxi ,xi+1 + dxn ,x1 .
i=1

S-ar putea să vă placă și