Page 1 of 1

How to ranging variables

Posted: Tue Mar 26, 2019 4:46 pm
by Yehuda
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.



Re: How to ranging variables

Posted: Wed Mar 27, 2019 11:31 am
by saghafiiii

I'm afraid you did not explain your problem well.
would you mind making it more clear?

Re: How to ranging variables

Posted: Wed Mar 27, 2019 5:05 pm
by Yehuda
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!


Re: How to ranging variables

Posted: Thu Mar 28, 2019 8:37 am
by saghafiiii
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 :

Code: Select all

positive variable X , Y , Z;

eq1$(X = 0 or X > 1  ) .. 	X + Y * Z =e= 6;

I believe it works, try it.

Re: How to ranging variables

Posted: Thu Mar 28, 2019 2:07 pm
by Yehuda
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!


Re: How to ranging variables

Posted: Mon Apr 08, 2019 4:32 pm
by Fred

You might want top have a look at semi-continous variables: ... iableTypes