Minimum Cost Flow Problem

Definition (GEQ form)

The minimum cost flow problem is to find a feasible flow of minimum total cost from a set of supply nodes to a set of demand nodes in a network with capacity constraints (lower and upper bounds) and arc costs.

Formally, let $G=(V,A)$ be a digraph, $lower: A\rightarrow\mathbf{R}$, $upper: A\rightarrow\mathbf{R}\cup\{+\infty\}$ denote the lower and upper bounds for the flow values on the arcs, for which $lower(uv) \leq upper(uv)$ must hold for all $uv\in A$, $cost: A\rightarrow\mathbf{R}$ denotes the cost per unit flow on the arcs and $sup: V\rightarrow\mathbf{R}$ denotes the signed supply values of the nodes. If $sup(u)>0$, then $u$ is a supply node with $sup(u)$ supply, if $sup(u)<0$, then $u$ is a demand node with $-sup(u)$ demand. A minimum cost flow is an $f: A\rightarrow\mathbf{R}$ solution of the following optimization problem.

\[ \min\sum_{uv\in A} f(uv) \cdot cost(uv) \]

\[ \sum_{uv\in A} f(uv) - \sum_{vu\in A} f(vu) \geq sup(u) \quad \forall u\in V \]

\[ lower(uv) \leq f(uv) \leq upper(uv) \quad \forall uv\in A \]

The sum of the supply values, i.e. $\sum_{u\in V} sup(u)$ must be zero or negative in order to have a feasible solution (since the sum of the expressions on the left-hand side of the inequalities is zero). It means that the total demand must be greater or equal to the total supply and all the supplies have to be carried out from the supply nodes, but there could be demands that are not satisfied. If $\sum_{u\in V} sup(u)$ is zero, then all the supply/demand constraints have to be satisfied with equality, i.e. all demands have to be satisfied and all supplies have to be used.

Algorithms

LEMON contains several algorithms for solving this problem, for more information see Minimum Cost Flow Algorithms.

A feasible solution for this problem can be found using Circulation.

Dual Solution

The dual solution of the minimum cost flow problem is represented by node potentials $\pi: V\rightarrow\mathbf{R}$. An $f: A\rightarrow\mathbf{R}$ primal feasible solution is optimal if and only if for some $\pi: V\rightarrow\mathbf{R}$ node potentials the following complementary slackness optimality conditions hold.

Here $cost^\pi(uv)$ denotes the reduced cost of the arc $uv\in A$ with respect to the potential function $\pi$, i.e.

\[ cost^\pi(uv) = cost(uv) + \pi(u) - \pi(v).\]

All algorithms provide dual solution (node potentials), as well, if an optimal flow is found.

Equality Form

The above definition is actually more general than the usual formulation of the minimum cost flow problem, in which strict equalities are required in the supply/demand contraints.

\[ \min\sum_{uv\in A} f(uv) \cdot cost(uv) \]

\[ \sum_{uv\in A} f(uv) - \sum_{vu\in A} f(vu) = sup(u) \quad \forall u\in V \]

\[ lower(uv) \leq f(uv) \leq upper(uv) \quad \forall uv\in A \]

However if the sum of the supply values is zero, then these two problems are equivalent. The algorithms in LEMON support the general form, so if you need the equality form, you have to ensure this additional contraint manually.

Opposite Inequalites (LEQ Form)

Another possible definition of the minimum cost flow problem is when there are "less or equal" (LEQ) supply/demand constraints, instead of the "greater or equal" (GEQ) constraints.

\[ \min\sum_{uv\in A} f(uv) \cdot cost(uv) \]

\[ \sum_{uv\in A} f(uv) - \sum_{vu\in A} f(vu) \leq sup(u) \quad \forall u\in V \]

\[ lower(uv) \leq f(uv) \leq upper(uv) \quad \forall uv\in A \]

It means that the total demand must be less or equal to the total supply (i.e. $\sum_{u\in V} sup(u)$ must be zero or positive) and all the demands have to be satisfied, but there could be supplies that are not carried out from the supply nodes. The equality form is also a special case of this form, of course.

You could easily transform this case to the GEQ form of the problem by reversing the direction of the arcs and taking the negative of the supply values (e.g. using ReverseDigraph and NegMap adaptors). However NetworkSimplex algorithm also supports this form directly for the sake of convenience.

Note that the optimality conditions for this supply constraint type are slightly differ from the conditions that are discussed for the GEQ form, namely the potentials have to be non-negative instead of non-positive. An $f: A\rightarrow\mathbf{R}$ feasible solution of this problem is optimal if and only if for some $\pi: V\rightarrow\mathbf{R}$ node potentials the following conditions hold.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines