Why binary variables range from (0,1)
回答済みHi,
I set the variables as binary. But while adding lazy constraints, some values of variables range from (0,1). Please suggest.
var = m.addVars(dist.keys(), vtype=GRB.BINARY, name='e')
0
-
正式なコメント
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -

Some pictures are missing.
0 -
Hi Chenshi,
I assume you might be referring to some of these 0.9999999 numbers. Indeed there are some "rounding errors" that may cause this behaviour (usually quite small, less than 1e-5).
When checking whether a binary value is 0 or 1, you should consider a possible error, doing something like:
if binary_value > 0.5:
#assume binary is 1
else:
#assume binary is 01 -
Thank you!
0 -
Note we have a parameter, IntegralityFocus, that can help with this but it incurs a (typically small) cost in performance.
0
投稿コメントは受け付けていません。

コメント
5件のコメント