Page 1 of 1

Assign Values to variables

Posted: Mon Mar 12, 2018 10:22 am
by M.Walde
Hey guys,

I'm a beginner, when it comes to GAMS.

I have a question about a variable. I'm right now trying to model a model of a thermal energy storage.
For this I need to use ordered sets to calculate the temperature with respect to the temperature of the time step before.

For this I implemented the set:
set i time steps / 0*720 /;

as the number of time steps.
I declared the temperature:
variable T_ti(i) input temperature of the thermal energy storage;

as a subset of i. Now I want to assign an initial value to the first value of T_ti.
How do I do this? Do I need to implement an equation for it?

Thanks a lot!

Cheers,
Max

Re: Assign Values to variables

Posted: Mon Mar 12, 2018 10:43 am
by Renger
Hi Max

If you want to fix the starting point, you just write

Code: Select all

T_ti.FX("0") = 27; 
If you want to give it a starting point for the solver (GAMS assumes 0 if you don't do that):

Code: Select all

T_ti.L("0") = 27; 
Cheers
Renger

Re: Assign Values to variables

Posted: Mon Mar 12, 2018 2:51 pm
by M.Walde
Thank you for your fast reply!
Your explanation helped me a lot.

Re: Assign Values to variables

Posted: Thu Mar 15, 2018 12:09 pm
by Adam92
Hey,

I have a similar problem. I also want to assign starting values to my MIP in order to speed up the solution. I tried assigning the values using the ".l" suffix to the respective values and using the mipstart=1 option of CPLEX. However, this solution was not recognozed since the log file contains the following message : "MIP start 'm1' defined no solution".

The weird thing about it is, that I just used the solution I got from a presolve of the exact same model in order to play around with the syntax.

Any suggestions how to fix this ?

Kind regards