Dear Xypron, thank You, I was also thinking on using & and define one dimensional set of "pairs" like that.
This tuple index symbol would be an interesting feature. Anyway, thank You again, this solves my problem. Best regards, Mate P.S.: I tried, whether this catenations can work in a "preprocessing" fashion like this: set S1; set S2; set S3 := setof {s1 in S1, s2 in S2: s1!=s2} s1&' , '&s2; var x{s1 in S1, s2 in S2}; s.t. constraint {s3 in S3}: x[s3]=0; but unfortunately it doesn't. On 07/17/2012 05:01 PM, glpk xypron wrote: > Hello Mate, > > a index symbol is always scalar and never a tuple. But you can use > string concatenation for merging your indices: > > set S1; set S2; > set S3 := setof {s1 in S1, s2 in S2: s1!=s2} s1&","&s2; > set S4 := setof {s1 in S1, s2 in S2: s1<s2} s1&","&s2; > > param p{S3}, default 3; > > var x{s3 in S3}; > > s.t. constraint1{s3 in S3}: x[s3]>=p[s3]; > > s.t. constraint2{s4 in S4}: x[s4] >= 2 * p[s4]; > > data; set S1 := s11 s12; set S2 := s21 s22 s23; end; > > Best regards > > Xypron -------- Original-Nachricht -------- >> Datum: Tue, 17 Jul 2012 15:30:07 +0200 Von: Mate Hegyhati >> <hegyh...@dcs.uni-pannon.hu> An: help-glpk@gnu.org Betreff: >> [Help-glpk] Single index for multidimensional sets > >> Dear All, >> >> is it somehow possible to use a single index symbol for addressing >> an n-tuple? In one of my problems I have a 3 dimensional set, that >> is used as a basis for other sets, etc. I'm trying to do something >> like this: >> >> set S1; set S2; set S3 := setof {s1 in S1, s2 in S2: s1!=s2} >> (s1,s2); >> >> param p{s1 in S1, s2 in S2}, default 3; >> >> var x{s3 in S3}; # this is, that should be (s1,s2) in S3 >> >> s.t. constraint1 {s3 in S3}: # similar here x[s3]>=p[s3]; >> >> s.t. constraint2{s1 in S1, s2 in S2: s1<s2}: x[s1,s2] >= 2 * >> p[s1,s2]; >> >> It is not working, and according to the manual, an index should >> match the dimension of the set. Is it somehow possible to avoid >> writing (s1,s2) everywhere? >> >> Thank You very much in advance, best regards, >> >> Mate Hegyhati
<<attachment: hegyhati.vcf>>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk