Error 2- Identifier Expected

Problems with syntax of GAMS
Zohreh
User
User
Posts: 9
Joined: 4 years ago

Re: Error 2- Identifier Expected

Post by Zohreh »

Thank you very much for your complete response.
We actually celebrate Nowrouz, which is the first day of Spring.
Anyway, Happy Christmas!
I wish you the bests.
Zohreh
User
User
Posts: 9
Joined: 4 years ago

Re: Error 2- Identifier Expected

Post by Zohreh »

Dear Dr. Bussieck,
The model works well, but I have one problem.
In equation
1/Te*log((W*Te/D)+1) =L= M-N
the models considers the left hand side up to 2 digits and it causes some numerical examples get the wrong answer.
I have attached the Excel File, including four numerical examples. In the second and fourth ones, GAMS considers the rounded value of the above mentioned equation's left hand side up to 2 digits.
I would highly appreciate it if you help me solve this issue.
Best regards.
input - Copy.xlsx
(19.24 KiB) Downloaded 299 times
User avatar
dirkse
Moderator
Moderator
Posts: 214
Joined: 7 years ago
Location: Fairfax, VA

Re: Error 2- Identifier Expected

Post by dirkse »

Zohreh,

GAMS does its calculations in double-precision arithmetic - there is no calculating "up to 2 digits" or anything like that. However, the listing file displays values in rounded form. Also, solvers do their calculations with tolerances, so an equation like LHS <= RHS is not satisfied exactly, but only within a tolerance (e.g. 1e-5 or similar). These facts, or perhaps others, may be relevant to tracking down any inconsistencies between your results and your expectations, but it's not likely to be any rounded calculations in GAMS itself.

I could perhaps say more if you could be more explicit about the problem. For example, what result in GAMS do you see that you don't expect? What do you expect to see instead? Why?

-Steve
Zohreh
User
User
Posts: 9
Joined: 4 years ago

Re: Error 2- Identifier Expected

Post by Zohreh »

Dear Dr. Dirkse,
I have 2 cases: Tw<=(M-N) and Tw>=(M-N).
If Tw<(M-N), the result would be the minimum of m1, m2, and m3 (m4, m5, m6, m7, and m8 are definitely infeasible).
If Tw>(M-N), the result would be the minimum of m4, m5, m6, m7, and m8 (m1, m2, and m3 are definitely infeasible).
If Tw=(M-N), the result would be the minimum of m1 to m8 (of course the ones which are feasible).
In the Excel file, for Sc1 and Sc2, Tw=0.059991 and M-N= 0.07, since Tw<(M-N), I expected the result be the minimum of m1, m2, and m3. But, GAMS finds feasible solutions for m1, m2, m3, and m5 (it considers Tw=(M-N)).
Thank you very much for your attention.
input - Copy.xlsx
(9.18 KiB) Downloaded 307 times
ekalo
User
User
Posts: 4
Joined: 2 years ago

Re: Error 2- Identifier Expected

Post by ekalo »

Hi GAMS forum Friends
I have got similar challenges like Zohreh while running my model. I have received "an error-2 Identifier expected" on several lines of the attached GAMS Code. I would appreciate it if someone can help me to remove these errors.
Gams New.gms
(9.87 KiB) Downloaded 167 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Error 2- Identifier Expected

Post by bussieck »

Hi,

You are mixing GAMS and MPSGE syntax. The MPSGE syntax is inside a $onText/$offText area and ignored by the GAMS compiler. Check out the MPSGE introduction at: https://www.gams.com/latest/docs/UG_MPSGE_Intro.html.

-Michael
ekalo
User
User
Posts: 4
Joined: 2 years ago

Re: Error 2- Identifier Expected

Post by ekalo »

Hi Michael
Thank you very much for your prompt response, as you suggested me, I have inserted the MPSGE syntax in $onand$offtext in section (ii) but still, nothing has improved. Please, can you check and correct it for me. I have attached the entire model syntax and excel sheet.

With Kind regards

Ekalo
NB.xlsx
(28.31 KiB) Downloaded 166 times
CGE Water.gms
(26.3 KiB) Downloaded 154 times
Attachments
CGE Water.gms
(26.3 KiB) Downloaded 146 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Error 2- Identifier Expected

Post by bussieck »

There are many compilation error. Get rid of them. The compiler error message will help you with this. For example, then first one:

Code: Select all

 201  chksam(i) = sum(j,sam(i,j)-sam(j,i));
****                         $171,148 $171,148
**** 148  Dimension different - The symbol is referenced with more/less
****         indices as declared
**** 171  Domain violation for set
Your parameter sam is declared as "Table SAM(r,i,j) initial SAM ;". What happened to the "r" index in your chksam assignment? Please study the GAMS material to fix the errors on after the other yourself.

Good luck,
-Michael
ekalo
User
User
Posts: 4
Joined: 2 years ago

Re: Error 2- Identifier Expected

Post by ekalo »

Hi Michael
Thank you very much again, okay I got the balance check part, please can you help me with section II which is MPSGE model syntax and I will deal with the rest part. Please, please, just help me with section II of my GAMS code and it was attached with my previous message. God may bless you, sir.

With regards

Ekalo
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Error 2- Identifier Expected

Post by bussieck »

Sorry, I can't help with MPSGE syntax. Never learned that. I guess someone suggested to you using MPSGE, I would go to that person to get help. -Michael
Post Reply