LightGraphsFlows.jl icon indicating copy to clipboard operation
LightGraphsFlows.jl copied to clipboard

Unable to run mincost_flow in latest version

Open alichtl opened this issue 4 years ago • 8 comments
trafficstars

Attempting to run the example code at https://juliagraphs.org/LightGraphsFlows.jl/latest/mincost.html give the following error:

ClpSolver is no longer supported. If you are using JuMP, upgrade to the latest version and use Clp.Optimizer instead. If you are using MathProgBase (e.g., via lingprog), you will need to upgrade to MathOptInterface (https://github.com/jump-dev/MathOptInterface.jl).

Replacing ClpSolver with Optimizer, then gives this error:

MethodError: no method matching mincost_flow(::SimpleDiGraph{Int64}, ::Array{Float64,2}, ::SparseMatrixCSC{Float64,Int64}, ::Array{Float64,2}, ::Optimizer, ::Int64, ::Int64) Closest candidates are: mincost_flow(::AG, !Matched::AbstractArray{T,1} where T, ::AbstractArray{T,2} where T, ::AbstractArray{T,2} where T, ::Any; kwargs...) where AG<:AbstractGraph at /home//.julia/packages/SimpleTraits/1wYi7/src/SimpleTraits.jl:338 mincost_flow(!Matched::Type{IsDirected{AG}}, !Matched::AG, !Matched::AbstractArray{T,1} where T, ::AbstractArray{T,2} where T, !Matched::AbstractArray{T,2} where T, ::Any; edge_demand, source_nodes, sink_nodes) where AG<:AbstractGraph at /home//.julia/packages/LightGraphsFlows/X92PO/src/mincost.jl:65

Versions:

  • Julia 1.5.3
  • JuMP 0.21.6
  • LightGraphs 1.3.5
  • LightGraphsFlows 0.4.1

alichtl avatar Feb 19 '21 06:02 alichtl

Can Julia code that you are using to call mincost_flow?

From the error it looks like to call the function somehow like this:

mincost_flow(g, node_demand, edge_capacity, edge_cost, optimizer, 1, 2) 

when you should probably call

mincost_flow(g, node_demand, edge_capacity, edge_cost, optimizer; source_nodes=[1], sink_nodes=[2]) 

simonschoelly avatar Feb 19 '21 12:02 simonschoelly

I also saw that the documentation that you are using (and that is linked to in serveral places) is three years old - here are now updated docs for the latest stable version: https://juliagraphs.org/LightGraphsFlows.jl/stable/

simonschoelly avatar Feb 19 '21 15:02 simonschoelly

perfect, should this be closed @adamlichtl ?

matbesancon avatar Feb 19 '21 15:02 matbesancon

This is super helpful- thank you! It's working now, and thanks also for directing me to the stable version of the docs. It's ok to close this, but for the benefit of others, I'd recommend removing (or at least renaming to something other than latest), the stale documentation at https://juliagraphs.org/LightGraphsFlows.jl/latest/, since that is one of the top hits returned when searching online.

image

alichtl avatar Feb 19 '21 16:02 alichtl

this is weird, latest is supposed to be on par with master

matbesancon avatar Feb 19 '21 16:02 matbesancon

The problem was before, the documentation folder was called latest but was never updated. With the new ci scripts, we will have a folder stable and a folder dev. So we still need to update this on juliagraphs.org and remove the lastest folder.

For now I am trying to create a symlink from latest to stable but have not been successful so far.

simonschoelly avatar Feb 19 '21 16:02 simonschoelly

We can just delete latest?

matbesancon avatar Feb 19 '21 17:02 matbesancon

Yes, maybe there is no other option - maybe github cannot deal with symlinks to symlinks or so. We should just update juliagraphs.org then, and juliahub will also contain the incorrect link until we release a new version

simonschoelly avatar Feb 19 '21 17:02 simonschoelly