Page 1 of 1

To binary or not to binary...

Posted: Sat Aug 11, 2018 1:03 pm
by Lenilein78
Dear GAMS community,

I have a doubt about the best way to formulate an optimization problem.

Basically I am trying to find the minimal steam consumption that depends on a temperature variable which level can be anywhere between 50°C and 150°C. So I would like the program to calculate what is the lowest steam consumption and the corresponding level of my temperature variable.

I defined a set for all temperatures between 50 and 150 degrees and used a binary variable over this set for finding the optimal value for my temperature. This worked but I realized that if I start applying this procedure for further variables the complexity of the solving procedure increases too much.

Is there any other way I could do such calculation without using a binary variable? (To find the best value of a variable over an interval)

I hope my beginner's question is understandable, if not please let me know :)

Re: To binary or not to binary...

Posted: Tue Aug 14, 2018 3:26 pm
by Manassaldi
Hi, you can use a bounded continuous variable.
positive variable
T
;
T.lo=50;
T.up=150;

This works, except if you need that the variable take integer values.
Bye

Re: To binary or not to binary...

Posted: Tue Aug 14, 2018 4:45 pm
by Lenilein78
Thank you so much Manassaldi!
Discovering that a variable doesn't have to be defined over a set is life-changing :)

Re: To binary or not to binary...

Posted: Thu Aug 16, 2018 4:53 am
by GabrielYin
More precisely, if your variable can ONLY take integer values from 50 to 150, as you stated in the post, then define the variable used by Manassaldi as integer variable like the following.

Code: Select all

Integer Variable T;
T.lo=50;
T.up=150;
For more definition reference, you can visit the documentation site.
https://www.gams.com/latest/docs/UG_Variables.html

Cheers.
Gabriel

Re: To binary or not to binary...

Posted: Thu Aug 16, 2018 10:25 am
by Lenilein78
Great, it is so much easier than I thought!!

Thank you,
Helene