I have difficulties in reading data that I need from .gdx file. I have succeeded in loading file from Excel, but I get an error when I try to access index that I need:
Code: Select all
Sets t time intervals / t1*t12 / [b] !! set definition[/b] i customers / c1*c5 / r row labels /r1*r97/ c column labels /c1,c2,c3,c4,c5/; parameter p(r,c); [b]!! reading the table from Excel[/b] $CALL GDXXRW Curve.xlsx trace=3 par=p rng=Sheet1!a1:f97 rdim=1 cdim=1 $gdxin Curve.gdx $load p $gdxin parameter h; [b] !! reading the scalar[/b] $CALL GDXXRW load.xlsx trace=3 par=h rng=Sheet1!i2:i2 dim=0 $GDXIN load.gdx $LOAD h $GDXIN [b]cost .. z =e= sum(t, maxLoad - sum(i, u(i,t)*cons(i)*clpu(t)*p(h,i)));[/b] current_load(t) .. sum(i, u(i,t)*cons(i)*clpu(t)*p(i,h)) =l= maxLoad;
I am not sure if the code that I have attached is enough, so sorry in advance if something is missing.