mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Fix some _compute_gap corner cases; add tests
This commit is contained in:
@@ -35,3 +35,13 @@ def test_benchmark():
|
||||
benchmark = BenchmarkRunner(test_solvers)
|
||||
benchmark.load_results("/tmp/benchmark.csv")
|
||||
assert benchmark.raw_results().values.shape == (12, 14)
|
||||
|
||||
|
||||
def test_gap():
|
||||
assert BenchmarkRunner._compute_gap(ub=0.0, lb=0.0) == 0.0
|
||||
assert BenchmarkRunner._compute_gap(ub=1.0, lb=0.5) == 0.5
|
||||
assert BenchmarkRunner._compute_gap(ub=1.0, lb=1.0) == 0.0
|
||||
assert BenchmarkRunner._compute_gap(ub=1.0, lb=-1.0) == 1.0
|
||||
assert BenchmarkRunner._compute_gap(ub=1.0, lb=None) == 1.0
|
||||
assert BenchmarkRunner._compute_gap(ub=None, lb=1.0) == 1.0
|
||||
assert BenchmarkRunner._compute_gap(ub=None, lb=None) == 1.0
|
||||
|
||||
Reference in New Issue
Block a user