[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Single index for multidimensional sets
From: |
Mate Hegyhati |
Subject: |
Re: [Help-glpk] Single index for multidimensional sets |
Date: |
Tue, 17 Jul 2012 17:31:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
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
>> <address@hidden> An: address@hidden 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
hegyhati.vcf
Description: Vcard
signature.asc
Description: OpenPGP digital signature