[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Subject to two conditions
From: |
Michael Hennebry |
Subject: |
Re: [Help-glpk] Subject to two conditions |
Date: |
Wed, 10 Nov 2010 10:00:49 -0600 (CST) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
On Wed, 10 Nov 2010, Suleyman Demirel wrote:
Usually, if you have an either/or constraint, you should define a binary
variable, say y, taking only 0-1 value. If y=0, the sum is less than zero,
if y=1, the sum is greater than two.
Let M be a very large number (M=100000000000).Then, you should have two
constraints as follows.
Nyet.
M should be the smallest value which will work.
Merely large values give loose constraints.
Truly huge values can cause numerical difficulties.
s.t. condition1{(i,j) in E}: (sum{(i,j,i1,j1) in L} x2[i1,j1] <=M *y;
Each of the above M's should at most be an upper
bound on the corresponding sum on the left.
s.t. condition1{(i,j) in E}: (sum{(i,j,i1,j1) in L} x2[i1,j1] >=2*y - M
*(1-y)
Each of these M's should be at most an upper bound on
the negative of the corresponding sum on the left.
--
Michael address@hidden
"Pessimist: The glass is half empty.
Optimist: The glass is half full.
Engineer: The glass is twice as big as it needs to be."