mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 01:18:52 -06:00
Update UserCutsComponent
This commit is contained in:
@@ -80,9 +80,10 @@ def test_usage(
|
||||
solver: LearningSolver,
|
||||
) -> None:
|
||||
stats_before = solver.solve(stab_instance)
|
||||
sample = stab_instance.training_data[0]
|
||||
assert sample.user_cuts_enforced is not None
|
||||
assert len(sample.user_cuts_enforced) > 0
|
||||
sample = stab_instance.samples[0]
|
||||
assert sample.after_mip is not None
|
||||
assert sample.after_mip.extra is not None
|
||||
assert len(sample.after_mip.extra["user_cuts_enforced"]) > 0
|
||||
print(stats_before)
|
||||
assert stats_before["UserCuts: Added ahead-of-time"] == 0
|
||||
assert stats_before["UserCuts: Added in callback"] > 0
|
||||
|
||||
@@ -67,6 +67,8 @@ def test_subtour() -> None:
|
||||
instance = TravelingSalesmanInstance(n_cities, distances)
|
||||
solver = LearningSolver()
|
||||
solver.solve(instance)
|
||||
assert instance.samples[0].after_mip is not None
|
||||
assert instance.samples[0].after_mip.extra is not None
|
||||
lazy_enforced = instance.samples[0].after_mip.extra["lazy_enforced"]
|
||||
assert lazy_enforced is not None
|
||||
assert len(lazy_enforced) > 0
|
||||
|
||||
Reference in New Issue
Block a user