There is a fairly deep issue when comparing GDX files if one of the GDX files has the following properties:
- It is produced by GDXDUMP
- It contains Equation records
The following illustrates the problem:
C:\projects\tmp>gamslib indus89 Copy ASCII: indus89.gms C:\projects\tmp>gams indus89 lo=0 gdx=1 C:\projects\tmp>gdxdump 1.gdx output=2.gms * GDX dump of 1.gdx * Library in use : C:\PROGRA~1\GAMS23.7 * Library version: GDX Library BETA 8Jun11 23.7.0 WEX 25828.25830 WEI x86_64/MS Windows * File version : GDX Library BETA 8Jun11 23.7.0 WEX 25828.25830 WEI x86_64/MS Windows * Producer : GAMS Base Module BETA 8Jun11 23.7.0 WEX 25828.25830 WEI x86_64/MS Windows * File format : 7 * Compression : 0 * Symbols : 281 * Unique Elements: 245 C:\projects\tmp>gams 2.gms lo=0 gdx=2 C:\projects\tmp>gdxdiff 1.gdx 2.gdx eps=1.0e-6 GDXDIFF BETA 8Jun11 23.7.0 WEX 25828.25830 WEI x86_64/MS Windows File1 : 1.gdx File2 : 2.gdx Summary of differences: bdraft Data are different brepco Data are different ccombal Data are different consbal Data are different cost Data are different demnat Data are different divcnlsea Data are different divsea Data are different fodder Data are different grnfdr Data are different laborc Data are different nbal Data are different nwfpalc Data are different objn Data are different objnn Data are different objz Data are different objzn Data are different protein Data are different prseaw Data are different qcombal Data are different subirrc Data are different tdraft Data are different watalcpro Data are different watalcsea Data are different watalcz Data are different waterbaln Data are different Output: diffile.gdx GDXDiff finished C:\projects\tmp>gdxdump diffile.gdx Symbols * GDX dump of diffile.gdx * Library in use : C:\PROGRA~1\GAMS23.7 * Library version: GDX Library BETA 8Jun11 23.7.0 WEX 25828.25830 WEI x86_64/MS Windows * File version : GDX Library BETA 8Jun11 23.7.0 WEX 25828.25830 WEI x86_64/MS Windows * Producer : GDXDIFF * File format : 7 * Compression : 0 * Symbols : 26 * Unique Elements: 249 Symbol Dim Type Explanatory text 1 bdraft 4 Equ Differences 2 brepco 3 Equ Differences 3 ccombal 4 Equ Differences 4 consbal 4 Equ Differences 5 cost 3 Equ Differences 6 demnat 3 Equ Differences 7 divcnlsea 3 Equ Differences 8 divsea 2 Equ Differences 9 fodder 4 Equ Differences 10 grnfdr 4 Equ Differences 11 laborc 4 Equ Differences 12 nbal 3 Equ Differences 13 nwfpalc 2 Equ Differences 14 objn 1 Equ Differences 15 objnn 1 Equ Differences 16 objz 1 Equ Differences 17 objzn 1 Equ Differences 18 protein 4 Equ Differences 19 prseaw 3 Equ Differences 20 qcombal 4 Equ Differences 21 subirrc 4 Equ Differences 22 tdraft 4 Equ Differences 23 watalcpro 3 Equ Differences 24 watalcsea 3 Equ Differences 25 watalcz 4 Equ Differences 26 waterbaln 4 Equ Differences C:\projects\tmp> |
Apart from a small bug related to $ONEMPTY, it turns out that the way GDXDUMP exports equations records, it looses information about the equation type. This leads to the above results. Luckily in practice this will not be an issue, as equations are not often part of such an exercise.
Background.
During a course I taught about GAMS I was asked if it is possible to edit GDX files. The answer is: GDXDUMP will give you a GAMS representation of a GDX file which you can edit. Using the call:
GAMS gmsfile gdx=newgdxfile
you can make a new GDX file with the changes incorporated. The tool GDXDIFF will allow you to monitor the changes.
Although this is correct, I chose the INDUS89 example as illustration. That was unfortunate, as that failed because of the exotic Equation problem.
No comments:
Post a Comment