Thanks for your contribution Sebastian !
One comment, for validating the obtained results it is safer to use tolerances, e.g., replace the
assert m.objective_value == value
by something like
assert abs(m.objective_value - value) <= TOL
where TOL is a small (but not too small) constant, like 1e-4
For small (specially pure integer model) the solution may match exactly, but this is not guaranteed as linear programming based solvers are approximate by nature. These tolerances should be considered while checking the variable values also, like x.x.
Thanks for your contribution Sebastian !
One comment, for validating the obtained results it is safer to use tolerances, e.g., replace the assert m.objective_value == value by something like assert abs(m.objective_value - value) <= TOL where TOL is a small (but not too small) constant, like 1e-4 For small (specially pure integer model) the solution may match exactly, but this is not guaranteed as linear programming based solvers are approximate by nature. These tolerances should be considered while checking the variable values also, like x.x.