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 - efficient implemen


From: xypron
Subject: Re: [Help-glpk] Building set of sets from plain set - efficient implementation
Date: Wed, 10 Dec 2008 15:32:05 -0800 (PST)

Hello Andrew,

three different types of definitions could occur:

1) Multiline forward definition:
e.g.
set T{a in A}:= B[a];
set B{a in A};
Forward definition is not allowed in GLPK.

2) Single line recursive definition
e.g.
set T{a in A} := if {a == min{b in A}b } then {a} else {a} union T[a-1];
In this case the elements of T have to be initialized one by one. Your
algorithm is necessary:
>> procedure T(k in K, i in I)
>> {   find T[k,i] in T array;
>>     if T[k,i] is not found then
>>     {  T[k,i] := setof{(i,j,k,l,m) in S} (j,m,l);
>>        add T[k,i] to T array;
>>     }
>>     return T[k,i];
>> } 

3) No recursion, only backward definitions
e.g.
set T{k in K, i in I} := setof{(i,j,k,l,m) in S} (j,m,l); 

In this case the whole set T can be initialized at once when the first
element of T is requested as I proposed.
Essentially this is what you describe as:
>> My idea is to use S to create fake data ...

Still I do not see any need for as special syntax. When parsing a set
statement you could flag it as recursive or not.

>> Do you know if there is a similar operation in the sql language?
As SQL is not object oriented the result set of a query is always a flat
table.

Best regards

Xypron

-- 
View this message in context: 
http://www.nabble.com/Building-set-of-sets-from-plain-set-tp20927524p20946462.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.





reply via email to

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