Page 1 of 1

Shock in Loop cause domain errors

Posted: Mon Jan 28, 2019 10:49 am
by qli091
Dear GAMS friends,

My model runs smoothly before I give a shock from the 4th year. The error information is "** Domain error(s) in nonlinear functions. Check bounds on variables." My shock is given as follows:

Code: Select all

SET YR  YEAR /2012*2045/;
LOOP(YR$(ORD(YR) LE 4),  
IF(ORD(YR)=4,
TM('ANZ','KR',S)=0.4*TM('ANZ','KR',S);
TM('KR','ANZ',S)=0.4*TM('KR','ANZ',S);
TM('ANZ','JP',S)=0.4*TM('ANZ','JP',S);
TM('JP','ANZ',S)=0.4*TM('JP','ANZ',S);
);
OPTION RESLIM=10000;
SOLVE FDIHE_SIM1 MAXIMIZING U USING NLP;
);
I also tried with the $ selection method to insure the shock begins in the 4th year, but the same error occurs.
I also tried to move the shock to TM out of the Loop, i.e. as a shock to the basic model, no error occurs.

Many thanks,
Qiaomin

Re: Shock in Loop cause domain errors

Posted: Tue Jan 29, 2019 6:59 am
by Renger
Hi Qiaomin
This question is hard to answer without seeing the complete code, so you might want to attach your code.
CHeers
Renger

Re: Shock in Loop cause domain errors

Posted: Thu Jan 31, 2019 6:41 am
by qli091
Hi Renger,

I am in a process of runing a dynamic GAMS program. Problems come and go whenever I change something like bounds, scaling, or moving forward for the next year. Howevery, the problem "Domain errors in nonlinear functions" appears very frequently. I don't quite understand what does this mean and what is the implied problem. If I know what's going wrong, I may be able to fix the model myself.

Many thanks,
Qiaomin

Re: Shock in Loop cause domain errors

Posted: Fri Feb 01, 2019 6:55 am
by Renger
Hi Qiaomin

Two links that might be of help: Cheers
Renger