LightGraphsFlows.jl
LightGraphsFlows.jl copied to clipboard
Add handling of optimizer kwargs to mincost_flow
In mincost_flow
function, when trying to pass args to the optimizer via a closure, I hit a JuMP deprecation warning.
With the example from the documentation:
julia> flow = mincost_flow(g, demand, capacity, cost, () -> Clp.Optimizer(LogLevel=0))
┌ Warning: Passing optimizer attributes as keyword arguments to
│ Clp.Optimizer is deprecated. Use
│ MOI.set(model, MOI.RawParameter("key"), value)
│ or
│ JuMP.set_optimizer_attribute(model, "key", value)
│ instead.
└ @ Clp ~/.julia/packages/Clp/nnuI6/src/MOI_wrapper/MOI_wrapper.jl:42
6×6 SparseArrays.SparseMatrixCSC{Float64, Int64} with 6 stored entries:
⋅ ⋅ ⋅ 1.0 ⋅ ⋅
⋅ ⋅ 1.0 ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅ ⋅ 1.0
⋅ ⋅ ⋅ ⋅ ⋅ 1.0
1.0 1.0 ⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅ ⋅ ⋅
Adding optimizer_kwargs...
in the function arguments, and using JuMP.set_optimizer_attribute
to pass them to the model, we avoid the deprecation.
I have not tested with any other optimizer than Clp