[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Building set of sets from plain set - efficient implemen

From: glpk xypron
Subject: Re: [Help-glpk] Building set of sets from plain set - efficient implementation
Date: Sat, 13 Dec 2008 08:31:00 +0100

Hello Andrew,

> I have implemented and included this operation (building array of
> sets from plain set) in Mathprog. It will appear in the next release
> of the package (though probably the syntax should be improved).

the time saving you reported are impressive.

The syntax should be able to handle sets with multiple indexes like set C in 
the example below.

Best regards


param n:= 12;
set A:= setof{i in {0..n}, j in {0..2^(n-i)-1}, k in {0..2^i-1}} (i,j,k+j*2^i);
set B:= setof{(i,j,k) in A} (i,j);
set C{(i,j) in B} := setof{ (i,j,k) in A} k;
param t1 := gmtime();
param t2 := gmtime();
printf "Start %s\n", time2str( t1, "%FT%TZ");
printf "%d = %d\n", sum{(i,j) in B} card(C[i,j]), (n+1)*2^n;
printf "duration = %d s\n", t2-t1;

Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!*

reply via email to

[Prev in Thread] Current Thread [Next in Thread]