-------- Forwarded Message -------- From: Alexey Karakulov <[email protected]> To: Michael Hennebry <[email protected]> Cc: Andrew Makhorin <[email protected]>, [email protected] Subject: Re: [Help-glpk] Objective function defined with max, min. Date: Fri, 6 Jan 2017 00:09:00 +0200
Michael, thanks. This seems to work for me, but it's only for maximizing "crop(s)", not minimizing, right? I have "crop(s[i])" with both positive and negative signs for different "i", so I should do some fiddling to get it working. On Thu, Jan 5, 2017 at 8:39 PM, Michael Hennebry <[email protected]> wrote: The objective function includes crop(s) = median(0, s, 1) where the range of s includes both negative values and values > 1 . The set defined is not convex and so cannot be defined purely with linear constraints. One can get around the need for a binary by using optimality. Add nonnegative auxillary variables p0, n0, p1 and n1. s = p0-n0 s = p1-n1+1 Adjust the objective to ensure that p0 or n0 is zero at optimality and that p1 or n1 is zero at optimality. 0<=crop(s)<=1 crop(s)<=p0 crop(s)>=1-n1 -- Michael [email protected] "Sorry but your password must contain an uppercase letter, a number, a haiku, a gang sign, a heiroglyph, and the blood of a virgin." -- someeecards _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
