Use compact variable and constraint features

This commit is contained in:
2021-05-14 11:03:09 -05:00
parent 185ed40648
commit e9fbf4a3c7
9 changed files with 370 additions and 149 deletions

View File

@@ -4,6 +4,7 @@
[deps]
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
JSON2 = "2535ab7d-5cd8-5a07-80ac-9b1792aadce3"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"

View File

@@ -4,18 +4,22 @@
using Test
using MIPLearn
using Cbc
using Gurobi
using PyCall
using JuMP
miplearn_tests = pyimport("miplearn.solvers.tests")
traceback = pyimport("traceback")
@testset "JuMPSolver" begin
model = MIPLearn.knapsack_model(
[23., 26., 20., 18.],
[505., 352., 458., 220.],
67.0,
)
instance = JuMPInstance(model)
solver = JuMPSolver(optimizer=Cbc.Optimizer)
miplearn_tests.test_internal_solver(solver, instance, model)
end
solver = JuMPSolver(optimizer=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)
end
rethrow()
end
end

View File

@@ -8,6 +8,6 @@ using MIPLearn
MIPLearn.setup_logger()
@testset "MIPLearn" begin
#include("modeling/jump_solver_test.jl")
include("modeling/learning_solver_test.jl")
end
include("modeling/jump_solver_test.jl")
#include("modeling/learning_solver_test.jl")
end