[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Absolute value constraint
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Absolute value constraint |
Date: |
Tue, 15 Jan 2008 18:26:09 +0300 |
> Hi, is it possible to express 'abs(f(x)) >= m' as a linear constraint?
Yes, using a mip approach.
There are two alternatives:
f(x) >= 0 that gives f(x) >= m
f(x) < 0 that gives -f(x) >= m or, eqiuvalently, f(x) <= -m.
Let z be a binary variable such that:
z = 1 means m <= f(x) <= +M
z = 0 means -M <= f(x) <= -m
where M is a "big" constant. Then the constraint can be formulated
as follows:
m * z - M * (1 - z) <= f(x) <= M * z - m * (1 - z)
(under assumption that f(x) is a linear function of variables).