Setting Specific Variable Values Topic is solved

Problems with modeling
Post Reply
Witsie
User
User
Posts: 2
Joined: 4 years ago

Setting Specific Variable Values

Post by Witsie »

Hi all,

Is it possible to force GAMS to choose the value for a variable from a specific set of options in an MINLP? For instance, the length of a pipe can only be 2, 5, 16 or 25 metres, how would I define the variable such that GAMS can only choose from amongst these options?

Best,

Pemberai
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Setting Specific Variable Values

Post by bussieck »

This has little to do with GAMS. Write down your MINLP with regular math constructs then the implementation in GAMS will be easy. Perhaps you should look into some modeling book (e.g. HP Williams, cited a lot by me in this forum). A short hint: have a set of selections set s / s1*s4 / with sizes parameter p(s) / s1 2, s2 5, s3 16, s4 25/. Now introduce a binary variable b(s) with sum(s, b(s)) =e= 1; and l =e= sum(s, p(s)*b(s)); where l is the endogenous length of your pipe.

-Michael
Witsie
User
User
Posts: 2
Joined: 4 years ago

Re: Setting Specific Variable Values

Post by Witsie »

Thank you so much. It worked
Post Reply