Skip to main content

Taking remainders in gurobi

Answered

Comments

4 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff

    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.

  • Shesha Sreenivasamurthy
    • Gurobi-versary
    • Curious
    • Conversationalist

    I think I found the answer, I set upper bound for b to be 31. Let me know if this not the right way.

    0
  • Matthias Miltenberger
    • Gurobi Staff

    Hi Shesha,

    a=9 and b=32 is a perfectly valid solution to the problem. To enforce that Gurobi selects a solution that minimizes the remainder b, you need to specify exactly that and add b to your objective function.

    Setting the upper bound of the remainder to be n-1 for n being the modulo value, is also a good idea nonetheless.

    I hope that helps.

    Cheers,
    Matthias

    0
  • Shesha Sreenivasamurthy
    • Gurobi-versary
    • Curious
    • Conversationalist

    Thank you !

    0

Post is closed for comments.