问题
Is there a package which implements a min cost flow algorithm in R?
The igraph
package seems only to have max flows (via the graph.maxflow()
function), and nothing else here or on rseek.org looks helpful.
回答1:
Perhaps you could return all flows and then sort by value?
Package sna has a flowbet()
function for flow between.
回答2:
I was struggling with this as well and posted a question with a reproducible min-cost-flow problem here. While I did not receive a definite answer from the community, I did post the approach that I ended up implementing. It involved a data.frame
of edges
with a $cost
and a $capacity
property, which I then used to generate appropriate constraints for an lpSolve
optimisation. Check it out, hope it helps!
来源:https://stackoverflow.com/questions/13272612/min-cost-flow-in-r