mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
ConvertTight: Detect and fix sub-optimality
This commit is contained in:
@@ -71,4 +71,27 @@ def test_convert_tight_infeasibility():
|
||||
)
|
||||
instance = TestInstance()
|
||||
solver.solve(instance)
|
||||
assert instance.lower_bound == 5.0
|
||||
assert instance.lower_bound == 5.0
|
||||
|
||||
|
||||
def test_convert_tight_suboptimality():
|
||||
comp = ConvertTightIneqsIntoEqsStep(
|
||||
check_converted=True,
|
||||
)
|
||||
comp.classifiers = {
|
||||
"c1": Mock(spec=Classifier),
|
||||
"c2": Mock(spec=Classifier),
|
||||
"c3": Mock(spec=Classifier),
|
||||
}
|
||||
comp.classifiers["c1"].predict_proba = Mock(return_value=[[0, 1]])
|
||||
comp.classifiers["c2"].predict_proba = Mock(return_value=[[1, 0]])
|
||||
comp.classifiers["c3"].predict_proba = Mock(return_value=[[0, 1]])
|
||||
|
||||
solver = LearningSolver(
|
||||
solver=GurobiSolver(params={}),
|
||||
components=[comp],
|
||||
solve_lp_first=False,
|
||||
)
|
||||
instance = TestInstance()
|
||||
solver.solve(instance)
|
||||
assert instance.lower_bound == 5.0
|
||||
|
||||
Reference in New Issue
Block a user