# Exercises on 0-1 Variable Representations ```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”.
2. “Among project 1, project 2 and project 4, exactly one is selected”.
3. “At most three projects of the four can be selected”.
4. “Project 2 and project 3 must go together. That is, it is not allowed to select one while
deselect the other”.
5. “The four projects can not be all selected.”.
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”.
7. “If project 1 is selected then project 4 must not be selected; and if project 1 is not
selected, then project 4 must be selected; and if project 4 is selected then project 1 must
not be selected, and if project 4 is not selected then project 1 must be selected. ” (Hint:
Reword this first)
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?)
(Continued on the back)
For Problem 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&gt;0 then Y1 can be either 0
or 1”.
10. Write a constraint to represent “If X1&gt;0 then Y1=1, and if X1=0 then Y1 can be either
0 or 1”.
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”.
```