Skip to main content

Why binary variables range from (0,1)

Answered

Comments

4 comments

  • Michel Soares
    Thought Leader

    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 0
    1
  • Chenshi Jia
    First Question
    First Comment

    Some pictures are missing.

    0
  • Chenshi Jia
    First Question
    First Comment

    Thank you!

    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    Note we have a parameter, IntegralityFocus, that can help with this but it incurs a (typically small) cost in performance.

    0

Please sign in to leave a comment.