Remove sample.{get,set}

This commit is contained in:
2021-07-27 09:00:04 -05:00
parent ef9c48d79a
commit 4224586d10
15 changed files with 184 additions and 211 deletions

View File

@@ -81,7 +81,7 @@ def test_usage(
) -> None:
stats_before = solver.solve(stab_instance)
sample = stab_instance.get_samples()[0]
user_cuts_enforced = sample.get("user_cuts_enforced")
user_cuts_enforced = sample.get_set("user_cuts_enforced")
assert user_cuts_enforced is not None
assert len(user_cuts_enforced) > 0
assert stats_before["UserCuts: Added ahead-of-time"] == 0

View File

@@ -93,7 +93,7 @@ def test_usage_with_solver(instance: Instance) -> None:
stats: LearningSolveStats = {}
sample = instance.get_samples()[0]
assert sample.get("lazy_enforced") is not None
assert sample.get_set("lazy_enforced") is not None
# LearningSolver calls before_solve_mip
component.before_solve_mip(
@@ -142,7 +142,7 @@ def test_usage_with_solver(instance: Instance) -> None:
)
# Should update training sample
assert sample.get("lazy_enforced") == {"c1", "c2", "c3", "c4"}
assert sample.get_set("lazy_enforced") == {"c1", "c2", "c3", "c4"}
#
# Should update stats
assert stats["LazyStatic: Removed"] == 1