mirror of
https://github.com/ANL-CEEESA/MIPLearn.jl.git
synced 2025-12-06 08:28:52 -06:00
Make compatible with Cbc
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user