Objective Function - error 409 Unrecognizable item

Description of the issue

Hi there, I am new to gamspy, currently I am trying to implement the gams file of Grossmann “synheat.gms” in gamspy. However I am running into some issues as I am implementing the objective function. It was quite bulky in the initial formulation that I started with, so I decided to refactor it a bit. Now however I am gettting the error below.

Error message and stack trace

Traceback (most recent call last):
File "/Users/…filename.py, line 675, in
super_heat = Model(
^^^^^^
File “/opt/miniconda3/envs/pyCourse/lib/python3.11/site-packages/gamspy/_model.py”, line 315, in init
self.container._synch_with_gams()
File “/opt/miniconda3/envs/pyCourse/lib/python3.11/site-packages/gamspy/_container.py”, line 492, in _synch_with_gams
summary = runner.run(relaxed_domain_mapping, gams_to_gamspy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/miniconda3/envs/pyCourse/lib/python3.11/site-packages/gamspy/_backend/local.py”, line 82, in run
self.execute_gams(gams_string, gams_to_gamspy)
File “/opt/miniconda3/envs/pyCourse/lib/python3.11/site-packages/gamspy/_backend/local.py”, line 117, in execute_gams
raise exception
File “/opt/miniconda3/envs/pyCourse/lib/python3.11/site-packages/gamspy/_backend/local.py”, line 103, in execute_gams
self.container._send_job(self.job_name, self.pf_file, self.output)
File “/opt/miniconda3/envs/pyCourse/lib/python3.11/site-packages/gamspy/_container.py”, line 353, in _send_job
check_response(response, job_name)
File “/opt/miniconda3/envs/pyCourse/lib/python3.11/site-packages/gamspy/_container.py”, line 179, in check_response
raise GamspyException(
gamspy.exceptions.GamspyException: There was a compilation error. Check /var/folders/cs/04f9b9g124vdpdnnq9dfnr300000gn/T/tmpf94fi4ke/_fdaeeab3-2a6d-41e0-b976-b8071e9fb5b1.lst for more information.

=============
Error Summary

673 super_heat_objective … cost =e= ((((((unitc * ((sum((i,j,st),z(i,j,st)) + sum(i,zcu(i))) + sum(j,zhu(j)))) + (acoeff * sum((i,j,k),( rPower((((q(i,j,k) * ((1 / hh(i)) + (1 / hc(j)))) / (( rPower(((((dt(i,j,k) * dt(i,j,k + 1)) * (dt(i,j,k) + dt(i,j,k + 1))) / 2) + 1e-06),0.33333) ) + 1e-06)) + 1e-06),aexp) )))) + (hucoeff * ( rPower(sum(j,(((qh(j) * ((1 / hc(j)) + (1 / hhu))) / ( rPower(((((thuin - tcout(j)) * dthu(j)) * (((thuin - tcout(j)) + dthu(j)) / 2)) + 1e-06),0.33333) )) + 1e-06)),aexp) ))) + (cucoeff * sum(i,( rPower((((qc(i) * ((1 / hh(i)) + (1 / hcu))) / ( rPower((((((thout(i) - tcuin) * dtcu(i)) * ((thout(i) - tcuin) + dtcu(i))) / 2) + 1e-06),0.33333) )) + 1e-06),aexp) )))) * acc) + ((sum(j,(qh(j) * hucost)) + sum(i,(qc(i) * cucost))) * hours)) =e= super_heat_objective_variable;
**** $409
**** LINE 5 INPUT /var/folders/cs/04f9b9g124vdpdnnq9dfnr300000gn/T/tmpf94fi4ke/_fdaeeab3-2a6d-41e0-b976-b8071e9fb5b1.gms
**** 409 Unrecognizable item - skip to find a new statement
**** looking for a ‘;’ or a key word to get started again
674 Model super_heat / eh,eqc,teh,ec,eqh,tec,month,montc,monthl,montcf,tinh,tinc,logq,logqh,logqc,logdth,logdtc,logdtcu,logdthu,minqf,super_heat_objective /;

**** 1 ERROR(S) 0 WARNING(S)

GAMSPy version

GAMSPy version: 1.1.0
GAMS version: 48.2.0
gamspy_base version: 48.2.0

Hi,

Can you share your script so that we can get a better understanding of what’s wrong?

Ah I found my error just now, I used the commonly used syntax from GAMS, where the objective function was declared like:
obj = cost == expression,
when instead I should have just typed out
obj = expression
Sorry for the waste of time…

How can I close this topic?