Hi all,
I'm having trouble with variables that the model chooses to give them very small values but not zero, values that are not reasonable for these variables. My question is how can I give the model a range for these variables such that: on the one hand they can be zero and on the other hand they can not be for example smaller than 0.1? Something like: x=0 or x>0.1.
Currently, these variables are defined as positive variables.
Thanks,
Yehuda
How to ranging variables

 User
 Posts: 6
 Joined: 2 years ago
Re: How to ranging variables
Hi
I'm afraid you did not explain your problem well.
would you mind making it more clear?
I'm afraid you did not explain your problem well.
would you mind making it more clear?
Re: How to ranging variables
Thank for your response.
I'll try to make it clear.
Since small values for one of the variables in my model are causing an infeasible solution, I'm looking for a way to solve this problem.
However, a simple restriction like X>1 is inapplicable because I want to give this variable the option to be zero. Therefore, I'm trying to give this variable a specific range like:
X=0 or X>1 but I don't know how to do so.
In other words, what I'm trying to do is to create a specific range in which one of my variables can be changed. This range is not continuous. The first part is zero (only one value), and the second part is all the values above 1.
I hope my problem is clear now.
Thank you again for the willingness to help, I really appreciate it!
Yehuda
I'll try to make it clear.
Since small values for one of the variables in my model are causing an infeasible solution, I'm looking for a way to solve this problem.
However, a simple restriction like X>1 is inapplicable because I want to give this variable the option to be zero. Therefore, I'm trying to give this variable a specific range like:
X=0 or X>1 but I don't know how to do so.
In other words, what I'm trying to do is to create a specific range in which one of my variables can be changed. This range is not continuous. The first part is zero (only one value), and the second part is all the values above 1.
I hope my problem is clear now.
Thank you again for the willingness to help, I really appreciate it!
Yehuda

 User
 Posts: 6
 Joined: 2 years ago
Re: How to ranging variables
Hi again.
Now I know what is your problem.
I'm afraid you can not use ".lo" or ".up" for doing this but I think there is an alternative solution:
foe example suppose you have an equation on X in your problem.
X + Y * Z >= 6 ;
firstly you define :
I believe it works, try it.
Now I know what is your problem.
I'm afraid you can not use ".lo" or ".up" for doing this but I think there is an alternative solution:
foe example suppose you have an equation on X in your problem.
X + Y * Z >= 6 ;
firstly you define :
Code: Select all
positive variable X , Y , Z;
Equations
eq1
;
eq1$(X = 0 or X > 1 ) .. X + Y * Z =e= 6;
Re: How to ranging variables
Thank you again.
So I tried your suggestion but it causes another problem. Now the model is declaring an endogenous problem and it prohibits the use of $ operation.
I thought that the ranging issue will be easy to defined, but it's apparently not.
Anyway, thanks a lot!
Yehuda
So I tried your suggestion but it causes another problem. Now the model is declaring an endogenous problem and it prohibits the use of $ operation.
I thought that the ranging issue will be easy to defined, but it's apparently not.
Anyway, thanks a lot!
Yehuda
Re: How to ranging variables
Yehuda,
You might want top have a look at semicontinous variables: https://www.gams.com/latest/docs/UG_Var ... iableTypes
Best,
Fred
You might want top have a look at semicontinous variables: https://www.gams.com/latest/docs/UG_Var ... iableTypes
Best,
Fred