Make solvers silent by default

gh-actions
Alinson S. Xavier 5 years ago
parent c5f1750213
commit 14714c382b

@ -193,7 +193,9 @@ function create_process_node_constraints!(model::ManufacturingModel)
end end
end end
function solve(filename::String; milp_optimizer=Cbc.Optimizer, lp_optimizer=Clp.Optimizer) function solve(filename::String;
milp_optimizer=optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0),
lp_optimizer=optimizer_with_attributes(Clp.Optimizer, "LogLevel" => 0))
println("Reading $filename...") println("Reading $filename...")
instance = RELOG.load(filename) instance = RELOG.load(filename)

@ -9,6 +9,7 @@ using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats
instance = RELOG.load("$basedir/../instances/s1.json") instance = RELOG.load("$basedir/../instances/s1.json")
graph = RELOG.build_graph(instance) graph = RELOG.build_graph(instance)
model = RELOG.build_model(instance, graph, Cbc.Optimizer) model = RELOG.build_model(instance, graph, Cbc.Optimizer)
set_optimizer_attribute(model.mip, "logLevel", 0)
process_node_by_location_name = Dict(n.location.location_name => n process_node_by_location_name = Dict(n.location.location_name => n
for n in graph.process_nodes) for n in graph.process_nodes)
@ -16,7 +17,6 @@ using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats
shipping_node_by_location_and_product_names = Dict((n.location.location_name, n.product.name) => n shipping_node_by_location_and_product_names = Dict((n.location.location_name, n.product.name) => n
for n in graph.plant_shipping_nodes) for n in graph.plant_shipping_nodes)
@test length(model.vars.flow) == 76 @test length(model.vars.flow) == 76
@test length(model.vars.dispose) == 16 @test length(model.vars.dispose) == 16
@test length(model.vars.open_plant) == 12 @test length(model.vars.open_plant) == 12
@ -43,7 +43,7 @@ using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats
@testset "solve" begin @testset "solve" begin
solution = RELOG.solve("$(pwd())/../instances/s1.json") solution = RELOG.solve("$(pwd())/../instances/s1.json")
JSON.print(stdout, solution, 4) #JSON.print(stdout, solution, 4)
@test "Costs" in keys(solution) @test "Costs" in keys(solution)
@test "Fixed operating (\$)" in keys(solution["Costs"]) @test "Fixed operating (\$)" in keys(solution["Costs"])

Loading…
Cancel
Save