IF statement as Linear Constraint

1k Views Asked by At

I am writing a linear program, but I am currently having troubles writing a certain constraint, which is basically an IF-statment. I will try to explain it as detailed as possible:

IF: $x_{it'}(t' + SRT(s)) >= t $, where $t' = 1, ..., t$

THEN: $x_{it} = 0$.

Note that if the condition does not hold, $x_{it}$ does not necessarily has to be equal to 1.

Does anyone have any clue how to write this as a linear constraint?

Thank you very much.

Jeroen

1

There are 1 best solutions below

0
On BEST ANSWER

If i understood your constraint correctly, I would proceed as follows:

Introduce a new variable $\omega$, add a term in the objective function to minimize $\omega$, and use the following constraints

\begin{align} x_{it} &\le \omega \quad \forall i\; \forall t\\ \omega &\ge 0 \\ \omega & \ge M \left(t-x_{it'}(t'+SRT(s))\right) \quad \forall i\; \forall t'=1,\cdots,t \end{align}

($M$ is a large integer)

This way if $t\le x_{it'}(t'+SRT(s))$ for all $t'=1,\cdots,t$, then the right hand term in last constraint is negative, so the constraint becomes redundant with respect to $\omega\ge 0$. The objective function will minimize $\omega$ and set it to $0$. So assuming $x_{it}\ge 0$, you will have $x_{it}\le \omega = 0$, i.e., $x_{it}=0$.

If $t> x_{it'}(t'+SRT(s))$ for at least one $t'=1,\cdots,t$, then the constraint $\omega\ge 0$ becomes redundant, and there is no reason for the solver to set $\omega$ and $x_{it}$ to $0$.