help-glpk
[Top][All Lists]
Advanced

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

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


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

> 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)}
>         }
>     }
> }

Of course, "lazy" computations are used, i.e. all members of T are not
computed at the very beginning; a member of T is computed only if it is
actually referenced in an expression for the first time.

> 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?

Something like follows:

set T{k in K, i in I}, data S : 3 1 : 2 5 4;

that means that 3rd and 1st components of 5-tuple in S correspond,
resp., to 1st and 2nd indices of T while 2nd, 5th, and 4th components
of the 5-tuple give 3-tuple included in a plain set assigned to
corresponding member of T.

The statement above can be implemented as if there were data for T
in the data section.





reply via email to

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