Re: Objective function defined with max, min.

Andrew Makhorin <[email protected]>
Newsgroups gmane.comp.gnu.glpk
Message-ID <1483663785.11156.13.camel@corvax>
> It should work for minimization, but I want to maximize expression
> with f(x) as a summand. So adding Z should make the solution
> unbounded.

Yes, it doesn't work in case of maximization.

You may try using the "standard big M" approach, for example, as
follows.

Let 

z1 = 1, z2 = 0, z3 = 0: -M1 <= x1 <= 0,  0 <= x2 <= 0, 0 <= x3 <= 0

z1 = 0, z2 = 1, z3 = 0:   0 <= x1 <= 0,  0 <= x2 <= 1, 0 <= x3 <= 0

z1 = 0, z2 = 0, z3 = 1:   0 <= x1 <= 0,  0 <= x2 <= 0, 1 <= x3 <= +M3

Then f(x) = min(0, max(1, x)) can be described by the following linear
constraints:

f = x2 + z3

x = x1 + x2 + x3

-M1 * z1 <= x1 <= 0

       0 <= x2 <= z2

      z3 <= x3 <= +M3 * z3

z1 + z2 + z3 = 1

where x1, x2, x3 are auxiliary continuous vars, z1, z2, z3 are auxiliary
binary vars, M1, M3 are "big M" constants.

Note that some auxiliary variables can be eliminated due to equality
constraints.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.