JuliaGraphs / LightGraphsFlows.jl

Flow algorithms on LightGraphs
Other
36 stars 11 forks source link

Unable to run mincost_flow in latest version #44

Open alichtl opened 3 years ago

alichtl commented 3 years ago

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:

simonschoelly commented 3 years ago

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 commented 3 years ago

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/

matbesancon commented 3 years ago

perfect, should this be closed @adamlichtl ?

alichtl commented 3 years ago

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

matbesancon commented 3 years ago

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

simonschoelly commented 3 years ago

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.

matbesancon commented 3 years ago

We can just delete latest?

simonschoelly commented 3 years ago

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