Add mip_ prefix to dynamic constraints

This commit is contained in:
2021-08-04 13:38:23 -05:00
parent ca925119b3
commit 067f0f847c
7 changed files with 14 additions and 14 deletions

View File

@@ -24,13 +24,13 @@ def training_instances() -> List[Instance]:
samples_0 = [
MemorySample(
{
"lazy_enforced": {"c1", "c2"},
"mip_constr_lazy_enforced": {"c1", "c2"},
"static_instance_features": [5.0],
},
),
MemorySample(
{
"lazy_enforced": {"c2", "c3"},
"mip_constr_lazy_enforced": {"c2", "c3"},
"static_instance_features": [5.0],
},
),
@@ -55,7 +55,7 @@ def training_instances() -> List[Instance]:
samples_1 = [
MemorySample(
{
"lazy_enforced": {"c3", "c4"},
"mip_constr_lazy_enforced": {"c3", "c4"},
"static_instance_features": [8.0],
},
)

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_set("user_cuts_enforced")
user_cuts_enforced = sample.get_set("mip_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

@@ -34,7 +34,7 @@ def sample() -> Sample:
"static_constr_lazy": [True, True, True, True, False],
"static_constr_names": ["c1", "c2", "c3", "c4", "c5"],
"static_instance_features": [5.0],
"lazy_enforced": {"c1", "c2", "c4"},
"mip_constr_lazy_enforced": {"c1", "c2", "c4"},
"lp_constr_features": [
[1.0, 1.0],
[1.0, 2.0],
@@ -93,7 +93,7 @@ def test_usage_with_solver(instance: Instance) -> None:
stats: LearningSolveStats = {}
sample = instance.get_samples()[0]
assert sample.get_set("lazy_enforced") is not None
assert sample.get_set("mip_constr_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_set("lazy_enforced") == {"c1", "c2", "c3", "c4"}
assert sample.get_set("mip_constr_lazy_enforced") == {"c1", "c2", "c3", "c4"}
#
# Should update stats
assert stats["LazyStatic: Removed"] == 1