mirror of
https://github.com/ANL-CEEESA/MIPLearn.jl.git
synced 2025-12-06 08:28:52 -06:00
Replace Gurobi by Clp in most tests
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
using JuMP
|
using JuMP
|
||||||
using MIPLearn
|
using MIPLearn
|
||||||
using Gurobi
|
using Cbc
|
||||||
|
|
||||||
|
|
||||||
@testset "FileInstance" begin
|
@testset "FileInstance" begin
|
||||||
@@ -15,7 +15,7 @@ using Gurobi
|
|||||||
save(filename, instance)
|
save(filename, instance)
|
||||||
|
|
||||||
file_instance = FileInstance(filename)
|
file_instance = FileInstance(filename)
|
||||||
solver = LearningSolver(Gurobi.Optimizer)
|
solver = LearningSolver(Cbc.Optimizer)
|
||||||
solve!(solver, file_instance)
|
solve!(solver, file_instance)
|
||||||
|
|
||||||
loaded = load_instance(filename)
|
loaded = load_instance(filename)
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ using MIPLearn
|
|||||||
MIPLearn.setup_logger()
|
MIPLearn.setup_logger()
|
||||||
|
|
||||||
@testset "MIPLearn" begin
|
@testset "MIPLearn" begin
|
||||||
# include("fixtures/knapsack.jl")
|
include("fixtures/knapsack.jl")
|
||||||
include("solvers/jump_test.jl")
|
include("solvers/jump_test.jl")
|
||||||
# include("solvers/learning_test.jl")
|
include("solvers/learning_test.jl")
|
||||||
# include("instance/file_test.jl")
|
include("instance/file_test.jl")
|
||||||
# include("utils/benchmark_test.jl")
|
include("utils/benchmark_test.jl")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
|
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using Cbc
|
||||||
using JuMP
|
using JuMP
|
||||||
using MIPLearn
|
using MIPLearn
|
||||||
using Gurobi
|
|
||||||
|
|
||||||
@testset "LearningSolver" begin
|
@testset "LearningSolver" begin
|
||||||
@testset "Model with annotations" begin
|
@testset "Model with annotations" begin
|
||||||
model = build_knapsack_model()
|
model = build_knapsack_model()
|
||||||
solver = LearningSolver(Gurobi.Optimizer)
|
solver = LearningSolver(Cbc.Optimizer)
|
||||||
instance = JuMPInstance(model)
|
instance = JuMPInstance(model)
|
||||||
stats = solve!(solver, instance)
|
stats = solve!(solver, instance)
|
||||||
@test stats["mip_lower_bound"] == 11.0
|
@test stats["mip_lower_bound"] == 11.0
|
||||||
@@ -20,14 +20,14 @@ using Gurobi
|
|||||||
|
|
||||||
@testset "Model without annotations" begin
|
@testset "Model without annotations" begin
|
||||||
model = build_knapsack_model()
|
model = build_knapsack_model()
|
||||||
solver = LearningSolver(Gurobi.Optimizer)
|
solver = LearningSolver(Cbc.Optimizer)
|
||||||
instance = JuMPInstance(model)
|
instance = JuMPInstance(model)
|
||||||
stats = solve!(solver, instance)
|
stats = solve!(solver, instance)
|
||||||
@test stats["mip_lower_bound"] == 11.0
|
@test stats["mip_lower_bound"] == 11.0
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "Save and load" begin
|
@testset "Save and load" begin
|
||||||
solver = LearningSolver(Gurobi.Optimizer)
|
solver = LearningSolver(Cbc.Optimizer)
|
||||||
solver.py.components = "Placeholder"
|
solver.py.components = "Placeholder"
|
||||||
filename = tempname()
|
filename = tempname()
|
||||||
save(filename, solver)
|
save(filename, solver)
|
||||||
@@ -38,7 +38,7 @@ using Gurobi
|
|||||||
|
|
||||||
@testset "Discard output" begin
|
@testset "Discard output" begin
|
||||||
instance = build_knapsack_file_instance()
|
instance = build_knapsack_file_instance()
|
||||||
solver = LearningSolver(Gurobi.Optimizer)
|
solver = LearningSolver(Cbc.Optimizer)
|
||||||
solve!(solver, instance, discard_output=true)
|
solve!(solver, instance, discard_output=true)
|
||||||
loaded = load_instance(instance.filename)
|
loaded = load_instance(instance.filename)
|
||||||
@test length(loaded.py.samples) == 0
|
@test length(loaded.py.samples) == 0
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
|
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using Cbc
|
||||||
using CSV
|
using CSV
|
||||||
using DataFrames
|
using DataFrames
|
||||||
using Gurobi
|
|
||||||
|
|
||||||
|
|
||||||
@testset "BenchmarkRunner" begin
|
@testset "BenchmarkRunner" begin
|
||||||
# Initialie instances and generate training data
|
# Initialize instances and generate training data
|
||||||
instances = [
|
instances = [
|
||||||
build_knapsack_file_instance(),
|
build_knapsack_file_instance(),
|
||||||
build_knapsack_file_instance(),
|
build_knapsack_file_instance(),
|
||||||
]
|
]
|
||||||
parallel_solve!(
|
parallel_solve!(
|
||||||
LearningSolver(Gurobi.Optimizer),
|
LearningSolver(Cbc.Optimizer),
|
||||||
instances,
|
instances,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,14 +22,14 @@ using Gurobi
|
|||||||
benchmark = BenchmarkRunner(
|
benchmark = BenchmarkRunner(
|
||||||
solvers=Dict(
|
solvers=Dict(
|
||||||
"baseline" => LearningSolver(
|
"baseline" => LearningSolver(
|
||||||
Gurobi.Optimizer,
|
Cbc.Optimizer,
|
||||||
components=[],
|
components=[],
|
||||||
),
|
),
|
||||||
"ml-exact" => LearningSolver(
|
"ml-exact" => LearningSolver(
|
||||||
Gurobi.Optimizer,
|
Cbc.Optimizer,
|
||||||
),
|
),
|
||||||
"ml-heur" => LearningSolver(
|
"ml-heur" => LearningSolver(
|
||||||
Gurobi.Optimizer,
|
Cbc.Optimizer,
|
||||||
mode="heuristic",
|
mode="heuristic",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user