## Excempt zero from a free variable type Topic is solved

Problems with modeling
arman.nedjati
User
Posts: 4
Joined: 4 months ago

### Excempt zero from a free variable type

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

bussieck
Moderator
Posts: 268
Joined: 2 years ago

### Re: Excempt zero from a free variable type

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

arman.nedjati
User
Posts: 4
Joined: 4 months ago

Dear Bussieck,