Initial values for the variables in NLP

Problems with modeling
Post Reply
shoebmoon
User
User
Posts: 4
Joined: 5 years ago

Initial values for the variables in NLP

Post by shoebmoon »

Hi i am trying to enforce an initial value for the variable X(t) as follows
And i want the initial value for the other variable Cco2l(t) to be calculate accordingly through the equation. But the error comes that symbol (Cco2l.l) declared but no values have been assigned. I thought the equation would help assign this rather?


X.l(t)=0.1;

X.l(t)= (Mua*0.2566*i1(t)*X.l(t)*Cco2l.l(t))/(Cco2l.l(t)+Kc+power(Cco2l.l(t),2)/Ki )-Muad*power(X.l(t),2) ;
X.l(t)= (Mua*0.2566*i2(t)*X.l(t)*Cco2l.l(t))/(Cco2l.l(t)+Kc+power(Cco2l.l(t),2)/Ki )-Muad*power(X.l(t),2) ;

X.lo(t)=0.1; X.up(t)=2.5;
Cco2l.lo(t)=0.0001; Cco2l.up(t)=1;
i1.lo(t)=10;
i1.up(t)=60;
i2.lo(t)=10;
i2.up(t)=60;


Also, if I do not provide the suffix 'l' for the other dynamic variables i1, i2. the compiler says it needs the suffix 'l'. What I saw in the GAMS guide that not necessarily all the dynamic variables need to have the level value while using equation feasibility to force initial values. The below example is from the official GAMS webpage. Here the variable/parameter tm is provided woithout the suffix l.

pwm.L(i) = 1;
er.L = 1;
pm.L(i) = pwm.L(i)*er.L*(1+tm(i));

When I try while providing .l values for all three entities X, I, Cco2l, the solver returns arbitrary initial values rather than the allotted ones.
I have tried with solvers CONOPT, SNOPT, IPOPT.
Whole of the code is attached in file in case needed for a better understanding.
Any leads would be appreciated.
Thanks!
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Initial values for the variables in NLP

Post by bussieck »

What do you mean by "enforce an initial value"? Initial values (the ones you specify with var.l before the solve statement) are there to help the solver to start the optimization from a good point. If you want to enforce a value for a variable you either have your equations (equ.. var =e= ...) or you can fix the variable (var.fx = ...) before the solve statement. Equations are not "executed" they are given to the solver when you execute the solve statement. Please read more about the basics of GAMS in introductory documentation like the tutorial (https://www.gams.com/latest/docs/UG_Tutorial.html).

-Michael
shoebmoon
User
User
Posts: 4
Joined: 5 years ago

Re: Initial values for the variables in NLP

Post by shoebmoon »

Thanks for your reply Michael.

The variable i wanted to fix for t=0 (t being the set for time points), is the part of Initial value problem ODE (which i am integrating numerically in GAMS), so i used the term enforce.

My idea was, that at the initial value provide by me, either the solver will give an optima or highlight the infeasibility at the initial value provided by me.
Post Reply