Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Add handling of optimizer kwargs to mincost_flow #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mathieu17g
Copy link

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

@mathieu17g mathieu17g marked this pull request as ready for review June 25, 2021 14:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant