Missing -ve sign during equation formulation in .lst file

Problems with syntax of GAMS
Post Reply
User avatar
roys
User
User
Posts: 8
Joined: 5 years ago

Missing -ve sign during equation formulation in .lst file

Post by roys »

Hello,

I have a attached a production cost model for a large power system below (Trial2.gms). The syntax seems alright as it compiles fine. However after looking at the .lst file post compilation I have a doubt about why GAMS is formulating the equations associated with a particular constraint as it is now. The equations of interest in the .lst file have been copied in the Trial2_lst.txt file attached.
The equation of interest is the objective function, line 322 of Trial2.gms which defines the total production cost as the sum of production cost across each interval. The formulation is : PRODCOST =E= SUM(INTERVAL, PRODCOST_BY_INTERVAL(INTERVAL)). So after compiling the .lst file should report back the constraint as PRODCOST - SUM(INTERVAL, PRODCOST_BY_INTERVAL(INTERVAL)) = 0. However if we take a look at line 3 in Trial2_lst.txt the formulation in the .lst file seems to be missing a -ve sign. As a result the production cost calculated is also turning out to be negative. Any help would be really appreciated.

Thanks,
Attachments
Trial2_lst.txt
.lst file equations of interest
(122.39 KiB) Downloaded 195 times
Trial2.gms
production cost model
(9.86 KiB) Downloaded 189 times
Fred
Posts: 372
Joined: 7 years ago

Re: Missing -ve sign during equation formulation in .lst file

Post by Fred »

Hi,

Could you share the GDX files such that one could actually run the gms file to reproduce this?

Best,
Fred
User avatar
roys
User
User
Posts: 8
Joined: 5 years ago

Re: Missing -ve sign during equation formulation in .lst file

Post by roys »

Please find the GDX files currently used attached below.
Attachments
GENERAL_MODEL_INPUT.gdx
(32.45 KiB) Downloaded 198 times
DASCUCINPUT2.gdx
(114.98 KiB) Downloaded 189 times
DASCUCINPUT1.gdx
(104.12 KiB) Downloaded 196 times
User avatar
roys
User
User
Posts: 8
Joined: 5 years ago

Re: Missing -ve sign during equation formulation in .lst file

Post by roys »

Please use this attached version of the .gms file
Trial2.gms
(9.3 KiB) Downloaded 201 times
while using the GDX files.
Fred
Posts: 372
Joined: 7 years ago

Re: Missing -ve sign during equation formulation in .lst file

Post by Fred »

Hi,

I cannot reproduce your findings. The equation listing shows

Code: Select all

---- OBJECTIVE  =E=  

OBJECTIVE..  PRODCOST - PRODCOST_BY_INTERVAL(7) - PRODCOST_BY_INTERVAL(1) - [...] - PRODCOST_BY_INTERVAL(167) - PRODCOST_BY_INTERVAL(168) =E= 0 ; (LHS = 0)     
Are you sure that the lst excerpt Trial2_lst.txt from your initial post was generated with Trial2.gms? Maybe you can share the full lst.

Best,
Fred
User avatar
roys
User
User
Posts: 8
Joined: 5 years ago

Re: Missing -ve sign during equation formulation in .lst file

Post by roys »

Hello,

Attached the full lst file below. I rechecked the equation listings and they appear fine for me too. However the next question I guess is figuring out why my objective function is negative when all its constituents bear a positive value.
Anyways thanks a lot for the help.
Regards,
User avatar
roys
User
User
Posts: 8
Joined: 5 years ago

Re: Missing -ve sign during equation formulation in .lst file

Post by roys »

lst file
Attachments
full_lst.zip
(7.88 MiB) Downloaded 173 times
Fred
Posts: 372
Joined: 7 years ago

Re: Missing -ve sign during equation formulation in .lst file

Post by Fred »

roys wrote: 4 years ago [...]why my objective function is negative when all its constituents bear a positive value.
Your lst file shows that many of the constituents of the objective function do not bear a positive value.

I hope this helps!

Fred
Post Reply