error 495: load dimension are different

Problems with syntax of GAMS
Post Reply
mape
User
User
Posts: 4
Joined: 6 years ago

error 495: load dimension are different

Post by mape »

Hi,

I'm having a problem related to the inclusion of a GDX file..I wrote this code to produce the GDX file starting from an Excel spreadsheet:

Code: Select all

Set  r  row labels;

Parameters Dt(r)
           Ppv(r)
           Pwt(r)
           Pht(r);



$call  GDXXRW.EXE  Dt.xlsx  Squeeze=N par=Dt rng=a1:b25 trace=3  rdim=1 cdim=1
$call  GDXXRW.EXE  Ppv.xlsx Squeeze=N  par=Ppv rng=a1:b25 trace=3 rdim=1 cdim=1
$call  GDXXRW.EXE  Pwt.xlsx  Squeeze=N par=Pwt rng=a1:c25 trace=3  rdim=1 cdim=1
$call  GDXXRW.EXE  Pht.xlsx  Squeeze=N par=Pht rng=a1:c25 trace=3  rdim=1 cdim=1


$call gdxmerge Dt.gdx Ppv.gdx Pwt.gdx Pht.gdx

and the GDX file is formed without problems (you can find a screen of it attached). But then I want to include it in the algorithm I have to solve and I use this formulation:

Code: Select all

$gdxin merged
$load  Dt Ppv Pwt Pht
$gdxin
but I get "error 495:load dimension are different"(seems referred to Ppv) and I can't understand why.

Thank you in advance,

Marina
Attachments
gdx.PNG
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: error 495: load dimension are different

Post by Renger »

Hi Marina
The dimenstions of your parameters doesn't match the dimensions of the parameters stored in your gdx file.
Ppv(r) has (according to your gdx file) 3 indices and not just one.
If you merge the files, all parameters, variables, etc. get an additional index with the name of the gdx file, so if you have a parameter
dt(r,*), this will become dt(*,dt,*).
Also, you defined your parameter dt over just one set, but read dt as two-dimensional (rdim=1 cdim=1). In the merged file it has 3 indices.
This should already have caused an error in your first calls of gdxxrw. Take a good look at the screen output of gdxxrw (you enabled this by adding trace=3)

Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply