CEG Model

Problems with syntax of GAMS
Post Reply
Baud1094
User
User
Posts: 4
Joined: 2 weeks ago

CEG Model

Post by Baud1094 » 1 week ago

Hello everyone. My name is Baudouin. For my master thesis, i work on a CEG modele in GAMS. I alreay closed the modele but i have some errors. Please help me to correct errors. Thanks
Attachments
Untitled_2.gms
(36.63 KiB) Downloaded 3 times

Fred
Posts: 144
Joined: 2 years ago

Re: CEG Model

Post by Fred » 1 week ago

Hi,

I suggest to run with command line parameter errmsg=1 (https://www.gams.com/latest/docs/UG_Gam ... MSAOerrmsg) to reposition compilation error messages in the lst file and then go through you errors step by step by searching for four asterisks (****) in the lst file (they mark an error). You will find things like

Code: Select all

   1  $Memoire 2019
****   $210
**** 210  Unknown dollar control option. Valid are -
****        Error, Debug, Eject, Clear, onMargin, offMargin, minCol
****        maxCol, comment, dollar, onDigit, offDigit, hidden, onText
[...]
there is no such dollar control option

Code: Select all

  98  LEGUMES
****        $170
**** 170  Domain violation for element
  99  AUT_VIVR_LOC
  [...]
You define "LEGUMES" to be an element of subset X(i) where there is no such element LEGUMES in superset i.

Code: Select all

476  k(i) parametre distributif de la fonction de substitution commerciale du produit composite i
****  $195,318
**** 195  Symbol redefined with a different type
**** 318  Domain list redefined - no previous domain list - * assumed
****         when data was associated with this symbol
[...]
You cannot have a parameter k if there is already another symbol K (GAMS is not case sensitive)


There are many more errors, so I hope the hints above give you some useful hints to debug your code yourself.

Best,
Fred

PS If you want other form users to help you, I suggest to provide all the files needed to run your code (there is for example an Excel file)

Baud1094
User
User
Posts: 4
Joined: 2 weeks ago

Re: CEG Model

Post by Baud1094 » 1 week ago

Thanks for your reply.. I am corrected some errors whith your indication. But errors 148 and 141 persists. I attach the ecxel files that is the MCS (that i use for calibration)..
Attachments
Untitled_2.gms
GAMS CODE
(37.39 KiB) Downloaded 4 times
MCS2015.xlsx
MCS
(49.9 KiB) Downloaded 5 times

User avatar
Renger
Posts: 295
Joined: 2 years ago

Re: CEG Model

Post by Renger » 1 week ago

Hi Baud

Gams tells you exactly what is wrong with your code: In the case of the error

Code: Select all

 625  XSO(j) = Baud("Total Ligne",j);
****                               $148

148  Dimension different - The symbol is referenced with more/less
        indices as declared
Gams puts the $148 below Baud. If you go up in your code, you will find that you define and import Baud as a four-dimensional parameter. Gams tells you that you reference Baud with more/less indices as declared because you use Baud as a two-dimensional parameter. There are two missing.

Take a good look at these error messages. Most of the time they are clear enough to solve your problems.
For the $125 problem, you could try to search this forum, as it has been asked many times before.

Cheers
Renger
____________________________________
Enjoy modeling even more: The lazy economist

Baud1094
User
User
Posts: 4
Joined: 2 weeks ago

Re: CEG Model

Post by Baud1094 » 4 days ago

Hello thanks for your reply. Finaly i am correct all syntax error and some runtime error, except one divided by zero) that i dont understand. I note that when I call data of excel file for set "i" for variable "MO(i)", two elements (Laits_frais and Oeuf_Aut_Elev) of this set have not assignement. For me that is source of error.
Thanks....
Attachments
Untitled_2.gms
(41.06 KiB) Downloaded 2 times

User avatar
Renger
Posts: 295
Joined: 2 years ago

Re: CEG Model

Post by Renger » 3 days ago

Hi
If there are no imports, there will be no tariff, so you can change the code to (the $ condition on the left drops the equation when MO(IM) = 0.

Code: Select all

tm(IM)$MO(IM) = DDMO(IM)/(PWMO(IM)*EO*MO(IM));
If you correct this, you will run into other errors that are caused because you do not initialize all your variables (e.g. M, DD), so Gams assumes zero as start values which leads to problems in expressions like M(im,t)** as it is not allowed to raise zero to a power.

Cheers
Renger

Enjoy modeling even more: The lazy economist
____________________________________
Enjoy modeling even more: The lazy economist

Baud1094
User
User
Posts: 4
Joined: 2 weeks ago

Re: CEG Model

Post by Baud1094 » 13 hours ago

Hi! Thanks for reply. I alredy initialized all variable. I try to put same condition for tm ($MO(IM)) in M(IM,t) equation. But that is not solution. I think that it is still same but condition $ not react in equation M(IM,t).
Cheers...

Post Reply