Shortest Path With Negative Weights

Similar documents
Ma/CS 6a Class 15: Flows and Bipartite Graphs

Final Exam : Solutions

DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING SIGNALS AND SYSTEMS. Assoc. Prof. Dr. Burak Kelleci. Spring 2018

Design and Analysis of Algorithms (Autumn 2017)

Max Flow, Min Cut COS 521. Kevin Wayne Fall Soviet Rail Network, Cuts. Minimum Cut Problem. Flow network.

Soviet Rail Network, 1955

Jonathan Turner Exam 2-10/28/03

Chapter 6. Dynamic Programming. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Poisson process Markov process

Boyce/DiPrima 9 th ed, Ch 2.1: Linear Equations; Method of Integrating Factors

! Abstraction for material flowing through the edges. ! G = (V, E) = directed graph, no parallel edges.

Instructors Solution for Assignment 3 Chapter 3: Time Domain Analysis of LTIC Systems

The Residual Graph. 12 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Transfer function and the Laplace transformation

Lecture 4: Laplace Transforms

The Residual Graph. 11 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Maximum Flow and Minimum Cut

Elementary Differential Equations and Boundary Value Problems

CSE 521: Design & Analysis of Algorithms I

Problem Set If all directed edges in a network have distinct capacities, then there is a unique maximum flow.

Chapter 12 Introduction To The Laplace Transform

Jonathan Turner Exam 2-12/4/03

4.1 The Uniform Distribution Def n: A c.r.v. X has a continuous uniform distribution on [a, b] when its pdf is = 1 a x b

Graphs III - Network Flow

Data Structures and Algorithms CMPSC 465

Boyce/DiPrima 9 th ed, Ch 7.8: Repeated Eigenvalues

Double Slits in Space and Time

UNIT #5 EXPONENTIAL AND LOGARITHMIC FUNCTIONS

REPETITION before the exam PART 2, Transform Methods. Laplace transforms: τ dτ. L1. Derive the formulas : L2. Find the Laplace transform F(s) if.

Discussion 06 Solutions

Matching. Slides designed by Kevin Wayne.

Copyright 2012 Pearson Education, Inc. Publishing as Prentice Hall.

SOLUTIONS. 1. Consider two continuous random variables X and Y with joint p.d.f. f ( x, y ) = = = 15. Stepanov Dalpiaz

Decline Curves. Exponential decline (constant fractional decline) Harmonic decline, and Hyperbolic decline.

Algorithms and Data Structures 2011/12 Week 9 Solutions (Tues 15th - Fri 18th Nov)

Economics 302 (Sec. 001) Intermediate Macroeconomic Theory and Policy (Spring 2011) 3/28/2012. UW Madison

AR(1) Process. The first-order autoregressive process, AR(1) is. where e t is WN(0, σ 2 )

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 259] B-Trees

Math 3301 Homework Set 6 Solutions 10 Points. = +. The guess for the particular P ( ) ( ) ( ) ( ) ( ) ( ) ( ) cos 2 t : 4D= 2

Control System Engineering (EE301T) Assignment: 2

Main Reference: Sections in CLRS.

Algorithm Design and Analysis

1 Motivation and Basic Definitions

Network Flow. Data Structures and Algorithms Andrei Bulatov

Soviet Rail Network, 1955

Admin MAX FLOW APPLICATIONS. Flow graph/networks. Flow constraints 4/30/13. CS lunch today Grading. in-flow = out-flow for every vertex (except s, t)

Flow networks. Flow Networks. A flow on a network. Flow networks. The maximum-flow problem. Introduction to Algorithms, Lecture 22 December 5, 2001

Supplementary Materials

Advanced Queueing Theory. M/G/1 Queueing Systems

6/3/2009. CS 244 Algorithm Design Instructor: t Artur Czumaj. Lecture 8 Network flows. Maximum Flow and Minimum Cut. Minimum Cut Problem.

Algorithmic Discrete Mathematics 6. Exercise Sheet

CHAPTER CHAPTER14. Expectations: The Basic Tools. Prepared by: Fernando Quijano and Yvonn Quijano

Randomized Perfect Bipartite Matching

Charging of capacitor through inductor and resistor

6. DYNAMIC PROGRAMMING II

2.1. Differential Equations and Solutions #3, 4, 17, 20, 24, 35

Lecture 1: Growth and decay of current in RL circuit. Growth of current in LR Circuit. D.K.Pandey

Dynamic Programming 11/8/2009. Weighted Interval Scheduling. Weighted Interval Scheduling. Unweighted Interval Scheduling: Review

Wrap up: Weighted, directed graph shortest path Minimum Spanning Tree. Feb 25, 2019 CSCI211 - Sprenkle

6. DYNAMIC PROGRAMMING II

Network Flows UPCOPENCOURSEWARE number 34414

14.02 Principles of Macroeconomics Fall 2005 Quiz 3 Solutions

6. DYNAMIC PROGRAMMING II. sequence alignment Hirschberg's algorithm Bellman-Ford distance vector protocols negative cycles in a digraph

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

Lecture 2: Current in RC circuit D.K.Pandey

Chapter 6. PID Control

cycle that does not cross any edges (including its own), then it has at least

2. The Laplace Transform

5. An object moving along an x-coordinate axis with its scale measured in meters has a velocity of 6t

Circuits and Systems I

Longest Common Prefixes

Microscopic Flow Characteristics Time Headway - Distribution

10. If p and q are the lengths of the perpendiculars from the origin on the tangent and the normal to the curve

Network Design with Weighted Players (SPAA 2006 Full Paper Submission)

Chapter 3: Fourier Representation of Signals and LTI Systems. Chih-Wei Liu

Today: Max Flow Proofs

6. DYNAMIC PROGRAMMING II

Chapter 5 The Laplace Transform. x(t) input y(t) output Dynamic System

16.512, Rocket Propulsion Prof. Manuel Martinez-Sanchez Lecture 3: Ideal Nozzle Fluid Mechanics

Algorithms and Theory of Computation. Lecture 11: Network Flow

18 Extensions of Maximum Flow

Lecture 1: Numerical Integration The Trapezoidal and Simpson s Rule

Dynamic Programming. Data Structures and Algorithms Andrei Bulatov

Master Thesis Seminar

Applied Statistics and Probability for Engineers, 6 th edition October 17, 2016

EXERCISE - 01 CHECK YOUR GRASP

CSE 245: Computer Aided Circuit Simulation and Verification

where: u: input y: output x: state vector A, B, C, D are const matrices

Algorithm Design and Analysis

CPSC 665 : An Algorithmist s Toolkit Lecture 4 : 21 Jan Linear Programming

Maximum Flow. Contents. Max Flow Network. Maximum Flow and Minimum Cut

Network Flows: Introduction & Maximum Flow

Physics 160 Lecture 3. R. Johnson April 6, 2015

Math 266, Practice Midterm Exam 2

MEM 355 Performance Enhancement of Dynamical Systems A First Control Problem - Cruise Control

MA1506 Tutorial 2 Solutions. Question 1. (1a) 1 ) y x. e x. 1 exp (in general, Integrating factor is. ye dx. So ) (1b) e e. e c.

CS 541 Algorithms and Programs. Exam 2 Solutions. Jonathan Turner 11/8/01

Boyce/DiPrima/Meade 11 th ed, Ch 6.1: Definition of Laplace Transform

Network Design with Weighted Players

Junction Tree Algorithm 1. David Barber

Transcription:

Shor Pah Wih Ngaiv Wigh 1 9 18-1 19 11 1-8 1 Conn Conn. Dird hor pah wih ngaiv wigh. Ngaiv yl dion. appliaion: urrny xhang arbirag Tramp amr problm. appliaion: opimal piplining of VLSI hip Shor Pah wih Ngaiv Wigh Shor Pah wih Ngaiv Wigh Ngaiv o yl. OPT(i, v) = lngh of hor -v pah uing a mo i ar. L P b uh a pah. - - Ca 1: P u a mo i-1 ar. Ca : P u xaly i ar. if (u, v) i la ar, hn OPT l b -u pah uing a mo i-1 ar, and hn u (u, v) If om pah from o v onain a ngaiv o yl, hr do no xi a hor -v pah; ohrwi, hr xi on ha i impl. W v OPT ( i, v) = min OPT ( i 1, v), min ( u, v ) E { OPT ( i 1, u) + ( u, v) } if i = ohrwi (W) < Goal: ompu OPT(n-1, ) and find a orrponding - pah.

Shor Pah wih Ngaiv Wigh: Algorihm Dynami Programming Shor Pah INPUT: G = (V, E),, n = V ARRAY: OPT[..n, V] FOREACH v V OPT[, v] = OPT[,] = FOR i = 1 o n FOREACH v V min OPT ( i 1, u) + ( u, m = OPT[i-1, v] u, v ) E m = FOREACH (u, v) E m = min (m, OPT[i-1, u] + [u,v]) OPT[i, v] = min(m, m ) { ) } ( v Shor Pah: Running Tim Dynami programming algorihm rquir Θ(mn) im and pa. Our loop rpa n im. Innr loop for vrx v onidr indgr(v) ar. v V Finding h hor pah. indgr( v) = m Could mainain prdor variabl. Alrnaiv: ompu opimal dian, onidr only zro rdud o ar. RETURN OPT[n-1, ] Shor Pah: Ding Ngaiv Cyl L1: if OPT(n,v) < OPT(n-1,v) for om nod v, hn (any) hor pah from o v uing a mo n ar onain a yl; morovr any uh yl ha ngaiv o. Proof (by onradiion). Sin OPT(n,v) < OPT(n-1,v), P ha n ar. L C b any dird yl in P. Dling C giv u a pah from o v of fwr han n ar C ha ngaiv o. Shor Pah: Ding Ngaiv Cyl L1: if OPT(n,v) < OPT(n-1,v) for om nod v, hn (any) hor pah from o v uing a mo n ar onain a yl; morovr any uh yl ha ngaiv o. Proof (by onradiion). Sin OPT(n,v) < OPT(n-1,v), P ha n ar. L C b any dird yl in P. Dling C giv u a pah from o v of fwr han n ar C ha ngaiv o. C (C) < v Corollary: an d ngaiv o yl in O(mn) im. Nd o ra bak hrough ub-problm. 1 - -1 18-11 8

Ding Ngaiv Cyl: Appliaion Shor Pah: Praial Improvmn Currny onvrion. Givn n urrni (finanial inrumn) and xhang ra bwn pair of urrni, i hr an arbirag opporuniy? Fa algorihm vry valuabl! Praial improvmn. If OPT(i, v) = OPT(i-1, v) for all nod v, hn OPT(i, v) ar h hor pah dian.! Conqun: an op algorihm a oon a hi happn. $ 8 1/ F Mainain only on array OPT(v).! U O(m+n) pa; ohrwi Θ(mn) b a. / / /1 / 8 IBM No nd o hk ar of h form (u, v) unl OPT(u) hangd in prviou iraion.! Avoid unnary work. 1 DM 1/1 Ovrall ff. Sill O(mn) wor a, bu O(m) bhavior in prai. 9 1 Shor Pah: Praial Improvmn Bllman-Ford FIFO Shor Pah INPUT: G = (V, E),, n = V ARRAY: OPT[V], prd[v] FOREACH v V OPT[v] =, prd[v] = φ Shor Pah: Sa of h Ar All im blow ar for ingl our hor pah in dird graph wih no ngaiv yl. O(mn) im, O(m + n) pa. Shor pah: raighforward. Ngaiv yl: Bllman-Ford prdor variabl onain hor pah or ngaiv yl (no provd hr). Ngaiv yl wak: op if any nod nquud n im. OPT[] =, Q = QUEUEini() WHILE (Q φ) u = QUEUEg() FOREACH (u, v) E IF (OPT[u] + [u,v] < OPT[v]) OPT[v] = OPT[u] + [u,v] prd[v] = u IF (v Q) QUEUEpu(v) RETURN OPT[n-1] O(mn 1/ log C) im if all ar o ar ingr bwn C and C. Rdu o wighd bipari mahing (aignmn problm). "Co-aling." Gabow-Tarjan (1989), Orlin-Ahuja (199). O(mn + n log n) undird hor pah, no ngaiv yl. Rdu o wighd non-bipari mahing. Byond h op of hi our. 11 1

Tramp-Samr Problm Tramp-amr (min o o im raio) problm. A ramp amr ravl from por o por arrying argo. A voyag from por v o por w arn p(v,w) dollar, and rquir (v,w) day. Capain wan a our ha ahiv larg man daily profi. Wward Ho (189 19) 1 p = = p = 1 = p = - = Tramp-Samr Problm Tramp-amr (min o o im raio) problm. Inpu: digraph G = (V, E), ar o, and ar ravral im >. Goal: find a dird yl W ha minimiz raio Novl appliaion. Minimiz yl im (maximiz frquny) of logi hip on IBM proor hip by adjuing loking hdul. Spial a. Find a ngaiv o yl. µ ( W ) = W W. man daily profi = + 1 = + + 9 1 1 1 Tramp-Samr Problm Linariz objiv funion. L µ* b valu of minimum raio yl. L µ b a onan. Dfin l = µ. Tramp-Samr Problm Linariz objiv funion. L µ* b valu of minimum raio yl. L µ b a onan. Dfin l = µ. Ca 1: hr xi ngaiv o yl W uing lngh l. W ( µ ) < µ > µ *. W W Ca : vry dird yl ha poiiv o uing lngh l. ( W µ < µ W W ) > for vry ylw for vry ylw µ < µ *. Ca : vry dird yl ha nonngaiv o uing lngh l, and hr xi a zro o yl W*. ( W µ µ W W W * W * ) for vry yl W for vry ylw = µ µ = µ *. µ µ *. 1 1

Tramp-Samr Problm Tramp-Samr: Squnial Sarh Produr Linariz objiv funion. L µ* b valu of minimum raio yl. L µ b a onan. Dfin l = µ. Ca 1: hr xi ngaiv o yl W uing lngh l. µ* < µ Ca : vry dird yl ha poiiv o uing lngh l. µ* > µ Ca : vry dird yl ha nonngaiv o uing lngh l, and hr xi a zro o yl W*. µ* = µ Squnial Tramp Samr L µ b a known uppr bound on µ*. REPEAT (forvr) l µ Solv hor pah problm wih lngh l IF (ngaiv o yl W w.r.. l ) µ µ(w) ELSE Find a zro o yl W* w.r.. l. RETURN W*. Thorm: qunial algorihm rmina. Ca 1 µ rily dra from on iraion o h nx. µ i h raio of om yl, and only finily many yl. 1 18 Tramp-Samr: Binary Sarh Produr Tramp-Samr: Binary Sarh Produr W yl lf -C, righ C Binary Sarh Tramp Samr lf µ* righ REPEAT (forvr) IF (µ(w) = µ*) RETURN W µ (lf + righ) / l µ Solv hor pah problm wih lngh l IF (ngaiv o yl w.r.. l ) righ µ W ngaiv o yl w.r.. l ELSE IF (zro o yl W*) RETURN W*. ELSE lf µ Invarian: inrval [lf, righ] and yl W aify: lf µ* µ(w) < righ. Proof by induion follow from a 1-. Lmma. Upon rminaion, h algorihm rurn a min raio yl. Immdia from a. Aumpion. All ar o ar ingr bwn C and C. All ar ravral im ar ingr bwn T and T. Lmma. Th algorihm rmina afr O(log(nCT)) iraion. Proof on nx lid. Thorm. Th algorihm find min raio yl in O(mn log (nct)) im. 19

Tramp-Samr: Binary Sarh Produr Lmma. Th algorihm rmina afr O(log(nCT)) iraion. Iniially, lf = -C, righ = C. Eah iraion halv h iz of h inrval. L (W) and (W) dno o and ravral im of yl W. W how any inrval of iz l han 1 / (n T ) onain a mo on valu from h { (W) / (W) : W i a yl }. l W 1 and W yl wih µ(w 1 ) > µ(w ) ( W1 ) ( W) ( W ) ( ) ( ) ( ) 1 W W W > 1 > ( W1) ( W) ( W1) ( W) numraor of RHS i a la 1, dnominaor i a mo n T Afr 1 + log ((C) (n T )) = O(log (nct)) iraion, a mo on raio in h inrval. Algorihm mainain yl W and inrval [lf, righ].. lf µ* µ(w) < righ.. Tramp Samr: Sa of h Ar Min raio yl. O(mn log (nct)). O(n log n) dn. (Mgiddo, 199) O(n log n) par. (Mgiddo, 198) Minimum man yl. Spial a whn all ravral im = 1. Θ(mn). (Karp, 198) O(mn 1/ log C). (Orlin-Ahuja, 199) O(mn log n). (Karp-Orlin, 1981) paramri implx - b in prai 1 Opimal Piplining of VLSI Chip Novl appliaion. Minimiz yl im (maximiz frquny) of logi hip on IBM proor hip by adjuing loking hdul. If lok ignal arriv a lah imulanouly, min yl im = 1. Allow individual lok arrival im a lah. Clok ignal a lah: A:, 1,,,... A 9 B B: -1, 9, 19, 9,... C:, 1,,,... 1 1 11 D: -,, 1,,... Opimal yl im = 1. Max man wigh yl = 1. C Lah Graph D