Presentation on theme: "Network Flow Problems A special case of linear programming which is faster and has wide applicability."— Presentation transcript:
1 Network Flow ProblemsA special case of linear programming which is faster and has wide applicability
2 Solving Discrete Problems Linear programming solves continuous problem—problems over the reaI numbers.For the remainder of the course we will look at how to solveproblems in which variables must take discrete values—problems over the integers.Discrete problems are harder than continuous problems.We already saw: Finite Domain PropagationWe will look atNetwork Flow ProblemsInteger ProgrammingBoolean SatisfiabilityLocal Search
3 Network Simplex A particular form of linear integer problems can be solved in elegantly (and efficiently)with a drastic simplification of the simplex methodd5=8n1d4=10d3=6n2s6=9s7=15Network Flow Optimization
4 Transshipment Problems Intuitively, a transshipment problem (or network flow problem)consists in finding the cheapest way of shipping goods through anetwork of routes so that all given demands at all points of thenetwork are satisfied. Given:a network of routes as a grapha set of nodes which act as sources (supplies)a set of nodes which act as sinks (demands)the amount of supply and demand at each nodethe cost of each transport route (edge)d3=6d4=10d5=8s7=15n2n1s6=9$29$18$5$53$8$37$28$44$59$60$98$38$23$14Assumption: the total supply equals the total demand
5 Network Flow Matrix Representation A transshipment problem can concisely be represented in matrix form.with Incidence Matrix and Demand Vector.The incidence matrix A contains one column a=(a1, ..., an)for each edge e=(ni, nj) in the networkwithak := -1 if k=i1 if k=j0 otherwise
6 Network Flow Matrix Representation the demand vectorcontains one element for each node giving the total demand at thisnode. Supplies are indicated as negative demands.The cost vectorcontains one entry for each edge e=(ni, nj) with the cost of shippingone unit along this edge.
7 Transshipment Formalization the transshipment problem can now be formalized as:such that A is an incidence matrix andEvery problem that can be expressed in this form is a transshipmentproblem and can be solved by the network simplex algorithm.
8 Truncated Matrix Note that the equations expressed in are not independent. Sinceeach of these equations is the sum of the remaining n-1 equations.We can therefore arbitrarily delete one of the equations from thematrices A and b obtaining A’ and b’.The truncated problem has the same solution as the original problem.
9 Feasible Solutions = Trees 916158d3=6d4=10d5=8s7=15n2n1s6=9NetworkFeasible Tree SolutionNote that the feasible tree need not be a directed tree. It is defined onunderlying undirected graph.If a transhipment problem has an optimal solution then it has an optimal solution that corresponds to a feasible tree solution. Why?Thus we need only consider feasible tree solutions.
10 Uniqueness of Feasible Solutions d3=6d4=10d5=8s7=15n2n1s6=9For a given tree there is a unique assignment to the edgesin the tree that satisfies the supply and demand constraints.This can be found using a recursive tree traversal.What is the assignment for this tree?
11 Network Simplex Network Feasible Spanning Tree Solution d3=6d4=10d5=8s7=15n2n1s6=9$29916158$18$5$53$8$37$28$44$59$60$98$38$23$14NetworkFeasible Spanning Tree SolutionThe Network Simplex works by improving the current feasible spanning tree solution.Find an initial feasible tree solutionWhile current solution not optimalChoose the edge to enter (choose new basic variable)Choose the edge to leave so it remains a tree(choose variable to leave)This exactly corresponds to the Simplex method but is greatly simplified because of the form of the constraints.
12 Choosing the Edge to Enter $29$29$18$5$18$53$8$37$28$44$59$44$28$59$60$60$98$38$23$23$14For each edge not in the spanning tree work out the benefit (gain)of adding it and moving 1 unit along that edge.In the case of the edge (n7,n5) the cost of moving 1 unit along the edge is1*59-1*29+1*18-1*28-1*23 = -3.So the benefit is 3 and we will reduce the cost if we add this edge.If no edge has a benefit > 0 then the solution is optimal.Otherwise choose some edge with positive benefit to add.
13 Computing the Edge Benefit $29Y1=Y5=We can compute the edge benefit more efficiently than this by thinking about the Simplex. (See Winston Chap 8 for justification).$18Y4=$44$28$59Y3=$60Y2=$23Y7=0Y6=In the Simplex we compute the opportunity cost for each resource. The benefit we have just computed is exactly the opportunity cost for the edge.For each node ni we associate a variable yi which is (sort of) the price of shipping 1 unit to that node from an arbitrary origin node. This is the negative of the Simplex multiplier.If an edge (ni,nj) is in the tree then yj=yi+cij. This allows us to easily compute the yi’s. (We assume that for the origin node yi =0)The opportunity cost cij for an edge (ni,nj) not in the tree iscij=yj-yi-cij.Y7=0 y2=0+23 y3=23+60=83 y4=23+28=51 y1=51-18=33 y6=33-44=-11 y5=33+29=62 c75= =3. Beware the yis are actually the negative of the
14 Entering EdgesAn edge with positive benefit is now added to the spanning tree.It is therefore called the “entering edge”.Strategy: If there are several possible choices for entering edges,choose the one with maximum benefit.Note: large scale computer implementations use different strategies
15 Network PivotThe pivot step improves the solution by shipping some quantity talong the entering edge. As in the Simplex we try to exploit theentering edge maximally by maximizing t until constraints are tight.916158The obvious adjustments are obtained by traversing the cycle introduced bythe entering edge (in its direction) and labelling each edge a along the cycle with(xij+t) if a has the same direction on the cycle as the entering edge(xij-t) if a has the opposite direction on the cycle.With the resulting adjustments we have to satisfy:t ≥ 0, 8-t ≥ 0, 9-t ≥ 0, 15-t ≥ 0, 1+t ≥ 0This leads to t=8 which removes all shipments from the dotted edge. This edge is referred to as the “leaving edge”.8-t1+t9-tt units9615-t918967
16 Summary: Network Simplex (1) construct a basic feasible tree.(2) compute the benefit for each edge for this tree.(3a) find an entering edge that can improve the solution(3b) if no such edge can be found, the solution is optimal(4) adjust the quantities shipped(5) re-iterate from step (2)As the Simplex algorithm, network simplex only works with feasible solutions.The obvious problem is how to find an initial basic feasible tree!
17 Basic Feasible Tree Construction In general, finding a basic feasible tree is not simple.However, we can perform a “trick” similar to Simplex phase 0.The basic idea is to add “artificial arcs” that guarantee a trivialbasic feasible tree.We then use a phase 0 optimization on the augmented graph thatpenalizes these arcs so that they are not used in theoptimum solution to phase 0.The result of phase 0 with the (unused) artificial arcs removedis then a basic feasible solution for the original problem.
18 Auxiliary Problem & Graph Select an arbitrary fixed node wAdd an artificial edge from w to each nodeset xwj=bjThe set of artificial edges forms a feasible spanning tree for the auxiliary graphSolve the following auxiliary problemset penalty pij=1 for each artificial edgeset penalty pij=0 for each original edge
19 Solving the Auxiliary Problem The auxiliary problem can simply be optimized by network simplex.Three outcomes for the spanning tree T of the solution of phase 0are possible:T contains no artificial edge -> use T as a start for phase I optimization of original problemT contains an artificial edge aij with xij>0 -> the original problem is infeasibleT contains artificial arcs aij with xij=0 -> the original problem may have a solution, but not a tree solution (eg network not sufficiently connected)Decompose the original problem into two networks. Let a=(ni, nj) be the artificial edge with xij=0- Network A contains all nodes that precede ni in T- Network B contains all nodes that follow ni in TA and B can now be solved independently
20 Degeneracy It can happen that the pivot steps generates values of xij=0 for more than one edge.However, only one edge can be chosen as the leaving edge,because otherwise the tree would be disconnected. After such apivot the solution contains arcs with xij=0.Such a solution is called “degenerate”.It can lead to subsequent pivots, in which only the tree changes,but not the actual shipment (because leaving arcs with xij=0are exchanged against entering arcs with xuv=0 after the pivot).This can causestalling (a phase of no visible improvement due to swapping arcs with zero shipment)cycling
21 Cycling Cycling is extremely rare in practice. It can easily be avoided by the following method(due to W.H. Cunnigham, 1976)Let a strongly feasible tree be a feasible tree in which each edge isdirected away from the (arbitrarily chosen, but fixed) root w.(To check the direction of a=(u,v) in T, remove a from T.This partitions T in Tu (containing u) and Tv (containing v).The edge a is directed towards the root w if and only if w is in Tv)(1) Ensure that the initial solution is strongly feasible.This always holds for the initial tree of the auxiliary problem!(2) In each pivot generate a strongly feasible solution.The resulting network simplex process will not cycle, though itmay still go through degenerate immediate solutions.
22 “Strong” PivotThe entering edge e=(u,v) introduces a cycle into (T+e).Let the “join” node nj be the node at which the paths fromu to the root of T and from v to the root of T meet.Strong feasiblity of a solution is maintained in each pivot,if the following refinement is introduced.If there is more than one candidate for the leaving edge, thechoice is made in the following way:Traverse the cycle starting at the join node nj in the direction ofthe entering edge e=(u,v). Choose the first candidate encounteredon this traversal as the leaving edge.uwevnjEvery tree generated by a strong pivot is strongly feasible -> no cycling
23 Integrality Theorem Let b be a vector of integers. The transshipment problem(a) is feasible if and only ifit has an integer-valued solution vector x.(b) has an optimal solution if and only ifit has an integer-valued optimal solution.This can be proved by analyzing the pivot operation of the network simplex:Whenever it starts from an integer-valued solution the subsequentsolution is also integer-valued.
24 Complexity Linear Programming: Interior point methods worst case: polynomialSimplex algorithmworst case: exponential in size of LPin practice: well-behavedInteger Linear Programming: NP-completeNetwork Simplexworst case: exponential in node size(proven for largest merit selection ‘73)in practice: roughly linear in node sizeHowever, there are versions of Network Simplex withpolynomial worst case behaviour (proved in 1997!)
25 Generalization to Inequalities The assumption(supply matches demand) is often unrealisticWe need to generalize to supplies that exceed the demand.Introduce “virtual dump” (new node) for exceeding supplyd5=8n1d4=10d3=6n2s7=15+ys6=9+xdvd=x+yThe new “dummy node” must be connected to each source bya new “dummy edge” of zero cost.
26 Caterer Problem (aircraft overhaul scheduling) A caterer needs to plan (and optimize) his napkin provisions over n daysdj: number of napkins needed on day j (known in advance)Napkins can bebought: a cents per piecelaundered:b cents per napkin (fast service takes q days)c cents per piece (slow service takes p days)+d1“q days”“buy”“quick laundry”-d1“p days”Shop“keep”“slow”exceeding supply in shop+dn-dnDump“at end of day”“at start of day”
27 Summary Homework We have looked at Transhipment problems (network flow)Network simplexGives an efficient way of solving some IP problemsCan be generalized to handle an upper bound on the flow along an edgeHomeworkRead Winston Chap 8Solve the example using network simplexDo the assignment!
Your consent to our cookies if you continue to use this website.