To binary or not to binary...

Problems with modeling
Post Reply
Lenilein78
User
User
Posts: 9
Joined: 6 years ago
Location: Stuttgart, Germany

To binary or not to binary...

Post 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 :)
Manassaldi
User
User
Posts: 118
Joined: 7 years ago
Location: Rosario - Argentina

Re: To binary or not to binary...

Post 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
Lenilein78
User
User
Posts: 9
Joined: 6 years ago
Location: Stuttgart, Germany

Re: To binary or not to binary...

Post by Lenilein78 »

Thank you so much Manassaldi!
Discovering that a variable doesn't have to be defined over a set is life-changing :)
GabrielYin
User
User
Posts: 72
Joined: 6 years ago
Location: Dallas, TX, USA
Contact:

Re: To binary or not to binary...

Post 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
Lenilein78
User
User
Posts: 9
Joined: 6 years ago
Location: Stuttgart, Germany

Re: To binary or not to binary...

Post by Lenilein78 »

Great, it is so much easier than I thought!!

Thank you,
Helene
Post Reply