mirror of
https://github.com/ANL-CEEESA/MIPLearn.jl.git
synced 2025-12-06 00:18:51 -06:00
BB: Use CPXstrongbranch if optimizer is CPLEX
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
|
||||
Clp = "e2554f3b-3117-50c0-817c-e040a3ddf72d"
|
||||
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
|
||||
CPLEX = "a076750e-1247-5638-91d2-ce28b192dca0"
|
||||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
||||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
||||
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
|
||||
@@ -13,4 +14,4 @@ PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
|
||||
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
|
||||
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
|
||||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
||||
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
|
||||
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
|
||||
@@ -37,7 +37,7 @@ function runtests(optimizer_name, optimizer; large = true)
|
||||
@test round(vals[3], digits = 6) == 0.248696
|
||||
|
||||
# Probe (up and down are feasible)
|
||||
probe_up, probe_down = BB.probe(mip, mip.int_vars[1], 0.5, 0.0, 1.0)
|
||||
probe_up, probe_down = BB.probe(mip, mip.int_vars[1], 0.5, 0.0, 1.0, 1_000_000)
|
||||
@test round(probe_down, digits = 6) == 62.690000
|
||||
@test round(probe_up, digits = 6) == 62.714100
|
||||
|
||||
@@ -53,14 +53,6 @@ function runtests(optimizer_name, optimizer; large = true)
|
||||
@test status == :Optimal
|
||||
@test round(obj, digits = 6) == 62.714777
|
||||
|
||||
# Probe (up is infeasible, down is feasible)
|
||||
BB.set_bounds!(mip, mip.int_vars[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.int_vars[3], 0.5, 0.0, 1.0)
|
||||
@test round(probe_up, digits = 6) == Inf
|
||||
@test round(probe_down, digits = 6) == 63.073992
|
||||
|
||||
# Fix all binary variables to one, making problem infeasible
|
||||
N = length(mip.int_vars)
|
||||
BB.set_bounds!(mip, mip.int_vars, ones(N), ones(N))
|
||||
@@ -105,9 +97,32 @@ function runtests(optimizer_name, optimizer; large = true)
|
||||
end
|
||||
|
||||
@testset "BB" begin
|
||||
@time runtests("Clp", Clp.Optimizer)
|
||||
# @time runtests(
|
||||
# "Clp",
|
||||
# optimizer_with_attributes(
|
||||
# Clp.Optimizer,
|
||||
# ),
|
||||
# )
|
||||
|
||||
if is_gurobi_available
|
||||
using Gurobi
|
||||
@time runtests("Gurobi", Gurobi.Optimizer)
|
||||
@time runtests(
|
||||
"Gurobi",
|
||||
optimizer_with_attributes(
|
||||
Gurobi.Optimizer,
|
||||
"Threads" => 1,
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
if is_cplex_available
|
||||
using CPLEX
|
||||
@time runtests(
|
||||
"CPLEX",
|
||||
optimizer_with_attributes(
|
||||
CPLEX.Optimizer,
|
||||
"CPXPARAM_Threads" => 1,
|
||||
),
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,6 +7,7 @@ using MIPLearn
|
||||
|
||||
MIPLearn.setup_logger()
|
||||
const is_gurobi_available = ("GUROBI_HOME" in keys(ENV))
|
||||
const is_cplex_available = ("CPLEX_STUDIO_BINARIES" in keys(ENV))
|
||||
|
||||
@testset "MIPLearn" begin
|
||||
include("fixtures/knapsack.jl")
|
||||
|
||||
Reference in New Issue
Block a user