mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Replace build_lazy_constraint by enforce_lazy_constraint
This commit is contained in:
@@ -426,6 +426,7 @@ class PyomoTestInstanceInfeasible(Instance):
|
||||
|
||||
|
||||
class PyomoTestInstanceRedundancy(Instance):
|
||||
@overrides
|
||||
def to_model(self) -> pe.ConcreteModel:
|
||||
model = pe.ConcreteModel()
|
||||
model.x = pe.Var([0, 1], domain=pe.Binary)
|
||||
@@ -484,6 +485,11 @@ class PyomoTestInstanceKnapsack(Instance):
|
||||
]
|
||||
|
||||
@overrides
|
||||
def build_lazy_constraint(self, model: Any, violation: Hashable) -> Any:
|
||||
def enforce_lazy_constraint(
|
||||
self,
|
||||
solver: InternalSolver,
|
||||
model: Any,
|
||||
violation: Hashable,
|
||||
) -> None:
|
||||
model.cut = pe.Constraint(expr=model.x[0] <= 0.0, name="cut")
|
||||
return model.cut
|
||||
solver.add_constraint(model.cut)
|
||||
|
||||
Reference in New Issue
Block a user