## Setting Specific Variable Values Topic is solved

Problems with modeling
Witsie
User
Posts: 2
Joined: 5 months ago

### Setting Specific Variable Values

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

bussieck
Moderator
Posts: 349
Joined: 3 years ago

### Re: Setting Specific Variable Values

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
Posts: 2
Joined: 5 months ago

### Re: Setting Specific Variable Values

Thank you so much. It worked