Re: Excessive copies of set elements in GMPL

2020-07-24 Thread Michael Hennebry
On Fri, 24 Jul 2020, Andrew Makhorin wrote: The issue can be illustrated by the following example: for (i = 0; i < 100; i++) for (j = 0; j < 100; j++) for (k = 0; k < 100; k++) if (j == i+1 && j == j+2) foo(i, j, k); Would you expect the C compiler to optimize this

Re: Excessive copies of set elements in GMPL

2020-07-24 Thread Andrew Makhorin
> if (j == i+1 && j == j+2) > Must read if (j == i+1 && k == j+2)

Re: Excessive copies of set elements in GMPL

2020-07-24 Thread Andrew Makhorin
On Fri, 2020-07-24 at 09:12 +0200, Domingo Alvarez Duarte wrote: > And here is the output of the the script bellow: > > Memory usage: > > ubuntu glpsol package : 1,422,160 KB => 4.20s elapsed > > glpk with my changes: 429,000 KB => 1.37s elapsed > > As I explained in my previous message, the

Re: Excessive copies of set elements in GMPL

2020-07-24 Thread Domingo Alvarez Duarte
And here is the output of the the script bellow: Memory usage: ubuntu glpsol package : 1,422,160 KB => 4.20s elapsed glpk with my changes: 429,000 KB => 1.37s elapsed = /usr/bin/time glpsol -m test-nested-sets.mod GLPSOL: GLPK LP/MIP Solver, v4.65 Parameter(s) specified in the command

Re: Excessive copies of set elements in GMPL

2020-07-24 Thread Domingo Alvarez Duarte
Here is the output of the script from the previous message: Memory usage: ubuntu glpsol package : 4,544 KB glpk with my changes: 3,268 KB /usr/bin/time glpsol -m test-nested-sets.mod GLPSOL: GLPK LP/MIP Solver, v4.65 Parameter(s) specified in the command line:  -m test-nested-sets.mod

Re: Excessive copies of set elements in GMPL

2020-07-24 Thread Domingo Alvarez Duarte
Hello Michael ! What kind of problem do you expect ? Other than memory size requirements ? Do you mean something like this: set A := {1..10}; set B := {1..20}; set C := {1..30}; set D := { (a,b,c) in A cross B cross C : b=a+1 and c=b+2 }; printf "A count: %d\n", card(A); printf "B