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 [AMO93].
Formally, let be a digraph,
,
denote the lower and upper bounds for the flow values on the arcs, for which
must hold for all
,
denotes the cost per unit flow on the arcs and
denotes the signed supply values of the nodes. If
, then
is a supply node with
supply, if
, then
is a demand node with
demand. A minimum cost flow is an
solution of the following optimization problem.
The sum of the supply values, i.e. 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
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.
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.
The dual solution of the minimum cost flow problem is represented by node potentials . An
primal feasible solution is optimal if and only if for some
node potentials the following complementary slackness optimality conditions hold.
Here denotes the reduced cost of the arc
with respect to the potential function
, i.e.
All algorithms provide dual solution (node potentials), as well, if an optimal flow is found.
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.
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.
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.
It means that the total demand must be less or equal to the total supply (i.e. 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 feasible solution of this problem is optimal if and only if for some
node potentials the following conditions hold.