Introduction to Constraint Programming Examination Problems Batch 1

advertisement
Introduction to Constraint Programming
Examination Problems Batch 1
Please return your solutions to Jan Maluszynski by March 25, 1999. You can
deliver them in the classroom, send them by the internal mail, or e-mail them as
a postscript file. The commented programs should be included when applicable.
1. I know three people Pat, Quincy and Ray. I like at least one of them. If I
like Pat but not Ray then I also like Quincy. I like both Ray and Quincy or
none of them. Describe the facts as Boolean constraints and use SICStus
Prolog to check whom I like for sure, and whom I may dislike.
2. Consider the domain of set constraints where the primitive constraints are
formed with the binary set operators ⊆, ⊂ and = applied to set variables
or to the constant ∅ representing the empty set. Design a complete solver
for this domain. Discuss applicability of the projection and simplification
techniques discussed in Chapter 2 to this constraint domain. What can
you say about checking implication and equivalence?
3. Consider the CSP of the constraint Z = Y +2X ∧X ≥ 2∧Z > Y +2 on the
domains D(X) = D(Y ) = D(Z) = [1..5]. Transform it to an equivalent
CSP which is (a) node-consistent, (b) arc-consistent, (c) bound-consistent.
Compare your computed results with the behavior of SICStus Prolog finite
domain solver and CHIP finite domain solver on the original CSP. Give an
example CSP which demonstrates incompleteness of the CHIP or SICStus
finite domain solver.
4. The organizers of a congress booked 3 conference rooms for 2 days. The
congress has 11 half-day sessions (A,B,...,K). The sessions in the sets AJ,
JI, IE, CF, FG, DH, BD, KE, BIHG, AGE, BHK, ABCH, DFJ must not
be scheduled simultaneously. The session E should precede the session J,
and the sessions D and F should precede the session K. Session A should
be placed at the beginning of the first day and session J at the end of
the second day. The afternoon of the second day should include at most
2 sessions. Formulate these constraints as finite domain constraints in
CHIP or in SICStus Prolog. Show the result of constraint propagation
after setting all the constraints and show all possible schedules. Explain
the order in which the schedules are computed.
1
5. A post office requires different numbers of full-time employees on different
days of the week. The number of full-time employees required on each day
is as follows:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
17
13
15
19
14
16
11
Trade union rules state that each full-time employee must work five consecutive days and then receive two days off. For example, an employee
who works Monday to Friday must be off on Saturday and Sunday. The
post office wants to meet its daily requirements using only full-time employees and it wants to minimize the number of full-time employees that
must be hired. Formulate and solve this integer optimization problem
in SICStus Prolog or in CHIP. Use the rational solver to compute the
minimum in rational domain and use this result to construct an integer
solution. The solution should provide the minimal number of employees
and a work schedule during the week.
2
Download