Make compatible with Cbc

This commit is contained in:
2021-05-26 10:31:41 -05:00
parent 1bb2b48b7d
commit fa7f15b9bd
7 changed files with 659 additions and 25 deletions

View File

@@ -2,24 +2,29 @@
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
using Test
using MIPLearn
using Cbc
using Gurobi
using PyCall
using JuMP
using MIPLearn
using PyCall
using Test
miplearn_tests = pyimport("miplearn.solvers.tests")
traceback = pyimport("traceback")
function _test_solver(optimizer_factory)
MIPLearn.@python_call miplearn_tests.run_internal_solver_tests(
JuMPSolver(optimizer_factory),
)
end
@testset "JuMPSolver" begin
solver = JuMPSolver(Gurobi.Optimizer)
try
miplearn_tests.run_internal_solver_tests(solver)
catch e
if isa(e, PyCall.PyError)
printstyled("Uncaught Python exception:\n", bold=true, color=:red)
traceback.print_exception(e.T, e.val, e.traceback)
@testset "Cbc" begin
_test_solver(Cbc.Optimizer)
end
if "GUROBI_HOME" in keys(ENV)
@testset "Gurobi" begin
_test_solver(Gurobi.Optimizer)
end
rethrow()
end
end