GDXIN produces compilation error in dump file

Post Reply
chrispahm
User
User
Posts: 20
Joined: 6 years ago

GDXIN produces compilation error in dump file

Post by chrispahm »

Hi there,

I'm running a model with the command line parameter `dumpOpt=11` in order to generate a single GAMS file containing all includes and data.
However, using $GDXIN with 0 level elements seems to create a compilation error in the .dmp file:

Simplified (reproducible) problem (which compiles fine):

Code: Select all

set r / 'Vietnam','Ethiopia','Malawi','Bolivia','Nicaragua','Pakistan','ASEAN','XCOMESA','MERCOSUR','XANDEAN','XCAFTA','ROW','USA','XOECD','EU28','SSA','China','CEFTA' /;
set h / "incPerCap 30_sh_agin 30", "incPerCap 30_sh_agin 70", "incPerCap 30_sh_agin 100", "incPerCap 70_sh_agin 30", "incPerCap 70_sh_agin 70", "incPerCap 70_sh_agin 100", "incPerCap 100_sh_agin 30", "incPerCap 100_sh_agin 70", "incPerCap 100_sh_agin 100"/;
set t / t0*t39 /;
variable popPrev(r,h,t);

$GDXIN "test.gdx"
$LOAD popPrev      = pop
$GDXIN
which results in the following .dmp file (excerpt highlighting the error)

Code: Select all

variable popPrev(r,h,t);

* *** GDXIN      C:\Users\pahmeyer\Desktop\test.gdx

$onMulti
Variable popPrev(r,h,t) /
  ...
  'Pakistan'."incPerCap 30_sh_agin 30".t10.(),
 *** Error 338, unique element expected
  ... 
To me it looks like the compiler should write out `FX 0` in these cases, but I might as well be misunderstanding something here.

Thanks for the help, I also attached the test.gms and required .gdx file.

Best
Christoph

test.gms
(531 Bytes) Downloaded 418 times
test.gdx
(11.23 MiB) Downloaded 420 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: GDXIN produces compilation error in dump file

Post by bussieck »

Christoph,

This is indeed a bug in GAMS. We have already fixed that. It will be available with the next release. As a workaround you can do the following (essentially using gdxdump to create the source for the variable data):

Code: Select all

set r / 'Vietnam','Ethiopia','Malawi','Bolivia','Nicaragua','Pakistan','ASEAN','XCOMESA','MERCOSUR','XANDEAN','XCAFTA','ROW','USA','XOECD','EU28','SSA','China','CEFTA' /;
set h / "incPerCap 30_sh_agin 30", "incPerCap 30_sh_agin 70", "incPerCap 30_sh_agin 100", "incPerCap 70_sh_agin 30", "incPerCap 70_sh_agin 70", "incPerCap 70_sh_agin 100", "incPerCap 100_sh_agin 30", "incPerCap 100_sh_agin 70", "incPerCap 100_sh_agin 100"/;
set t / t0*t39 /;
variable popPrev(r,h,t);

$ifthen %gams.dumpOpt%==0
$GDXIN "test.gdx"
$LOAD popPrev      = pop
$GDXIN
$else
$GDXOUT all
$UNLOAD r h t
$GDXOUT
$call.checkErrorLevel gdxdump "all.gdx" noData > all.gms
$onEcho >> all.gms
variable popPrev(r,h,t);
$GDXIN "test.gdx"
$LOAD popPrev      = pop
$GDXIN
$offEcho
$call.checkErrorLevel gams all.gms a=c gdx=popPrevFiltered lo=2
$call.checkErrorLevel gdxdump popPrevFiltered symb=popPrev noheader > popPrev.inc
variable popPrev(r,h,t) /
$include popPrev.inc
/;
$endif
The code would have been much easier if you would not need to filter the data from the pop symbols by the set elements of of r, h, and s in your source (in the previous code I had to call gams to do the filtering). The simpler version would be:

Code: Select all

set r / 'Vietnam','Ethiopia','Malawi','Bolivia','Nicaragua','Pakistan','ASEAN','XCOMESA','MERCOSUR','XANDEAN','XCAFTA','ROW','USA','XOECD','EU28','SSA','China','CEFTA' /;
set h / "incPerCap 30_sh_agin 30", "incPerCap 30_sh_agin 70", "incPerCap 30_sh_agin 100", "incPerCap 70_sh_agin 30", "incPerCap 70_sh_agin 70", "incPerCap 70_sh_agin 100", "incPerCap 100_sh_agin 30", "incPerCap 100_sh_agin 70", "incPerCap 100_sh_agin 100"/;
set t / t0*t39 /;
variable popPrev(r,h,t);

$ifthen %gams.dumpOpt%==0
$GDXIN "test.gdx"
$LOAD popPrev      = pop
$GDXIN
$else
variable popPrev(r,h,t) /
$call.checkErrorLevel gdxdump test.gdx symb=pop noheader > popPrev.inc
$include popPrev.inc
/;
$endif
-Michael
chrispahm
User
User
Posts: 20
Joined: 6 years ago

Re: GDXIN produces compilation error in dump file

Post by chrispahm »

Thanks a lot for your help! The workaround is sufficient for me (for the time being)

Best
Christoph
Post Reply