Friday, May 5, 2017

Upper bounds on integer variables

In a model I used to solve as a continuous problem, I have some variables \(0 \le x_i \le U_i\). In addition I have some cost \(c_i\) and a budget \(B\):

\[ \sum_i c_i x_i \le B \]

When moving towards an integer model, of course I want to tighten the upper bounds \(U_i\). I.e.:

\[ U_i := \min\left\{U_i,\frac{B}{c_i}\right\} \]

Now, GAMS does not accept non-integer bounds on integer variables:

**** Matrix error - bounds on discrete variables have to be integer

(it is debatable if it is a good thing to require this). So we can do something like:

x.up(i) = trunc(min(u(i), budget/cost(i)));

However we could end up with something like trunc(0.999999) which in all likelihood should be considered as 1. Numbers like that can easily result from round-off and truncation errors in floating point computations and during data transfer between systems. We now need to apply a certain tolerance to safeguard against this, e.g.:

x.up(i) = trunc(min(u(i), budget/cost(i))+1e-6);

It looks like I am taking on much responsibility here. It may have been better to leave things as they were before.

No comments:

Post a Comment