0
$\begingroup$

I have an integer parameter $\rho$, and 2 variables, $g$, which is a matrix of binary variables of shape $(m, t)$, and $x$, which is a list of binary variables of shape $t$.

I want to formulate a constraint that allows me to get the following if condition:

$ if \sum_{m}g_{m,t} \ge \rho \implies x_{t} = 1 \qquad\forall t $

However, if that condition isn't met, $x_t$ can have a value of 0 or 1.

I suppose that this could be solved with some type of Big-M constraint, but I can't figure out how to formulate it.

Thanks you very much in advance!

EDIT:

To clarify:

$ if \sum_{m}g_{m,t} < \rho \implies x_{t} \le 1 \qquad\forall t $

$\endgroup$

1 Answer 1

0
$\begingroup$

Equivalently, you want to enforce the contrapositive $$x_t = 0 \implies \sum_m g_{m,t} \le \rho - 1$$ You can do so via linear big-M constraint $$\sum_m g_{m,t} - \rho + 1 \le M_t x_t $$

$\endgroup$
3
  • $\begingroup$ Hi @RobPratt . Thanks for your answer. However, I think that is not valid for me. As I said in the question if $\sum_{m}g_{m,t}<\rho$ then $x_t$ is free to get 0 or 1 as value, and its value will only depend on other constraints in the problem. Just if $\sum_{m}g_{m,t}\ge\rho \implies x_{t} = 1$. If I use your approach I will enforce 0 when maybe it should be 1 depending on that other constraints. $\endgroup$ Dec 26, 2021 at 9:24
  • $\begingroup$ My formulation does in fact do what you want. Just check the two cases. If $x_t=0$ then $\sum_m g_{m,t} -\rho+1\le 0$. If $x_t=1$ then $\sum_m g_{m,t} -\rho+1\le M_t$, which is redundant by the choice of $M_t$. $\endgroup$
    – RobPratt
    Dec 26, 2021 at 14:30
  • $\begingroup$ Reading more carefully, you are right Rob. I've just implemented it in my code and works fine. Thanks you very much! $\endgroup$ Dec 26, 2021 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .