Cannot solve error 148

Problems with syntax of GAMS
Post Reply
Twandekorte
User
User
Posts: 1
Joined: 7 years ago

Cannot solve error 148

Post by Twandekorte »

Hello,

I am trying to calculate welfare losses of drought. Therefore I am building my model step by step.
However, when I try to solve for the variable "Old_demand(j,y,a)" it says I am using the variable differently then I have declared it (error 148). I cannot seem to solve this error. It is probably very simple but I cannot work it out.

Thank you for your help.
Attachments
dynamisch maken code.gms
(2.72 KiB) Downloaded 301 times
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Cannot solve error 148

Post by Renger »

Hi
You have made the following errors:

Code: Select all

solve IMPREX USING DNLP maximize Old_demand(j,y,a);
You are maximizing several variables at the same time (and if this would be possible, you should have written it like

Code: Select all

solve IMPREX USING DNLP maximize Old_demand;
The maximand should be one-dimensional if you want to use (D)NLP, e.g.

Code: Select all


OBJ =E= sum((j,y,a) , Old_Demand(i,y,a));

solve IMPREX USING DNLP maximize OBJ;
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply