Taking remainders in gurobi
回答済みHi, I was interested in taking remainder in Gurobi and I referenced the following post.
However, I am facing an issue.
I want to perform T % 32. Say T is 320 and I expect the remainder to be 0. To formulate this, I have 320 = 32 * a + b. Gurobi gave result a = 9, b = 32. How to ensure that 'b' gets the minimum value. So, 'a' should be 10 and 'b' is zero.
-
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 -
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,
Matthias0 -
Thank you !
0
サインインしてコメントを残してください。
コメント
3件のコメント