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
How to define decision variable with fixed numbers? Topic is solved
-
- User
- Posts: 30
- Joined: 3 years ago
- Location: Ahmedabad
- Contact:
Re: How to define decision variable with fixed numbers?
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
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
-
- User
- Posts: 30
- Joined: 3 years ago
- Location: Ahmedabad
- Contact:
Re: How to define decision variable with fixed numbers?
Thanks alot for your answer.
It was an easy and straightforward . But could not struck me.
Thanks again
It was an easy and straightforward . But could not struck me.
Thanks again