Page 1 of 1
Excempt zero from a free variable type
Posted: Tue Nov 06, 2018 2:00 pm
by arman.nedjati
Dear all,
I have a free variable that I do not want it to accept the value of zero. How can I fix this variable?
Regards,
Arman
Re: Excempt zero from a free variable type
Posted: Wed Nov 07, 2018 10:24 am
by bussieck
You cannot exclude a single value from the domain of a continuous variable. Optimization regions need to be compact. You can exclude an interval around 0, so x<=-1e-6 or x>=1e-6. For that you need to introduce a binary variable (b) that decides on what side of 0 you are. Moreover, you need good finite bounds for x (xlo and xup). Then you can write:
Code: Select all
x <= -1e-6 + b*(xup+1e-6)
x >= 1e-6 - (1-b)*(xlo-1e-6)
So for b=0 you have x<=-1e6 and x>=xlo and for b=1 you have x<=xup and x>=1e-6;
Since you will have a binary variable your model type might change from LP to MIP or NLP to MINLP.
-Michael
Re: Excempt zero from a free variable type
Posted: Thu Nov 08, 2018 12:25 am
by arman.nedjati
Dear Bussieck,
I guessed so. Thank you very much for your reply.
Regards,
Arman