I am having trouble converting the following objective function into LP: $$ \min\left\lvert(\left\lvert x_1-a_1\right\rvert-\left\lvert x_2-a_2 \right\rvert )\right\rvert$$ where $x$ is the decision variable and $(a)$ is an integer constant.

I tried adding the following constraints, but it did not work out:

$x_i-a_i\le y_i$

$a_i-x_i\le y_i$

$y_1-y_2\le U$

$y_2-y_1\le U$

  • $\begingroup$ Why it didn't work out? The only step missing is $\min U$, since we have $y_i \ge 0$. $\endgroup$ – GNUSupporter 8964民主女神 地下教會 Jan 29 '18 at 1:42
  • $\begingroup$ I think the inner absolute values need to be modeled with binary variables (that part is non-convex). $\endgroup$ – Erwin Kalvelagen Jan 29 '18 at 19:40

I think this needs to be modeled as a MIP:

\begin{align} \min\> & z\\ & -z \le y_1 - y_2 \le z\\ & y_i \ge x_i - a_i\\ & y_i \ge -(x_i - a_i)\\ & y_i \le x_i - a_i + \delta_i M\\ & y_i \le -(x_i - a_i) + (1-\delta_i) M\\ & \delta_i \in \{0,1\} \end{align}

where $M$ is large enough constant.


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.