1

I have this problem: I'm building an integer linear program, which I'm going to give to an ILP solver. I have a binary variable Y which can be either 1 or 0 and an integer variable MONTH which takes integer values 1-12.

I have to give restrictions such that Y = 1 if MONTH = 1, and Y = 0 otherwise.

I don't know how to do this. I can think of a way to make Y = 1 when MONTH = 1, like Y + MONTH > 2, but I can't think of a restriction to make Y = 0 otherwise.

D.W.
  • 167,959
  • 22
  • 232
  • 500
Heathcliff
  • 121
  • 1

1 Answers1

1

In this case (where the possible sets of values are finite) a graphical approach can work nicely for determining a suitable set of constraints. Draw the points in the set $\{1,\dots,12\}\times\{0,1\}$ in the plane, using $+$ for allowed and $-$ for disallowed combinations:

$\begin{array} & & + & - & - & - & - & - & - & - & - & - & - & - \\ & - & + & + & + & + & + & + & + & + & + & + & +\end{array}$

Can you find a set of lines separating the $+$s from the $-$s? Note that $Y+MONTH\ge 2$ already take care of the $-$ in the bottom left corner.

Klaus Draeger
  • 2,176
  • 12
  • 17