1

The constraint I want to place is $Mx_i-y_i<0$,that is to say when $y_i = 0$ ,then $x_i$ must equal to $0$. However the constraint is only needed when $a>b$ ($a,b$ are both the parameters).

Can I describe the constraint as below?

$$Mx_i-y_i < 0,\ a>b.$$

Emily
  • 35,688
  • 6
  • 93
  • 141
frank-z
  • 11

1 Answers1

1

If $a$ and $b$ are parameters, then you can control which constraints you give to the solver. If $a>b$ add the following constraint: $$ x_i\le My_i $$ (If $x_i$ is binary, $M:=1$ is suitable)

If not, do not add the constraint. That's all there is to it.

Kuifje
  • 9,584