-1
$\begingroup$

Is it possible to encode $y=0\implies G=0$ else $G=x$ by Integer Linear Programming where $x,y,G$ are integer variables?

The answer mentioned below gets to the point of taking absolute value of difference of two integers $a,b$. How do we get $|a-b|$ from ILP?

$\endgroup$
1
$\begingroup$

If $y$ is binary, $x$ is non-negative and you know upper bound for $x$, you can calculate this as: $G = \min(y \cdot K, x)$ where $K$ is greater than the upper bound.

If you only know the upper bound for $|x|$ and $|y|$, you can generalize this solution using tricks similar to https://blog.adamfurmanek.pl/2015/10/17/ilp-part-9/ . You basically need to compare $y$ with zero and use conditional operator (which is just a multiplication).

If you don't know the upper bound then I don't know the solution.

$\endgroup$
  • $\begingroup$ How to find min? $\endgroup$ – T.... Apr 13 '18 at 2:25
  • $\begingroup$ It is described here: blog.adamfurmanek.pl/2015/09/19/ilp-part-5 $\endgroup$ – user1543037 Apr 13 '18 at 2:25
  • $\begingroup$ It is not clear there. $\endgroup$ – T.... Apr 13 '18 at 2:32
  • $\begingroup$ Which part is not clear? $\endgroup$ – user1543037 Apr 13 '18 at 2:33
  • $\begingroup$ The way to do m which is min there. $\endgroup$ – T.... Apr 13 '18 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.