template<typename GR, typename V, typename C>
class lemon::CycleCanceling< GR, V, C >
CycleCanceling implements three different cycle-canceling algorithms for finding a minimum cost flow[amo93networkflows], [klein67primal], [goldberg89cyclecanceling]. The most efficent one is the Cancel-and-Tighten algorithm, thus it is the default method. It runs in strongly polynomial time , but in practice, it is typically orders of magnitude slower than the scaling algorithms and NetworkSimplex. (For more information, see the module page.)
Most of the parameters of the problem (except for the digraph) can be given using separate functions, and the algorithm can be executed using the run() function. If some parameters are not specified, then default values will be used.
Template Parameters
GR
The digraph type the algorithm runs on.
V
The number type used for flow amounts, capacity bounds and supply values in the algorithm. By default, it is int.
C
The number type used for costs and potentials in the algorithm. By default, it is the same as V.
Warning
Both V and C must be signed number types.
All input data (capacities, supply values, and costs) must be integer.
This algorithm does not support negative costs for arcs having infinite upper bound.
Note
For more information about the three available methods, see Method.
Enum type containing the problem type constants that can be returned by the run() function of the algorithm.
Enumerator
INFEASIBLE
The problem has no feasible solution (flow).
OPTIMAL
The problem has optimal solution (i.e. it is feasible and bounded), and the algorithm has found optimal flow and node potentials (primal and dual solutions).
UNBOUNDED
The digraph contains an arc of negative cost and infinite upper bound. It means that the objective function is unbounded on that arc, however, note that it could actually be bounded over the feasible flows, but this algroithm cannot handle these cases.
Enum type containing constants for selecting the used method for the run() function.
CycleCanceling provides three different cycle-canceling methods. By default, Cancel-and-Tighten is used, which is by far the most efficient and the most robust. However, the other methods can be selected using the run() function with the proper parameter.
Enumerator
SIMPLE_CYCLE_CANCELING
A simple cycle-canceling method, which uses the Bellman-Ford algorithm for detecting negative cycles in the residual network. The number of Bellman-Ford iterations is bounded by a successively increased limit.
MINIMUM_MEAN_CYCLE_CANCELING
The "Minimum Mean Cycle-Canceling" algorithm, which is a well-known strongly polynomial method [goldberg89cyclecanceling]. It improves along a minimum mean cycle in each iteration. Its running time complexity is .
CANCEL_AND_TIGHTEN
The "Cancel-and-Tighten" algorithm, which can be viewed as an improved version of the previous method [goldberg89cyclecanceling]. It is faster both in theory and in practice, its running time complexity is .
This function sets the upper bounds (capacities) on the arcs. If it is not used before calling run(), the upper bounds will be set to INF on all arcs (i.e. the flow value will be unbounded from above).
Parameters
map
An arc map storing the upper bounds. Its Value type must be convertible to the Value type of the algorithm.
This function sets the supply values of the nodes. If neither this function nor stSupply() is used before calling run(), the supply of each node will be set to zero.
Parameters
map
A node map storing the supply values. Its Value type must be convertible to the Value type of the algorithm.
This function sets a single source node and a single target node and the required flow value. If neither this function nor supplyMap() is used before calling run(), the supply of each node will be set to zero.
Using this function has the same effect as using supplyMap() with a map in which k is assigned to s, -k is assigned to t and all other nodes have zero supply value.
Parameters
s
The source node.
t
The target node.
k
The required amount of flow from node s to node t (i.e. the supply of s and the demand of t).
Implementation of cycle-canceling algorithms for finding a minimum cost flow.
Definition cycle_canceling.h:84
This function can be called more than once. All the given parameters are kept for the next call, unless resetParams() or reset() is used, thus only the modified parameters have to be set again. If the underlying digraph was also modified after the construction of the class (or the last reset() call), then the reset() function must be called.
Parameters
method
The cycle-canceling method that will be used. For more information, see Method.
Returns
INFEASIBLE if no feasible flow exists, OPTIMAL if the problem has optimal solution (i.e. it is feasible and bounded), and the algorithm has found optimal flow and node potentials (primal and dual solutions), UNBOUNDED if the digraph contains an arc of negative cost and infinite upper bound. It means that the objective function is unbounded on that arc, however, note that it could actually be bounded over the feasible flows, but this algroithm cannot handle these cases.
It is useful for multiple run() calls. Basically, all the given parameters are kept for the next run() call, unless resetParams() or reset() is used. If the underlying digraph was also modified after the construction of the class or the last reset() call, then the reset() function must be used, otherwise resetParams() is sufficient.
It is useful for multiple run() calls. Basically, all the given parameters are kept for the next run() call, unless resetParams() or reset() is used. If the underlying digraph was also modified after the construction of the class or the last reset() call, then the reset() function must be used, otherwise resetParams() is sufficient.
This function copies the potential (dual value) of each node into the given map. The Cost type of the algorithm must be convertible to the Value type of the map.
Constant for infinite upper bounds (capacities). It is std::numeric_limits<Value>::infinity() if available, std::numeric_limits<Value>::max() otherwise.
Generated on Mon Jul 25 2022 18:36:57 for My Project by 1.12.0