## Assign Values to variables

Problems with syntax of GAMS
M.Walde
User
Posts: 16
Joined: 1 year ago

### Assign Values to variables

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

Renger
Posts: 406
Joined: 3 years ago

### Re: Assign Values to variables

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
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

M.Walde
User
Posts: 16
Joined: 1 year ago

### Re: Assign Values to variables

Your explanation helped me a lot.

User
Posts: 3
Joined: 1 year ago

### Re: Assign Values to variables

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