Reputation: 211
NOTE: Update (but not solved) Below
In my use case for GAMS I wish to define a collection of static variables in a .gdx file rather than in the main model.gms script. This is not an issue unless I define a column that contains only zero (0) values. When defining a table ("data") like this and choosing "Run with GDX Creation in GAMS studio. I get a .gdx file with a missing column.
Set indexA /ch1*ch5/;
Table data(indexA, *)
A_min A_max B_min B_max
ch1 1 10 0 7
ch2 2 10 0 6
ch3 3 10 0 5
ch4 4 10 0 4
ch5 5 10 0 3;
Copy and pasted .gdx contents:
IndexA * Value
ch1 A_min 1
ch1 A_max 10
ch1 B_max 7
ch2 A_min 2
ch2 A_max 10
ch2 B_max 6
ch3 A_min 3
ch3 A_max 10
ch3 B_max 5
ch4 A_min 4
ch4 A_max 10
ch4 B_max 4
ch5 A_min 5
ch5 A_max 10
ch5 B_max 3
Column 'B_min' is nowhere to be seen. When trying to load this .gdx back into my script it gives me an error where I try to access 'B_min' and says "Label is unknown". If I change the value to be non zero, it is not a problem, but I need it to be zero! I have tried using 0.0 vs 0. No change. Why can't I define something to be zero and have it save in my .gdx?
Edit / Update: I created an ugly work around for this. I set all of my "B_min values to -1 in gams, created my .gdx file with the column, but the wrong values. Loaded the .gdx file into python using the GAMS API, iterated over each entry in 'data' to change the -1 values to 0 and saved it. This new .gdx file now works in my test model. I would still really like to get this zero thing solved for others on my team who are not going to use this work around with the python API.
Upvotes: 0
Views: 758