Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move demos in ColunaDemos.jl #76

Merged
merged 11 commits into from
May 20, 2019
Merged
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
julia: 1.0
os: linux
script:
- julia --project=docs/ -e 'using Pkg; Pkg.clone("https://github.com/atoptima/BlockDecomposition.jl"); Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- julia --project=docs/ -e 'using Pkg; Pkg.clone("https://github.com/atoptima/BlockDecomposition.jl.git"); Pkg.clone("https://github.com/atoptima/ColunaDemos.jl.git"); Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- julia --project=docs/ docs/make.jl
after_success: skip

12 changes: 10 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ version = "0.5.4"

[[BlockDecomposition]]
deps = ["DataStructures", "JuMP", "MathOptInterface", "Test"]
git-tree-sha1 = "dc1188fa95bee1a46dd755c04cf9d6a62d80d834"
git-tree-sha1 = "c1b57e5ed4b891b2fe3326dba7f558b2e4893654"
repo-rev = "master"
repo-url = "https://github.com/atoptima/BlockDecomposition.jl.git"
uuid = "6cde8614-403a-11e9-12f1-c10d0f0caca0"
Expand All @@ -35,6 +35,14 @@ git-tree-sha1 = "f60954495a7afcee4136f78d1d60350abd37a409"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.4.1"

[[ColunaDemos]]
deps = ["BlockDecomposition", "JuMP"]
git-tree-sha1 = "b02cb739035104eedf969a91a4f8a63ce07e94eb"
repo-rev = "master"
repo-url = "https://github.com/atoptima/ColunaDemos.jl.git"
uuid = "a54e61d4-7723-11e9-2469-af255fcaa246"
version = "0.1.0"

[[CommonSubexpressions]]
deps = ["Test"]
git-tree-sha1 = "efdaf19ab11c7889334ca247ff4c9f7c322817b0"
Expand Down Expand Up @@ -123,7 +131,7 @@ git-tree-sha1 = "67a054b8aa451198dcaeff279614125833d4a3e4"
repo-rev = "7c115a2dcc8d92bdb6422dc4ed0919b7842e30fb"
repo-url = "https://github.com/JuliaOpt/JuMP.jl.git"
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
version = "0.19.0+"
version = "0.19.1+"

[[LibGit2]]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.1.0"
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
BlockDecomposition = "6cde8614-403a-11e9-12f1-c10d0f0caca0"
ColunaDemos = "a54e61d4-7723-11e9-2469-af255fcaa246"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Expand Down
58 changes: 31 additions & 27 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
import Coluna

using Test
using Test, GLPK, ColunaDemos, JuMP

using GLPK
import MathOptInterface, MathOptInterface.Utilities

using Base.CoreLogging, Logging
global_logger(ConsoleLogger(stderr, LogLevel(1)))

global const MOIU = MathOptInterface.Utilities
global const MOI = MathOptInterface
global const CL = Coluna
global const CLD = ColunaDemos

include("unit/unit_tests.jl")

using Base.CoreLogging, Logging
global_logger(ConsoleLogger(stderr, LogLevel(1)))

unit_tests()

include("../examples/GeneralizedAssignment_SimpleColGen/run_sgap.jl")
include("models/gap.jl")
data_gap = read_dataGap("../examples/GeneralizedAssignment_SimpleColGen/data/smallgap3.txt")

@testset "gap - JuMP/MOI modeling" begin
problem, x = model_sgap(data_gap)
println("\e[1;42m Classic GAP \e[00m")
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)
#@show JuMP.objective_value(problem)
end

@testset "gap with penalties - pure master variables" begin
# JuMP.objective_value(problem) = 416.4
problem = gap_with_penalties(data_gap)
println("\e[1;42m GAP with penalties \e[00m")
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)
#@show JuMP.objective_value(problem)
#@test JuMP.objective_value(problem) == 416.4
end

@testset "gap with maximisation objective function" begin
# JuMP.objective_value(problem) = 416.4
problem = maximization_gap(data_gap)
println("\e[1;42m GAP maximization objective function \e[00m")
JuMP.optimize!(problem)
#@show JuMP.objective_value(problem)
end
data = CLD.GeneralizedAssignment.data("smallgap3.txt")

# model, x = sgap_5_100()
# JuMP.optimize!(model)
coluna = JuMP.with_optimizer(Coluna.Optimizer,# #params = params,
master_factory = with_optimizer(GLPK.Optimizer),
pricing_factory = with_optimizer(GLPK.Optimizer)
)

#include("../examples/CuttingStock_SubprobMultiplicity/run_csp.jl")
#run_csp_10_10()
#run_csp_10_20()
#end
problem, x, dec = CLD.GeneralizedAssignment.model_max(data, coluna)
JuMP.optimize!(problem)
#@test JuMP.objective_value(problem) == 416.4 ?
end