Answer to class exercise on 0

advertisement
Answer to
Exercises on 0-1 Variable Representations
BSNS5230, J. Wang
There are four projects. Four binary variables are defined as below:
Yi = 1 if project i is selected, and
Yi = 0 otherwise,
for i = 1, 2, 3, 4.
Represent the following conditions by using constraints with the binary variables:
1. “At least two of the four projects must be selected”.
Y1+Y2+Y3+Y4  2
2. “Among project 1, project 2 and project 4, exactly one is selected”.
Y1+Y2+Y4 = 1
3. “At most three projects of the four can be selected”.
Y1+Y2+Y3+Y4  3
4. “Project 2 and project 3 must go together. That is, it is not allowed to select one while
deselect the other”.
Y2 = Y3
=>
Y2 Y3 = 0
5. “The four projects can not be all selected.”
Y1+Y2+Y3+Y4  3
6. “If project 4 is selected, then project 2 must be selected; but if project 4 is not selected,
then there is no restriction on project 2”.
Y4  Y2
=>
Y2 +Y4  0
7. (1) If project 1 is selected then project 4 must not be selected:
Y1  1 Y4
=>
Y1 +Y4  1;
(2) If project 1 is not selected, then project 4 must be selected:
1 Y1  Y4
=>
Y1 +Y4  1;
(3) If project 4 is selected then project 1 must not be selected:
Y4  1 Y1
=>
Y1 +Y4  1;
(4) If project 4 is not selected then project 1 must be selected:
1 Y4  Y1
=>
Y1 +Y4  1.
Putting (1), (2), (3), and (4) together, we have:
Y1 +Y4 = 1.
We may also first reword the given four statements. Note that statement (1) and
statement (3) are logically identical (They are called contraposition: “if A then B” is
equivalent to “if not-B then not-A”), and statement (2) and statement (4) are logically
identical (contraposition). That is, statements (3) and (4) are redundant. We need, and
only need, to focus on statements (1) and (2). Statements (1) and (2) means exactly one
of projects 1 and 4 is selected. Therefore, we have:
Y1 +Y4 = 1.
8. “If project 1 is not selected, then project 3 is not selected (no restriction on project 3 if
project 1 is selected)”. (Can you reword it to facilitate formulation?)
Rewording with the contraposition:
If project 1 is not selected, then project 3 is not selected
= If project 3 is not (not selected) then project 1 is not (not selected)
= if project 3 is selected then project 1 is selected.
Therefore, we have
Y3  Y1
=>
Y1 +Y3  0
Problems 9 and 10:
Let X1 be an integer between 0 and 20 (not binary!).
Let Y1 be a binary variable, i.e., Y1 can be 0 or 1 only.
9. Write a constraint to represent “If X1=0 then Y1=0, and if X1>0 then Y1 can be either 0
or 1”.
X1  Y1
=>
X1 Y1  0
10. Write a constraint to represent “If X1>0 then Y1=1, and if X1=0 then Y1 can be either
0 or 1”.
X1  MY1
=>
X1 MY1  0
where M is a large number (in this particular problem, M is at least 20.)
Note: The constraints in question 9 and 10 together indicate such a relationship between
variables X1 and Y1:
If X1 is zero, then Y1 must be zero; and if X1 is not zero, then Y1 must be 1.
Such a relation is what we want to formulate in the “fixed charge problem”.
Download