help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Implementing conditional amount constraints using binar


From: Yaron Kretchmer
Subject: Re: [Help-glpk] Implementing conditional amount constraints using binary variables
Date: Wed, 3 Jun 2009 15:41:04 -0700

Hi Xypron
Perfect- this works.
How did you come up with that notation?  (I mean, except for experience :)  )

Thanks
Kretch


On Wed, Jun 3, 2009 at 1:24 PM, Xypron <address@hidden> wrote:
Hello Yaron,

param M := 1000;
var a, >=0, <= M;
var b, >=0, <= M;
var x, binary;

minimize opt: a - .3 * b;
s.t. c0: a <= x * M;
s.t. c1: a - b <= ( 1 - x ) * M;
s.t. c2: b - a <= ( 1 - x ) * M;

solve;
display a, b, x;
end;

Best regards

Xypron


Yaron Kretchmer wrote:
Both a and b can be bounded by a  large M.
So let me reformulate my problem:

0 <= a <= M

if a > 0 : a=b

if a=0 : 0<=b<=M

Thanks
Kretch

 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]