How to define decision variable with fixed numbers? Topic is solved

Problems with syntax of GAMS
Post Reply
parag_patil
User
User
Posts: 30
Joined: 2 years ago
Location: Ahmedabad
Contact:

How to define decision variable with fixed numbers?

Post by parag_patil »

Dear all,

I am solving an optimization problem with MINLP in nature.

I am facing a small problem here. My decision variable is 'X'.

But this X can only choose a value from 0 , 0.25, 0.50 and 1.

So basically, it is not a discrete variable. In MATLAB , I could have defined an if-else loop, saying
if 'Y' is 1, X =0 ,
if 'Y' is 2, X =0.25 ,
if 'Y' is 3, X =0.5 and
if 'Y' is 4, X =1 ,

How to achieve the same here in GAMS? Can anyone please suggest me please?

Thanks
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: How to define decision variable with fixed numbers?

Post by abhosekar »

In your specific case, you can remodel X as a discrete variable. There are integer variables in GAMS that can take integer values, you can define X with a lower bound of 0 and an upper bound of 4. The X you are interested in is X/4.

You did not mention if Y is an integer variable or continuous variable in your Matlab code idea. If Y is integer, it is fairly straightforward as mentioned above. If it is not you will need to provide more information about Y.

Hope this helps.

- Atharv
parag_patil
User
User
Posts: 30
Joined: 2 years ago
Location: Ahmedabad
Contact:

Re: How to define decision variable with fixed numbers?

Post by parag_patil »

Thanks alot for your answer.

It was an easy and straightforward . But could not struck me.

Thanks again
Post Reply