help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] lpx_set_col_bnds twice


From: Andrew Makhorin
Subject: Re: [Help-glpk] lpx_set_col_bnds twice
Date: Tue, 27 Mar 2007 10:29:43 +0400

> I solve an optimization problem where I need to specify variables
> (columns) to be in one of possible states:
>    1) within an set interval lpx_set_col_bnds(lpx, id, LPX_DB, from,
>       to)
>    2) zero
> 
> Is there a way how to set a column to be in interval <from, to> or
> zero?

This is so called disjunctive constraint; in your case it can be
modeled as follows:

   from * z <= x <= to * z

or, in the standard format:

   x - from * z >= 0
   x -   to * z <= 0

where x is your variable, z is a *binary* variable (z = 0 means that
x = 0, and z = 1 means that from <= x <= to). Note that each original
variable needs two constraints (rows) and one binary variable.

Another way could be using semi-continuous variables, however, glpk
does not support such kind of variables.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]