Use UpperBoundRef and LowerBoundRef; relax int vars

This commit is contained in:
2021-09-15 09:55:30 -05:00
parent be0cd98e9d
commit acaa8c3bee
6 changed files with 40 additions and 44 deletions

View File

@@ -51,12 +51,7 @@ function runtests(optimizer_name, optimizer; large = true)
@test round(obj, digits = 6) == 62.714777
# Probe (up is infeasible, down is feasible)
BB.set_bounds!(
mip,
mip.binary_variables[1:3],
[1.0, 1.0, 0.0],
[1.0, 1.0, 1.0],
)
BB.set_bounds!(mip, mip.binary_variables[1:3], [1.0, 1.0, 0.0], [1.0, 1.0, 1.0])
status, obj = BB.solve_relaxation!(mip)
@test status == :Optimal
probe_up, probe_down = BB.probe(mip, mip.binary_variables[3])

View File

@@ -7,14 +7,25 @@ using MIPLearn
using Cbc
@testset "FileInstance" begin
@testset "Solve" begin
@testset "Solve (knapsack)" begin
data = KnapsackData()
filename = tempname()
MIPLearn.save_data(filename, data)
instance = FileInstance(filename, build_knapsack_model)
solver = LearningSolver(Cbc.Optimizer)
solve!(solver, instance)
h5 = Hdf5Sample("$filename.h5")
@test h5.get_scalar("mip_wallclock_time") > 0
end
@testset "Solve (vpm2)" begin
data = Dict("filename" => joinpath(@__DIR__, "../fixtures/danoint.mps.gz"))
build_model(data) = read_from_file(data["filename"])
filename = tempname()
MIPLearn.save_data(filename, data)
instance = FileInstance(filename, build_model)
solver = LearningSolver(optimizer_with_attributes(Cbc.Optimizer, "seconds" => 1.0))
solve!(solver, instance)
h5 = Hdf5Sample("$filename.h5")
@test h5.get_scalar("mip_wallclock_time") > 0
end