800 likes | 997 Views
A FASTER STRONGLY POLYNOMIAL MINIMUM COST FLOW ALGORITHM JAMES B. ORLIN. Aviv Eisenschtat 6/5/2013. Introduction. Developed in 1989 Based on the Edmonds & Karp scaling algorithm Fastest strongly polynomial algorithm for min-cost flow Fairly simple and intuitive
E N D
A FASTER STRONGLY POLYNOMIAL MINIMUM COST FLOW ALGORITHMJAMES B. ORLIN Aviv Eisenschtat 6/5/2013
Introduction • Developed in 1989 • Based on the Edmonds & Karp scaling algorithm • Fastest strongly polynomial algorithm for min-cost flow • Fairly simple and intuitive • Work best for networks with small number of capacitated arcs
Overview • Recap • Min Cost flow • Dual Problem • RHS-Scaling Algorithm • Contractions • Justification • Difficulties • Algorithm Presentation • Network Expension • Capacitated to Uncapacitated reduction • Improvement for the shortest path algorithm
Min Cost Flow • is a directed graph • Cost for every arc • capacitated arc with capacity • – supply (or demand) on node
Dual minimum cost flow - Reminder Prime: Minimize Subject to Dual: Maximize Subject to
RHS-Scaling Outline • Assume uncapacitatednetwork and integral costs and supplies • Maintain a scaling factor which is a power of 2 • Push flow units for node with excess larger then to nodes with excess lower then • Push flow only on shortest path • Continue until there are no nodes to push from or to push to • Decrease by factor 2 and repeat • Stop when the network is balanced ()
Definitions • - nodes with excess at least • - nodes with deficit at least • -Optimal – A pseudo flow x and potentials π are -Optimal if (x, π) satisfies the optimality conditions and either S() = or T() = .
Correctness - Intuition • For , x = 0 and π = 0 the flow is -Optimal • Each iteration we replace with • At the end of every scaling phase we obtain a -Optimal flow • This is achieved by finding at most n shortest paths • When x is balanced and optimal
RHS Scaling - Correctness At every step the flow and residual capacity is an integral multiple of Inductively The algorithm maintains a -Optimal flow x w.r.t • Initially , and it’s clear • Suppose we are in the -Scaling phase • augmentation modifies the residual capacities of arcs by 0 or units and, consequently, preserves the induction hypothesis. • Reducing the scale factor of to also maintains the invariant
RHS Scaling – Correctness cont. • during an augmentation, Δunits of flow can be sent on any path P with positive residual capacity. • Sending flow down a shortest path does not break optimality • The pseudo flow after each scaling phase still satisfies the optimality condition. • The algorithm terminates when all nodes are balanced • Clearly, this flow must be optimum.
RHS Scaling – Notations • Node i is active if and is inactive if • Node i is regenerated if it was inactive in the previous scaling phase and it is active in the current scaling phase • It is clear that for each regenerated node:
Complexity • We start with • At each phase • Clearly there are scaling phases. • We will now prove that the algorithm can find at most n augmenting paths in any scaling phase.
RHS Scaling – Complexity cont. • The number of augmentations in a scaling phase is at most the number of nodes that are regenerated at the beginning of the phase • Proof: • At the beginning of the Δ scaling phase either S() = or T() = . We will assume that S(2) = • Every node in S() is a regenerated node. • for each • Augmentation send units of flow, thus after an augmentation • Augmentation terminated at a sink node, thus it cannot make active nodes • There are at most augmentations
RHS Scaling – Complexity cont. • There are scaling phases • Number of augmentations is bounded by the number of regenerations ineach phase • The RHS algorithm runs in • – running time of the shortest path algorithm • The next phase is to make this algorithm Strongly Polynomial
Contractions - Intuition • We will try to find arcs with flow so large in the Δ-Scaling phase that they must have a positive flow in the subsequent scaling phases • An arcs with a sufficiently large flow can contracted into a single node • Contraction does not effect optimality • Optimal flow found on the contracted network can be transformed into an optimal flow in the original network
Contraction - Motivation • During the algorithm a node cannot be uncontracted • The number of contractions is • If we can show that after “few” scaling phases we contract a node we can bound the number phases by a function of
Strongly Feasible Arc • Recall there are at most augmentation in a Δ-Scaling phase • A flow in any arc can change by at most units • The total change for any arc is: • If an arc exceeds units of flow we can contract it • We will refer to that arc as strongly feasible arc
Contraction Method • An arc (k,l) with flow larger than can be contracted into a single node p letting: • Replacing each arc (k,i) and (l,i) with (p,i) • Replacing each arc (j,k) and (j,l) with (j,p) • Costs remain the same
Justifying Contractions Cont. • Lemma 1: If is an optimal flow of the minimum cost flow problem with costs for each arc . Then it is also the optimal flow for the minimum cost flow problem with the cost of each arc as for any set of node potentials • Otherwise there would be a negative cycle in the residual network associated with in the original problem
Justifying Contractions • Lemma 2: Suppose in an optimal solution, then the reduced cost of is zero for every optimum node potentials. • It can be proved that if satisfies the complementary slackness for some optimal node potential then it satisfies the complementary slackness for all optimal node potential
Justifying Contractions Cont. • Let denote the min-cost flow problem • During the RHS-Scaling algorithm we realize that arc is strongly feasible, suppose are the potentials found so far • From the optimality condition • Consider a problem created by replacing the costs with the residual costs, thus for each arc
Justifying Contractions Cont. • and have the same optimal solutions, thus have a positive flow in the optimal solution of • Suppose is the optimal set of node potentials for • (from lemma 2)
Justifying Contractions Cont. • Upon finding a strongly feasible arc we can update the problem and ensure that the potential of and are identical • If we solve the dual problem minimum cost with the addition constraint of and not affect the optimality of the dual • We can solve the problem by replacing and with in the linear program and lower the number of variables • Essentially this is contraction of and
Next Step • By now we are convinced that contraction does not effect optimality of the dual problem • Contraction lowers the complexity of the problem and thus the number of contractions is bounded by • Next we will see that there is a strongly feasible arc after “sufficiently small” number of scaling phases • We will charge a sequence of scaling phases to a contracted node
Nearing strongly polynomial • We denote the contracted network by • Lemma: After termination of a scaling phase, if for some node , then there is an arc or such that the flow on the arc is at least
Nearing strongly polynomial • Proof: Suppose we are at the beginning of the -Scaling phase. We know that either or Thus the total deficit and excess is bounded by . • This implies that for every node , • Suppose ( is proved similarly) • The net flow going out of is i
Nearing strongly polynomial • There are at mode arc emanating from • At least one arc have flow grater then • and • This implies that the arc is strongly feasible
Nearing strongly polynomial • All node start with • Once for some node it will be contracted after phases • If we eliminate “Empty” phases where for each node we can charge a sequence of scaling phases to a contraction and bound the number of phases by • This almost leads into a strongly polynomial complexity
Nearing strongly polynomial • Why almost? • There is a difficulty resulting from the contraction, this is illustrated in the next example • Assume M is very large, arc costs a 0 and the initial flow is 0. 0 1 2 -8M-1 8M-1 0 0 3 4 8M+1 -8M+1
Nearing strongly polynomial • Why almost? • There is a difficulty resulting from the contraction, this is illustrated in the next example • Assume M is very large, arc costs a 0 and the initial flow is 0. 8M 1 2 -1 8M-1 8M -Scaling Phase 0 3 4 1 -8M+1
Nearing strongly polynomial • Why almost? • There is a difficulty resulting from the contraction, this is illustrated in the next example • Assume M is very large, arc costs a 0 and the initial flow is 0. 8M 1 2 -1 4M-1 4M -Scaling Phase 4M 3 4 1 -4M+1
Nearing strongly polynomial • Why almost? • There is a difficulty resulting from the contraction, this is illustrated in the next example • Assume M is very large, arc costs a 0 and the initial flow is 0. 8M 1 2 -1 2M-1 2M -Scaling Phase 6M 3 4 1 -2M+1
Nearing strongly polynomial • Why almost? • There is a difficulty resulting from the contraction, this is illustrated in the next example • Assume M is very large, arc costs a 0 and the initial flow is 0. 8M 1 2 -1 M-1 M -Scaling Phase 7M 3 4 1 -M+1
Nearing strongly polynomial • Why almost? • There is a difficulty resulting from the contraction, this is illustrated in the next example • Assume M is very large, arc costs a 0 and the initial flow is 0. A M-2 • b(A) = -2 • b(B) = 2 • It will take O(logM) scaling phases until the arc is strongly feasible and the algorithm terminates. M B -M+2
Summarize • It is possible to create contracted nodes in which the excess/deficit is comparable to and is much larger then the supply/demand at the node • Node can be regenerated a large number of times • Occurs infrequently • When and for very small positive • When and for very small positive
Solution • We modify the augmentation rules slightly • This way if a “bad” contraction occurred then we empty the node fast
The Algorithm • RHS-Scaling algorithm with the following modifications: • Contract an arc when it becomes strongly feasible • Allow augmentations from nodes with to nodes with (If the algorithm is not strongly polynomial) • We no longer require to be a power of two and no longer require to be divided by 2 • The strongly polynomial algorithm solves the dual minimum cost flow. • When is decreased by factor larger then 2 we call that step complete regeneration
Eliminates the possibility of “passive” phases where nothing can happened
Correctness • Lemma: At every step of the algorithm the flow and residual capacity of each arc is an integral multiple of • Proof: By induction on the number of augmentations, contractions and scale factor adjustments. The initial is 0 and capacities , the lemma holds. • Each augmentation carries units of flow and preserve the hypothesis • Contraction doesn’t effect the flow of the remaining arcs • can change into which preserve the hypothesis or it changes into this occurs when all arc flow is 0.
Correctness cont. • Each augmentation can send units of flow down a path • The algorithm always maintains a pseudo flow that satisfies the optimality condition • Terminates when the network is balanced or it is contracted into a single node • Thus, terminates with a optimal flow in the contracted network We will show later on how to produce an optimal flow in the original network
Complexity • Steps: • Step 1: Bound the number of augmentation to the number of contractions plus the number of regenerations • Step 2: Bound the number of regenerations for a single node until contraction • Step 3: Bound the number of scaling phases
Complexity – Step 1 Lemma: The number of augmentations during a -Scaling phase is bounded by the number of regenerated nodes plus the number of contracted node in that phase Proof: Let be the scaling factor of the previous scaling phase, thus and at the end of the previous scaling phase or We consider the case where (the other case is similar)
Complexity – Step 1 • Potential function: • Augmentation sends units of flow from a node in S hence decrease by 1. • Thus, Number of Augmentations is bounded by: • The initial value thus it bounded by the number of regenerated nodes, for every node • If then and • If then and
Complexity – Step 1 cont. • The effect of contraction and : • If and then: • If or • Assuming • Contraction can increase by at most 1