InternalSolver: set_constraint_sense, set_constraint_rhs

This commit is contained in:
2020-12-05 21:09:35 -06:00
parent 8bb9996384
commit 5b5f4b7671
4 changed files with 36 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ def test_internal_solver():
assert stats["Lower bound"] == 1030.0
if isinstance(solver, GurobiSolver):
# Extract new constraint
# Extract the new constraint
cobj = solver.extract_constraint("cut")
# New constraint should no longer affect solution and should no longer
@@ -145,6 +145,13 @@ def test_internal_solver():
# New constraint should now be satisfied
assert solver.is_constraint_satisfied(cobj)
# Relax problem and make cut into an equality constraint
solver.relax()
solver.set_constraint_rhs("cut", 0.5)
solver.set_constraint_sense("cut", "=")
stats = solver.solve()
assert round(stats["Lower bound"]) == 1179.0
def test_iteration_cb():
for solver_class in _get_internal_solvers():