Interface MinimumCostFlow
-
public interface MinimumCostFlowCompute the minimum-cost (max) flow in a flow network.There are a few variations of the minimum-cost flow problem: (1) given source(s) and sink(s) terminal nodes, and the objecting is to find the flow with the lowest cost out of all maximum flows. (2) given per-vertex finite supply, and the objective is to find a minimum-cost flow satisfying the supply, namely that for each vertex the sum of flow units going out of the vertex minus the sum of flow units going into it is equal to its supply.
In addition to these variants, a lower bound for each edge flow can be specified, similar to the capacities which can be viewed as upper bounds.
- Author:
- Barak Ugav
- See Also:
MaximumFlow,FlowNetwork, Wikipedia
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceMinimumCostFlow.BuilderA builder forMinimumCostFlowobjects.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcomputeMinCostFlow(Graph g, FlowNetwork net, WeightFunction cost, WeightFunction supply)Compute the min-cost (not maximum!) flow in a network given a supply for each vertex.voidcomputeMinCostFlow(Graph g, FlowNetwork net, WeightFunction cost, WeightFunction lowerBound, WeightFunction supply)Compute the min-cost (not maximum!) flow in a network given a supply for each vertex and a lower bound for the edges flows.voidcomputeMinCostMaxFlow(Graph g, FlowNetwork net, WeightFunction cost, int source, int sink)Compute the min-cost max-flow in a network between a source and a sink.voidcomputeMinCostMaxFlow(Graph g, FlowNetwork net, WeightFunction cost, WeightFunction lowerBound, int source, int sink)Compute the min-cost max-flow in a network between a source and a sink given a lower bound for the edges flows.voidcomputeMinCostMaxFlow(Graph g, FlowNetwork net, WeightFunction cost, WeightFunction lowerBound, IntCollection sources, IntCollection sinks)Compute the min-cost max-flow in a network between a set of sources and a set of sinks given a lower bound for the edges flows.voidcomputeMinCostMaxFlow(Graph g, FlowNetwork net, WeightFunction cost, IntCollection sources, IntCollection sinks)Compute the min-cost max-flow in a network between a set of sources and a set of sinks.static MinimumCostFlow.BuildernewBuilder()Create a new minimum cost flow algorithm builder.
-
-
-
Method Detail
-
computeMinCostMaxFlow
void computeMinCostMaxFlow(Graph g, FlowNetwork net, WeightFunction cost, int source, int sink)
Compute the min-cost max-flow in a network between a source and a sink.- Parameters:
g- the graphnet- the flow network. The result flow values will be set using this networkcost- an edge weight function representing the cost of each unit of flow along the edgesource- a source vertexsink- a sink vertex
-
computeMinCostMaxFlow
void computeMinCostMaxFlow(Graph g, FlowNetwork net, WeightFunction cost, WeightFunction lowerBound, int source, int sink)
Compute the min-cost max-flow in a network between a source and a sink given a lower bound for the edges flows.- Parameters:
g- the graphnet- the flow network. The result flow values will be set using this networkcost- an edge weight function representing the cost of each unit of flow along the edgelowerBound- an edge weight function representing a lower bound for the flow along each edgesource- a source vertexsink- a sink vertex
-
computeMinCostMaxFlow
void computeMinCostMaxFlow(Graph g, FlowNetwork net, WeightFunction cost, IntCollection sources, IntCollection sinks)
Compute the min-cost max-flow in a network between a set of sources and a set of sinks.- Parameters:
g- the graphnet- the flow network. The result flow values will be set using this networkcost- an edge weight function representing the cost of each unit of flow along the edgesources- a set of source verticessinks- a set of sinks vertices
-
computeMinCostMaxFlow
void computeMinCostMaxFlow(Graph g, FlowNetwork net, WeightFunction cost, WeightFunction lowerBound, IntCollection sources, IntCollection sinks)
Compute the min-cost max-flow in a network between a set of sources and a set of sinks given a lower bound for the edges flows.- Parameters:
g- the graphnet- the flow network. The result flow values will be set using this networkcost- an edge weight function representing the cost of each unit of flow along the edgelowerBound- an edge weight function representing a lower bound for the flow along each edgesources- a set of source verticessinks- a set of sinks vertices
-
computeMinCostFlow
void computeMinCostFlow(Graph g, FlowNetwork net, WeightFunction cost, WeightFunction supply)
Compute the min-cost (not maximum!) flow in a network given a supply for each vertex.The supply is a scalar for each vertex, and the objective is to find a minimum-cost flow satisfying the supply, namely that for each vertex the sum of flow units going out of the vertex minus the sum of flow units going into it is equal to its supply.
- Parameters:
g- the graphnet- the flow network. The result flow values will be set using this networkcost- an edge weight function representing the cost of each unit of flow along the edgesupply- a vertex weight function representing the supply for each vertex
-
computeMinCostFlow
void computeMinCostFlow(Graph g, FlowNetwork net, WeightFunction cost, WeightFunction lowerBound, WeightFunction supply)
Compute the min-cost (not maximum!) flow in a network given a supply for each vertex and a lower bound for the edges flows.The supply is a scalar for each vertex, and the objective is to find a minimum-cost flow satisfying the supply, namely that for each vertex the sum of flow units going out of the vertex minus the sum of flow units going into it is equal to its supply.
- Parameters:
g- the graphnet- the flow network. The result flow values will be set using this networkcost- an edge weight function representing the cost of each unit of flow along the edgelowerBound- an edge weight function representing a lower bound for the flow along each edgesupply- a vertex weight function representing the supply for each vertex
-
newBuilder
static MinimumCostFlow.Builder newBuilder()
Create a new minimum cost flow algorithm builder.This is the recommended way to instantiate a new
MinimumCostFlowobject.- Returns:
- a new builder that can build
MinimumCostFlowobjects
-
-