Excempt zero from a free variable type Topic is solved

Problems with modeling
Post Reply
arman.nedjati
User
User
Posts: 4
Joined: 5 years ago

Excempt zero from a free variable type

Post 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
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Excempt zero from a free variable type

Post 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
arman.nedjati
User
User
Posts: 4
Joined: 5 years ago

Re: Excempt zero from a free variable type

Post by arman.nedjati »

Dear Bussieck,

I guessed so. Thank you very much for your reply.

Regards,
Arman
Post Reply