help-glpk
[Top][All Lists]

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

 From: xypron Subject: Re: [Help-glpk] Sets of ordered pairs: Differences between AMPL and GNU MathProg Date: Tue, 18 Nov 2008 11:40:04 -0800 (PST)

```Hello Andrew,

on a i386 Ubuntu with glpk-4.33
./glpsol -m test1.mod --check --wcpxlp test.clp
resulted in:

\* Problem: test1 *\

Minimize
z: + X(1,b2) + 2 X(1,b3) + X(1,b5)

Subject To

Bounds
X(1,b2) free
X(1,b3) free
X(1,b5) free

End

Best regards

Xypron

Peter Ingerfeld-2 wrote:
>
> 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
>
>
>
>
>
>
> _______________________________________________
> Help-glpk mailing list
> http://lists.gnu.org/mailman/listinfo/help-glpk
>
>

--
View this message in context:
http://www.nabble.com/Sets-of-ordered-pairs%3A-Differences-between-AMPL-and-GNU-MathProg-tp20561226p20566689.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.

```