There might be cases where you need to model a variable var1
as the closest integer to another variable or parameter value
.
Essentially, a constraint like:
var1 = Round(value)
However, using the Round()
function in a constraint is not allowed in a mixed integer program and results in an error message, especially if value
is also a variable.
We can get around this restriction with the help of some auxiliary variables.