4
$\begingroup$

I have the following constraint: $$f\geq C_1\left(d-z-E_1-E_2\right)+C_2\left(E_1+E_2\right).$$

Here $f, d,z\in \mathbb{R}_{\geq 0}$ and $y\in \{0,1\}$ are variables and $C_1$, $C_2$, $E_1$, and $E_2$ are parameters.

I want to have this constraint active only if $(d-z-E_1-E_2)\geq 0$ and $y=1$.

My current solution is the following. I introduce $v\in \{0,1\}$ and use the following constraints to make sure that $v=1$ only if $\left(d-z-E_1-E_2\right)\geq 0$. The parameter $M$ is a big $M$.

\begin{equation} \begin{aligned} f\geq C_1\left(d-z-E_1-E_2\right)+C_2\left(E_1+E_2\right)-M\left(2-y-v\right) \end{aligned} \end{equation} \begin{equation} \begin{aligned} \left(d-z-E_1-E_2\right)\leq Mv \end{aligned} \end{equation}

However, the above solution is not sufficient because I want $v = 0$ when $\left(d-z-E_1-E_2\right)<0$. I couldn't come up with that simple inequality constraint. Please let me know if you have a better solution.

$\endgroup$
2
  • $\begingroup$ My question seems to be too long. Actually, what I am looking for is the constraint set satisfying $x=1$ if $k\geq 0$ and $x=0$ if $k<0$, where $x\in \{0,1\}$ and $k\in \mathbb{R}$. $\endgroup$
    – tcokyasar
    Jul 1, 2019 at 18:22
  • 2
    $\begingroup$ Thank you for simplifying your question. For next time, please consider modifying the original question to prevent duplicates on the site. I also want to ask you to be a little more patient: two hours is very short to expect an answer, especially from a stackexchange site with still a relatively small amount of users. I have voted to close this copy of your question, such that we can focus on the other one. $\endgroup$ Jul 1, 2019 at 18:56

0