mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 01:18:52 -06:00
Cuts: Call set_cuts instead of setting cuts_aot_ directly
This commit is contained in:
@@ -110,5 +110,6 @@ class MemorizingCutsComponent(_BaseMemorizingConstrComponent):
|
|||||||
if model.cuts_enforce is None:
|
if model.cuts_enforce is None:
|
||||||
return
|
return
|
||||||
assert self.constrs_ is not None
|
assert self.constrs_ is not None
|
||||||
model.cuts_aot_ = self.predict("Predicting cutting planes...", test_h5)
|
cuts = self.predict("Predicting cutting planes...", test_h5)
|
||||||
stats["Cuts: AOT"] = len(model.cuts_aot_)
|
model.set_cuts(cuts)
|
||||||
|
stats["Cuts: AOT"] = len(cuts)
|
||||||
|
|||||||
@@ -82,3 +82,6 @@ class AbstractModel(ABC):
|
|||||||
@abstractmethod
|
@abstractmethod
|
||||||
def write(self, filename: str) -> None:
|
def write(self, filename: str) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_cuts(self, cuts: List) -> None:
|
||||||
|
self.cuts_aot_ = cuts
|
||||||
|
|||||||
@@ -50,9 +50,11 @@ def test_mem_component_gp(
|
|||||||
(x_test,) = clf.predict.call_args.args
|
(x_test,) = clf.predict.call_args.args
|
||||||
assert x_test.shape == (1, 50)
|
assert x_test.shape == (1, 50)
|
||||||
|
|
||||||
# Should set cuts_aot_
|
# Should call set_cuts
|
||||||
assert model.cuts_aot_ is not None
|
model.set_cuts.assert_called()
|
||||||
assert len(model.cuts_aot_) == 256
|
(cuts_aot_,) = model.set_cuts.call_args.args
|
||||||
|
assert cuts_aot_ is not None
|
||||||
|
assert len(cuts_aot_) == 256
|
||||||
|
|
||||||
|
|
||||||
def test_usage_stab(
|
def test_usage_stab(
|
||||||
|
|||||||
Reference in New Issue
Block a user