> 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. _______________________________________________ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk