I have a problem where a variable (i.e. temperature) at one time-interval (t) is dependent on the value in the previous interval (t-1). This relationship has been modeled as the constraint given below:

Initial temperature value (i.e. at t=0) is known, but I don’t know how to incorporate that into the given constraint. GAMS is considering the first equation as :

temp(“1”) =e= (0 - A(“1”))*other terms.

I want the 0 in the above equation to be replaced with the initial known temperature value. How can I do that?
Thanks.

There are many ways to accomplish what you want to do. I’ll give you two brief examples, assuming that you have initial temperature value at t=0 stored in a scalar temp_t0.

You can also use the technique used in the ramsey model in the model library. The link is below. This model is quite small and illustrates how to use subsets tfirst and tlast to handle the boundary times. It uses a lead to avoid an equation for tfirst: