2
$\begingroup$

My objective function for the Xpress-IVE (Mosel lang) model is

minimize |a-b|

where a and b the number of elements in the decision variables which are arrays.

Since there is no function to calculate the absolute value, i want to get something of the form

objective = max(a,b) - min(a,b)

and then minimize the objective

What I have tried: introduced two variables x and y with the following constraints: x >= a x >= b y => a y => b and re-written the objective as x-y

But this gives me zero as the solution.

Could I please get a hint on what i am doing wrong?

$\endgroup$
1
$\begingroup$

Minimizing $$ Z=|a-b| $$ is equivalent to minimizing $$ Z=\omega, $$ subject to the constraints $$ a-b\le \omega\\ b-a \le \omega $$

$\endgroup$
  • $\begingroup$ Thanks. Do i define w as an integer? $\endgroup$ – Sophie Jan 2 '16 at 19:51
  • $\begingroup$ No need to. If $a$ and $b$ are integers so will $\omega$. $\endgroup$ – Kuifje Jan 2 '16 at 20:54
  • $\begingroup$ Ok. But when i run it, i still get zero as the solution.. $\endgroup$ – Sophie Jan 2 '16 at 22:43
  • $\begingroup$ If you are just minimizing $|a-b|$, it is normal: the minimum value of an absolute value is 0. Do you have any other constraints? $\endgroup$ – Kuifje Jan 2 '16 at 23:39
  • $\begingroup$ Yes, they are as follows: a,b >= 0; fixed percentage constraints(decimals) for the decision variables U,V which are arrays of multiple variables. Even though, i've fixed U and V to be binary, on running the model, the resulting arrays contains decimals in some places instead of 0 or 1. $\endgroup$ – Sophie Jan 3 '16 at 0:07

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.