Page 1 of 1

Data Exchange (Excel) to GAMS

Posted: Thu Oct 04, 2018 4:49 am
by ikeato
Hi,

I have been working with GAMS (newbie) and having an issue with dealing with a lot of data which is more than the number required in excel (.xlsx), thus my data is more than 1million.

Please what is the best way to overcome this problem?

Secondly I have to import Set mc (shown below) data from Excel into GAMS to display like this in GAMS: /1.(1,2), 2.(1,36), 3.(1,1851), 4.(2,3), 5.(2,37), 6.(2,1852), 7.(2,1886)/

The Sets are:
i 'number of blocks' /1,2,36,1851,1885,3,37,1852,1886/
mcs 'number of mutually exclusive sets' /1*7/
mc(mcs,i)' description of mutually exclusive projects' /1.(1,2), 2.(1,36), 3.(1,1851), 4.(2,3), 5.(2,37), 6.(2,1852), 7.(2,1886)/

Please how do I arrange the data in excel to display like the above in blue in GAMS.

Kindly assist.

Thanks,
Isaac
Curtin University

Re: Data Exchange (Excel) to GAMS

Posted: Fri Oct 05, 2018 8:44 am
by Renger
Hi
If you have more than one million datasets, you could save them in two or more separate tables. You then read those tables using gdxxrw.
After that, you can load the tables in one parameter using loaddcm.

Your mapping can be saved in an Excel table like this

Code: Select all

1   1
1   2
...
You then can read the set mc like a normal set over the range of the two columns in excel with rdim=2.

Hope this helps
Cheers
Renger

Re: Data Exchange (Excel) to GAMS

Posted: Sat Oct 06, 2018 11:49 am
by ikeato
Hi Renger,

Thanks for the assistance.

Please I tried it but it gives an error that the dimension of a domain should be 1 for mc.


I have attached the excel and GAMS for your review.


Regards,

Isaac

Re: Data Exchange (Excel) to GAMS

Posted: Sun Oct 07, 2018 11:49 am
by ikeato
Hi Renger,

I have been able to sort it out.

It's because I was calling the set from excel into GAMS using "dset" instead of "set".

It worked when I changed it.

Regards,
Isaac