[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Need help using glpk API
From: |
Michael Hennebry |
Subject: |
Re: [Help-glpk] Need help using glpk API |
Date: |
Tue, 2 Oct 2007 09:24:33 -0500 (CDT) |
On Tue, 2 Oct 2007, Andrew Makhorin wrote:
> > But how do I set a binary variable's value depending on a linear
> > inequality. I.e. in CPLEX I would use something like: b_0 = 1 <-> a_0
> > x_0 + a_1 x_1 + ... + a_n x_n < c with b_0 a binary variable, a_0 ...
> > a_n, c constants and x_0 ... x_n either integer or continous variables.
>
> Probably like follows:
>
> a_0 x_0 + a_1 x_1 + ... + a_n x_n <= c + M * (1 - b_0)
>
> where M is an appropriate "big" constant.
Be careful, Mort.
The larger the M, the looser the linear relaxation
and the harder the result is to solve.
Ideally, make M as large as necessary, but no larger.
Making that determination can require tricky analysis,
but if all the variables have finite ranges,
non-tricky analysis will give you a probably useable value.
--
Mike address@hidden
"Horse guts never lie." -- Cherek Bear-Shoulders