Page 1 of 1

Setting Specific Variable Values

Posted: Wed Jun 19, 2019 10:11 am
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

Re: Setting Specific Variable Values

Posted: Wed Jun 19, 2019 8:47 pm
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

Re: Setting Specific Variable Values

Posted: Wed Jun 19, 2019 9:30 pm
by Witsie
Thank you so much. It worked