[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Implementing conditional amount constraints using binary
From: |
Xypron |
Subject: |
Re: [Help-glpk] Implementing conditional amount constraints using binary variables |
Date: |
Wed, 03 Jun 2009 22:24:11 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16 |
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