help-glpk
[Top][All Lists]

## [Help-glpk] Building set of sets from plain set

 From: Andrew Makhorin Subject: [Help-glpk] Building set of sets from plain set Date: Wed, 10 Dec 2008 04:39:57 +0300

```The problem is the following.

I have a plain set S, for example, of quintets (i,j,k,l,m), and
want to build a set of sets as follows:

set T{k in K, i in I} := setof{(i,j,k,l,m) in S} (j,m,l);

i.e. some components of the quintet become indices of T while other
components are used to build a member of T.

This is implemented in Mathprog as follows:

for all k in K do
{   for all i in I do
{   T[k,i] := empty;
for all (i',j,k',l,m) in S do
{   if i' = i and k' = k then
T[k,i] := T[k,i] union {(j,m,l)}
}
}
}

and, thus, may take too much time if K, I, and S are large sets.

The idea is to introduce a special operator, which is equivalent to
the following:

T[*,*] := empty;
for all (i,j,k,l,m) in S do
T[k,i] := T[k,i] union {(j,m,l)};

Any suggestions about the syntax? Thanks.

Andrew Makhorin

```