Page 1 of 1

Missing -ve sign during equation formulation in .lst file

Posted: Sat Dec 07, 2019 7:10 am
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,

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

Posted: Mon Dec 09, 2019 8:08 am
by Fred
Hi,

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

Best,
Fred

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

Posted: Mon Dec 09, 2019 12:19 pm
by roys
Please find the GDX files currently used attached below.

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

Posted: Mon Dec 09, 2019 12:20 pm
by roys
Please use this attached version of the .gms file
Trial2.gms
(9.3 KiB) Downloaded 205 times
while using the GDX files.

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

Posted: Mon Dec 09, 2019 1:33 pm
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

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

Posted: Mon Dec 09, 2019 2:01 pm
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,

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

Posted: Mon Dec 09, 2019 2:04 pm
by roys
lst file

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

Posted: Mon Dec 09, 2019 2:53 pm
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