Solver: Make attributes private; ensure we're not calling them directly

Helps with Julia/JuMP integration.
This commit is contained in:
2024-02-02 10:15:06 -06:00
parent 33f2cb3d9e
commit 60d9a68485
6 changed files with 66 additions and 59 deletions

View File

@@ -24,10 +24,8 @@ class MemorizingLazyComponent(_BaseMemorizingConstrComponent):
model: AbstractModel,
stats: Dict[str, Any],
) -> None:
if model.lazy_enforce is None:
return
assert self.constrs_ is not None
violations = self.predict("Predicting violated lazy constraints...", test_h5)
logger.info(f"Enforcing {len(violations)} constraints ahead-of-time...")
model.lazy_enforce(model, violations)
model.lazy_enforce(violations)
stats["Lazy Constraints: AOT"] = len(violations)