Skip to main content

Taking remainders in gurobi

Answered

Comments

3 comments

  • Shesha Sreenivasamurthy
    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 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
    Curious
    Conversationalist

    Thank you !

    0

Please sign in to leave a comment.