ERRSAMBAL/SAMBALCHK

Problems with syntax of GAMS
Post Reply
Judith
User
User
Posts: 4
Joined: 5 months ago

ERRSAMBAL/SAMBALCHK

Post by Judith » 4 months ago

Hi Members,

Could someone please help me overcome this execution error?
Error at line 921: division by zero

Following is the decription:

PARAMETER
SAMGAPCUTOFF max acceptable abs gap bt model SAM row and col totals
ERRSAMBAL(AC) if UNDF -- the absolute imbalance for AC exceeds cutoff

SAMGAPCUTOFF = 1.0e-5;

921 ERRSAMBAL(AC)$(ABS(SAMBALCHK(AC)) GT SAMGAPCUTOFF) = 1/0;

In my understanding, line 921 implies that an error occurs if the left side is greater than SAMGAPCUTOFF. However, I have checked the SAM separately and it balanced in the SAMBAL program. The maximum difference in the balanced SAM row-column total is 5.04-e06, and I think this should not be causing the problem in execution.

Where else should I be looking to eliminate this execution error?

Thank you in advance.

Judith

User avatar
dirkse
Moderator
Moderator
Posts: 92
Joined: 3 years ago
Location: Fairfax, VA

Re: ERRSAMBAL/SAMBALCHK

Post by dirkse » 4 months ago

Judith,

If the numbers balance somewhere else and they don't in GAMS, I would start by checking if I am really using the same numbers in both places.

I would also look at the larger entries in the sambalchk parameter. If you dump that to GDX immediately before the division you can browse it afterwards:

execute_unload 'debugSamBal' sambalchk;

If you want to squeeze out the noise (i.e. the tiny deltas) you can do this:

sambalchk(ac)$[abs(sambalchk(ac) < 5e-6] = 0;

With this info you can at least focus your debugging and spot checking.

-Steve

Post Reply