[Cmpl] Array of sets in data file

Mike Steglich mike.steglich at th-wildau.de
Wed Nov 27 05:09:30 EST 2013


Hello Kamil,

The substitution you mentioned are not possible in Cmpl, because we didn't implement neither a substitution for symbol name (only for line names) nor a functionality like Python's eval() in Cmpl.  It could be a good idea to use pyCmpl for such things.

Thanks,

Mike


Am 26.11.2013 um 11:47 schrieb Kamil Figiela:

> Hello Mike,
> 
> Thank you for the response. If I understand correctly, for the solution you propose I need to hardcode "setC["Y"] := setY;" lines in the model (and number of them depends on setB in this instance)? I was thinking about something like {i in setB: setC[i] := set%i;} - where %i is substituted with set member name.
> 
> For the time being, I will probably generate the CMPL file and use include directive.
> 
> Best,
> Kamil
> 
> 
> Wiadomość napisana przez Mike Steglich <mike.steglich at th-wildau.de> w dniu 25 lis 2013, o godz. 16:41:
> 
>> Hello Kamil,
>> 
>> CmplData is intended to read raw data into Cmpl models. That means it is not possible to use parameters or sets that are defined in the cmpData file for the data assignment to another set or parameter in the cmplData file.
>> 
>> I would like to propose to define the subsets in the cmplData file and to assign this sets to a parameter array within your Cmpl model:
>> 
>> ---- cmplData 
>> %setA set < A B C >
>> %setB set < X Y >
>> 
>> %setX set < A B >
>> %setY set < C >
>> 
>> .... Cmpl 
>> setC["X"] := setX;
>> setC["Y"] := setY;
>> 
>> Cheers,
>> 
>> Mike
>> 
>> Am 25.11.2013 um 15:01 schrieb Kamil Figiela:
>> 
>>> Hello!
>>> 
>>> I have defined the following sets in my data file:
>>> 
>>> %setA set < A B C >
>>> %setB set < X Y >
>>> 
>>> Now I want to define a array of sets that defines relation between sets A and B, so in the parameters section I can write:
>>> 
>>> setC["X"] := set("A", "B");
>>> setC["Y"] := set("C");
>>> 
>>> and it works. How express the same in the data file? I have tried several options, but it didn't work. I created example program https://gist.github.com/kfigiela/7641560
>>> 
>>> Thanks,
>>> Kamil Figiela_______________________________________________
>>> Cmpl mailing list
>>> Cmpl at list.coin-or.org
>>> http://list.coin-or.org/mailman/listinfo/cmpl
>> 
> 




More information about the Cmpl mailing list