Beruflich Dokumente
Kultur Dokumente
4. Sign 1 is wrong
6. Sign 3 is wrong
In addition, the prisoner is informed that only one room contains a lady;
each of the others either contain a tiger or are empty. The sign on the door
of the room containing the lady is true, the signs on all the doors containing
tigers are false, and the signs on the doors of empty rooms can be either true
or false.
The prisoner is told whether or not room eight is empty and this know-
ledge helps him to find the only solution (see [3] and [2]).
Modeling Steps
In the same way as in model tiger1.lpl we introduce two sets for the doors
(d) and the prices (p). Now we have 9 doors and three prices.
1
2. Furthermore, 9 binary variables (t{d}) are introduces, saying whether
the statement on door d is true or false.
The complete model code in LPL for this model is as follows (see [1]):
FOR{d} DO
MINIMIZE any: x[d,’Lady’];
WRITE ’Behind door %1s is a %5s\n’:
d , if(x[d,’Lady’],’Lady’,’???’);
END
END
We minimize 9 times, for each door once (in the FOR-loop. Each time, the Solution
variable x[d,’Lady’] is minimized. If the result (the optimum) is 1 then
a lady is behind the door, otherwise we do not know. Clearly, the lady is
2
behind door 7. However, when the constraint E is replaced by constraint E1
(’door 8 is empty’), nothing can be deduced about the lady.
Question 1 (Answer to 1)
3. Suppose we add the statement “there are exactly 3 tigers in three doors”
to the original problem. What is the solution?
Answer 1 (Question of 1)
1. We replace the two statements within the FOR loop by the following:
Using E, nothing can be said. However, if behind the door 8 the room
is empty then there are at least three tigers (in doors 2, 8, and 9).
2. In this case, we cannot deduce where the lady is, whether behind door
8 the room is empty or not. The constraint D1 must be changed to the
following:
F: SUM{d} x[d,’Tiger’] = 3;
3
This problem has a unique solution (Empty, Tiger, Empty, Empty, Em-
pty, Empty, Lady, Tiger, Tiger). To check this we use the following loop
(27 optimizations):
FOR{d,p} DO
MINIMIZE any: x[d,p];
IF x THEN WRITE ’Behind door %1s is a %5s\n’: d,p; END
END
Literatur
[1] T. Hürlimann. Reference Manual for the LPL Modelling Language. http:
//www.virtual-optima.com.
[3] R. Smullyan. The Lady or The Tiger. Oxford University Press, 1991.