Skip to main content

Fractions

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    This post is more than three 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 why not try our AI Gurobot?.
  • Tobias Achterberg
    Gurobi Staff Gurobi Staff

    For fractions you can of course just multiply the whole constraint by the smallest common multiplier of your denominators. So, instead of writing 1/3x + 2y <= 7 you would write x + 6y <= 21. For roots or other irrational numbers, there is no better way than using floating points.

    In any case, you should always use double precision in your calculations to get the floating point values, and you should not truncate digits. So, please don't write 1.414214x + y <= 5, but instead write 1.414213562373095x + y <= 5.

    Regards,

    Tobias

     

    1

Post is closed for comments.