1/0 notation

Problems with syntax of GAMS
Post Reply
Sarah_Chamberland
User
User
Posts: 5
Joined: 5 years ago

1/0 notation

Post by Sarah_Chamberland »

Hi all,
I was wondering if someone had come across the 1/0 notation and what it meant. Here is an example:

Code: Select all

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;

 ERRSAMBAL(AC)$(ABS(SAMBALCHK(AC)) GT SAMGAPCUTOFF) = 1/0;
The result of this is that an error occurs if the left side is greater than SAMGAPCUTOFF.
Thank you!
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: 1/0 notation

Post by bussieck »

Hmmm, this looks like on old way to trigger an execution error if the data is too bad (the SAM is too imbalanced) to run the model. Nowadays, we would do things like this:

Code: Select all

Parameter
 SAMGAPCUTOFF  'max acceptable abs gap bt model SAM row and col totals'
 ERRSAMBAL(AC) 'the absolute imbalance for AC exceeds cutoff - we abort is this is none empty'
 ;

 SAMGAPCUTOFF = 1.0e-5;

 ERRSAMBAL(AC)$(ABS(SAMBALCHK(AC)) GT SAMGAPCUTOFF) = SAMBALCHK(AC);
 abort$card(ERRSAMBAL) ERRSAMBAL;
 
-Michael
Sarah_Chamberland
User
User
Posts: 5
Joined: 5 years ago

Re: 1/0 notation

Post by Sarah_Chamberland »

Thank you Michael!
Post Reply