help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] complex constraints in glpk


From: Yaron Kretchmer
Subject: Re: [Help-glpk] complex constraints in glpk
Date: Wed, 22 Aug 2007 00:04:57 -0700

Thanks Andrew.

And how about having an "OR" constraint, as in
a > 2 or  b < 4

Regards
Yaron

On 8/21/07, Andrew Makhorin <address@hidden> wrote:
> Is it possible to capture constraints of the form

> max(a,b) - min(c,d) > X or max(e,f) - min(g,h) > Y
>
> in glpk?

Non-linear constraints are not allowed in glpk. However, you can
reformulate them using binary variables.

Let f(t) = (if t < 0 then 0 else t). Then, obviously,

   max(p,q) = p + f(q - p)

   min(p,q) = p - f(p - q)

Assuming that t_min <= t <= t_max the function f(t) can be modeled as
follows:

   t = t1 + t2

   f = t2

   (1 - z) * t_min <= t1 <= 0

   0 <= t2 <= z * t_max

where z is a binary variable (z = 0 means that t_min <= t <= 0 and
z = 1 means that 0 <= t <= t_max).



reply via email to

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