[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-glpk] complex constraints in glpk

**From**: |
Andrew Makhorin |

**Subject**: |
Re: [Help-glpk] complex constraints in glpk |

**Date**: |
Wed, 22 Aug 2007 10:01:33 +0400 |

>* 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).