help-glpk
[Top][All Lists]

## Re: [Help-glpk] Can I specify the actual variable bounds in the constrai

 From: Brady Hunsaker Subject: Re: [Help-glpk] Can I specify the actual variable bounds in the constraints and s et the variables bounds to 'free' in the program? Date: Thu, 20 May 2004 16:24:41 -0400

```On Thu, 2004-05-20 at 13:56, address@hidden wrote:
> Hi,
>
> We use glpk 3.2.3 to develop programs for which changing the constraints is
>
> easier than changing the bounds of variables.
> So we prefer to set once in the program the
> variables bounds to 'free' (lpx_set_col_bnds(lp, i, LPX_FR, 0.0, 0.0); /*
> for all the i */).
> We then specify the actual bounds of the variables in the constraints.
>
> For example, for the problem:
>
> maximize
>       Z = x1+x2
> subject to
>       x1 + 2x2 <= 6
> where all variables are non-negative
>       x1 >= 0 and x2 >= 0
>
>
> We would set the objective function to
>       Z = x1+x2
> And the constraints would be (non-negativity of variables is added to the
> constraints):
>       x1 + 2x2 <= 6
>       x1 >= 0
>       x2 >= 0
>
> In our program we already have lpx_set_col_bnds(lp, i, LPX_FR, 0.0, 0.0); /*
> for each i.*/
>
> Can anyone tell me if specifying the actual bounds in the constraints and
> setting the variables bounds to 'free'
> can create any problems in the program? (we have problems of up to 135
> variables).
>
> Thanks!
>
> Maurice Djona
>

The simplex algorithm does treat explicit variable bounds different than
constraints.  In essence, the variable bounds don't count as
constraints, so it is generally better to have explicit variable
bounds.

More up-to-date versions of GLPK include a presolver that will identify
this situation and correct it for you, so that it doesn't matter which
way you do it.  However, I don't think that version 3.2.3 has a
presolver.  The current version is 4.4.  I recommend you upgrade.

Why is it that changing constraints is easier for you than changing
bounds?

Also, if you're talking about LPs (not IPs) with 135 variables, then
they probably solve in less than a second.  If that's the case, then it
may not matter much anyway.

--
Assistant Professor
Industrial Engineering
University of Pittsburgh
http://www.engr.pitt.edu/hunsaker/

```