Assign Values to variables

Problems with syntax of GAMS
Post Reply
M.Walde
User
User
Posts: 16
Joined: 9 months ago

Assign Values to variables

Post by M.Walde » 9 months ago

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

User avatar
Renger
Posts: 221
Joined: 2 years ago

Re: Assign Values to variables

Post by Renger » 9 months ago

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

M.Walde
User
User
Posts: 16
Joined: 9 months ago

Re: Assign Values to variables

Post by M.Walde » 9 months ago

Thank you for your fast reply!
Your explanation helped me a lot.

Adam92
User
User
Posts: 3
Joined: 9 months ago

Re: Assign Values to variables

Post by Adam92 » 9 months ago

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

Post Reply