-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f9550c
commit 41f6021
Showing
4 changed files
with
110 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
function full_instances_tests() | ||
@testset "play gap" begin | ||
data = CLD.GeneralizedAssignment.data("play2.txt") | ||
|
||
coluna = JuMP.with_optimizer(Coluna.Optimizer,# #params = params, | ||
master_factory = with_optimizer(GLPK.Optimizer), | ||
pricing_factory = with_optimizer(GLPK.Optimizer)) | ||
|
||
problem, x, dec = CLD.GeneralizedAssignment.model(data, coluna) | ||
|
||
JuMP.optimize!(problem) | ||
@test abs(JuMP.objective_value(problem) - 75.0) <= 0.00001 | ||
@test CLD.GeneralizedAssignment.print_and_check_sol(data, problem, x) | ||
end | ||
|
||
@testset "gap - JuMP/MOI modeling" begin | ||
data = CLD.GeneralizedAssignment.data("smallgap3.txt") | ||
|
||
coluna = JuMP.with_optimizer(Coluna.Optimizer,# #params = params, | ||
master_factory = with_optimizer(GLPK.Optimizer), | ||
pricing_factory = with_optimizer(GLPK.Optimizer)) | ||
|
||
problem, x, dec = CLD.GeneralizedAssignment.model(data, coluna) | ||
|
||
JuMP.optimize!(problem) | ||
@test abs(JuMP.objective_value(problem) - 438.0) <= 0.00001 | ||
@test CLD.GeneralizedAssignment.print_and_check_sol(data, problem, x) | ||
end | ||
|
||
@testset "gap with penalties - pure master variables" begin | ||
data = CLD.GeneralizedAssignment.data("smallgap3.txt") | ||
|
||
coluna = JuMP.with_optimizer(Coluna.Optimizer,# #params = params, | ||
master_factory = with_optimizer(GLPK.Optimizer), | ||
pricing_factory = with_optimizer(GLPK.Optimizer) | ||
) | ||
|
||
problem, x, y, dec = CLD.GeneralizedAssignment.model_with_penalties(data, coluna) | ||
JuMP.optimize!(problem) | ||
@test abs(JuMP.objective_value(problem) - 416.4) <= 0.00001 | ||
end | ||
|
||
@testset "gap with maximisation objective function" begin | ||
data = CLD.GeneralizedAssignment.data("smallgap3.txt") | ||
|
||
coluna = JuMP.with_optimizer(Coluna.Optimizer,# #params = params, | ||
master_factory = with_optimizer(GLPK.Optimizer), | ||
pricing_factory = with_optimizer(GLPK.Optimizer) | ||
) | ||
|
||
problem, x, dec = CLD.GeneralizedAssignment.model_max(data, coluna) | ||
JuMP.optimize!(problem) | ||
@test abs(JuMP.objective_value(problem) - 580.0) <= 0.00001 | ||
end | ||
|
||
# @testset "gap BIG instance" begin | ||
# data = CLD.GeneralizedAssignment.data("gapC-5-100.txt") | ||
|
||
# coluna = JuMP.with_optimizer(Coluna.Optimizer,# #params = params, | ||
# master_factory = with_optimizer(GLPK.Optimizer), | ||
# pricing_factory = with_optimizer(GLPK.Optimizer) | ||
# ) | ||
|
||
# problem, x, dec = CLD.GeneralizedAssignment.model(data, coluna) | ||
# JuMP.optimize!(problem) | ||
# @test abs(JuMP.objective_value(problem) - 1931.0) <= 0.00001 | ||
# @test CLD.GeneralizedAssignment.print_and_check_sol(data, problem, x) | ||
# end | ||
|
||
# To redirect logging output | ||
io = IOBuffer() | ||
global_logger(ConsoleLogger(io, LogLevel(-4))) | ||
|
||
@testset "play gap" begin | ||
data = CLD.GeneralizedAssignment.data("play2.txt") | ||
|
||
coluna = JuMP.with_optimizer(Coluna.Optimizer,# #params = params, | ||
master_factory = with_optimizer(GLPK.Optimizer), | ||
pricing_factory = with_optimizer(GLPK.Optimizer) | ||
) | ||
|
||
problem, x, dec = CLD.GeneralizedAssignment.model(data, coluna) | ||
JuMP.optimize!(problem) | ||
@test abs(JuMP.objective_value(problem) - 75.0) <= 0.00001 | ||
@test CLD.GeneralizedAssignment.print_and_check_sol(data, problem, x) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function show_functions_tests() | ||
data = CLD.GeneralizedAssignment.data("play2.txt") | ||
coluna = JuMP.with_optimizer(Coluna.Optimizer,# #params = params, | ||
master_factory = with_optimizer(GLPK.Optimizer), | ||
pricing_factory = with_optimizer(GLPK.Optimizer)) | ||
problem, x, dec = CLD.GeneralizedAssignment.model(data, coluna) | ||
JuMP.optimize!(problem) | ||
@show fieldnames(typeof(problem.moi_backend)) | ||
@test_nowarn CL._show_optimizer(problem.moi_backend.optimizer.inner.re_formulation.master.moi_optimizer) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters