True! I've tested it and values that are too large spoil the picture. But with more reasonable values it works like a charm.

Thank you for your help,
João

Em 10/11/10 16:00, Michael Hennebry escreveu:
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.


_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to