|
From: | Kevin Hunter Kesling |
Subject: | Re: [Help-glpk] [Fwd: variables with disjoint bounds] |
Date: | Fri, 15 Nov 2013 00:54:15 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
At 12:38am -0500 Fri, 15 Nov 2013, Kevin Hunter Kesling wrote:
At 4:18pm -0500 Thu, 14 Nov 2013, Joseph Mundy wrote:It is possible in glpk to represent variables with multiple bounds that are disjoint? For example, 1<= x <=2 or 5<=x<=7. It seems that two different linear programs must be formulated.Yes, it is generally possible. Consider: 1 * b <= x <= 2*b 5 * (1 - b) <= x <= 7 * (1 - b) where 'b' is a binary variable. I don't know if GLPK supports multiple bounds directly on variables, but you can certainly incorporate the disjointness as standard constraints.
Ah crap. That's embarrassing. It's late, and I'm clearly beyond my useful hours. That's not going to work, as x would have to be 0 to simultaneously satisfy both of those. Consider instead:
5*b + 1*(1-b) <= x <= 7*b + 2*(1-b) You can still incorporate as constraints, however. Kevin
[Prev in Thread] | Current Thread | [Next in Thread] |