help-glpk
[Top][All Lists]

## [Help-glpk] Sets of ordered pairs: Differences between AMPL and GNU Math

 From: Peter Ingerfeld Subject: [Help-glpk] Sets of ordered pairs: Differences between AMPL and GNU MathProg Date: Tue, 18 Nov 2008 18:01:29 +0300

```There is an inhomogeneity between AMPL and MathProg in the way sets of
ordered pairs are being iterated over by two (or more) sum{} statements
which are linked by an iterator variable.

Consider the following sample:
---------------------------

set A :={1..5};
set B :={"b1", "b2", "b3", "b4", "b5"};

set D within {A,B} := {(1,"b2"), (1,"b3"), (1,"b5"), (3,"b3")};

var X {D};

minimize z:
sum{a in (1..5)} sum {(a,b) in D} X[1,b];

---------------------------

AMPL generates:

MIN   X[1,b2] + 2 X[1,b3] + X[1,b5]

MathProg generates:

MIN   5 X[1,b2] + 5 X[1,b3] + 5 X[1,b5]

Obviously AMPL links the inner and outer sum{} statements by variable 'a'
and MathProg doesn't.

Bug or feature?

Dr. Peter Ingerfeld
MOPS Optimierungssysteme GmbH & Co KG

```