Skip to content

Commit

Permalink
Merge branch 'master' into optimize_twice
Browse files Browse the repository at this point in the history
  • Loading branch information
guimarqu authored Mar 9, 2021
2 parents 3472029 + 8d13bfd commit 4de9806
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/MOIwrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function MOI.set(model::Optimizer, param::MOI.RawParameter, val)
if param.name == "params"
model.params = val
elseif param.name == "default_optimizer"
optimizer_builder = () -> MoiOptimizer(val())
optimizer_builder = () -> MoiOptimizer(MOI._instantiate_and_check(val))
model.default_optimizer_builder = optimizer_builder
set_default_optimizer_builder!(model.inner, optimizer_builder)
else
Expand Down
30 changes: 30 additions & 0 deletions test/optimizer_with_attributes_test.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function optimizer_with_attributes_test()
@testset "play gap" begin
data = CLD.GeneralizedAssignment.data("play2.txt")


println(JuMP.optimizer_with_attributes(GLPK.Optimizer))
println(GLPK.Optimizer)
coluna = JuMP.optimizer_with_attributes(
Coluna.Optimizer,
"params" => CL.Params(solver = ClA.TreeSearchAlgorithm(
branchingtreefile = "playgap.dot"
)),
"default_optimizer" => JuMP.optimizer_with_attributes(GLPK.Optimizer, "tm_lim" => 60 * 1_100, "msg_lev" => GLPK.GLP_MSG_OFF)
)

println(coluna)
model, x, dec = CLD.GeneralizedAssignment.model(data, coluna)

BD.objectiveprimalbound!(model, 100)
BD.objectivedualbound!(model, 0)

JuMP.optimize!(model)

@test JuMP.objective_value(model) 75.0
@test JuMP.termination_status(model) == MOI.OPTIMAL
@test CLD.GeneralizedAssignment.print_and_check_sol(data, model, x)
@test MOI.get(model, MOI.NumberOfVariables()) == length(x)
@test MOI.get(model, MOI.SolverName()) == "Coluna"
end
end
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include("full_instances_tests.jl")
include("user_algorithms_tests.jl")
include("preprocessing_tests.jl")
include("pricing_callback_tests.jl")
include("optimizer_with_attributes_test.jl")

rng = MersenneTwister(1234123)

Expand Down Expand Up @@ -58,3 +59,7 @@ end
close(rd_out)
redirect_stdout(backup_stdout)
end

@testset "Optimizer with Attributes" begin
optimizer_with_attributes_test()
end

0 comments on commit 4de9806

Please sign in to comment.