CSE 417, Winter Greedy Algorithms 1/27/2012. Chapter 4. Ben Birnbaum Widad Machmouchi. 4.1 Interval Scheduling.

Similar documents
4.5 Minimum Spanning Tree. Chapter 4. Greedy Algorithms. Minimum Spanning Tree. Motivating application

4.5 Minimum Spanning Tree. Chapter 4. Greedy Algorithms. Minimum Spanning Tree. Applications

10. EXTENDING TRACTABILITY

Chapter Finding Small Vertex Covers. Extending the Limits of Tractability. Coping With NP-Completeness. Vertex Cover

Preview. Graph. Graph. Graph. Graph Representation. Graph Representation 12/3/2018. Graph Graph Representation Graph Search Algorithms

Minimum Spanning Trees

Strongly Connected Components

Lucas Test is based on Euler s theorem which states that if n is any integer and a is coprime to n, then a φ(n) 1modn.

Spanning Tree. Preview. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree 10/17/2017.

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling.

priority queue ADT heaps 1

Week 3: Connected Subgraphs

ON THE COMPLEXITY OF K-STEP AND K-HOP DOMINATING SETS IN GRAPHS

A Note on Estimability in Linear Models

Searching Linked Lists. Perfect Skip List. Building a Skip List. Skip List Analysis (1) Assume the list is sorted, but is stored in a linked list.

External Equivalent. EE 521 Analysis of Power Systems. Chen-Ching Liu, Boeing Distinguished Professor Washington State University

First derivative analysis

Section 6.1. Question: 2. Let H be a subgroup of a group G. Then H operates on G by left multiplication. Describe the orbits for this operation.

The Equitable Dominating Graph

Economics 600: August, 2007 Dynamic Part: Problem Set 5. Problems on Differential Equations and Continuous Time Optimization

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk

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

Grand Canonical Ensemble

Supplementary Materials

Review - Probabilistic Classification

A New Competitive Ratio for Network Applications with Hard Performance Guarantees

1 Minimum Cut Problem

CS 580: Algorithm Design and Analysis

International Journal of Scientific & Engineering Research, Volume 6, Issue 7, July ISSN

Minimum Spanning Trees

10/7/14. Mixture Models. Comp 135 Introduction to Machine Learning and Data Mining. Maximum likelihood estimation. Mixture of Normals in 1D

Computing and Communications -- Network Coding

COMPLEX NUMBER PAIRWISE COMPARISON AND COMPLEX NUMBER AHP

Recall that by Theorems 10.3 and 10.4 together provide us the estimate o(n2 ), S(q) q 9, q=1

Propositional Logic. Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodríguez-Carbonell. May 17, 2018

CS 491 G Combinatorial Optimization

Examples and applications on SSSP and MST

4.8 Huffman Codes. Wordle. Encoding Text. Encoding Text. Prefix Codes. Encoding Text

Figure 1: Closed surface, surface with boundary, or not a surface?

On spanning trees and cycles of multicolored point sets with few intersections

CHAPTER 33: PARTICLE PHYSICS

The Matrix Exponential

From Elimination to Belief Propagation

Higher order derivatives

SCHUR S THEOREM REU SUMMER 2005

September 27, Introduction to Ordinary Differential Equations. ME 501A Seminar in Engineering Analysis Page 1. Outline

Copyright 2000, Kevin Wayne 1

Final Exam Solutions

Approximate Maximum Flow in Undirected Networks by Christiano, Kelner, Madry, Spielmann, Teng (STOC 2011)

Outlier-tolerant parameter estimation

Lecture 14. Relic neutrinos Temperature at neutrino decoupling and today Effective degeneracy factor Neutrino mass limits Saha equation

ph People Grade Level: basic Duration: minutes Setting: classroom or field site

Mutually Independent Hamiltonian Cycles of Pancake Networks

COHORT MBA. Exponential function. MATH review (part2) by Lucian Mitroiu. The LOG and EXP functions. Properties: e e. lim.

Outlines: Graphs Part-4. Applications of Depth-First Search. Directed Acyclic Graph (DAG) Generic scheduling problem.

Lecture 20: Minimum Spanning Trees (CLRS 23)

SCRIBE: JAKE LEVINSON

Search sequence databases 3 10/25/2016

The Matrix Exponential

Random Process Part 1

Introduction to Arithmetic Geometry Fall 2013 Lecture #20 11/14/2013

Lecture 3: Phasor notation, Transfer Functions. Context

8-node quadrilateral element. Numerical integration

Worksheet: Taylor Series, Lagrange Error Bound ilearnmath.net

Consider a system of 2 simultaneous first order linear equations

Aim To manage files and directories using Linux commands. 1. file Examines the type of the given file or directory

SOME PARAMETERS ON EQUITABLE COLORING OF PRISM AND CIRCULANT GRAPH.

Soft k-means Clustering. Comp 135 Machine Learning Computer Science Tufts University. Mixture Models. Mixture of Normals in 1D

Derangements and Applications

EEO 401 Digital Signal Processing Prof. Mark Fowler

Basic Polyhedral theory

Epistemic Foundations of Game Theory. Lecture 1

MIT Sloan School of Management

ST 524 NCSU - Fall 2008 One way Analysis of variance Variances not homogeneous

Heisenberg Model. Sayed Mohammad Mahdi Sadrnezhaad. Supervisor: Prof. Abdollah Langari

Potential Games and the Inefficiency of Equilibrium

(Upside-Down o Direct Rotation) β - Numbers

10. The Discrete-Time Fourier Transform (DTFT)

Independent Domination in Line Graphs

Analyzing Frequencies

International Journal of Foundations of Computer Science c World Scientic Publishing Company Searching a Pseudo 3-Sided Solid Orthoconvex Grid ANTONIO

Gradebook & Midterm & Office Hours

BINOMIAL COEFFICIENTS INVOLVING INFINITE POWERS OF PRIMES. 1. Statement of results

ELEN E4830 Digital Image Processing

Direct Approach for Discrete Systems One-Dimensional Elements

On the irreducibility of some polynomials in two variables

Electrochemical Equilibrium Electromotive Force. Relation between chemical and electric driving forces

(1) Then we could wave our hands over this and it would become:

Problem Set 9 Solutions

Deift/Zhou Steepest descent, Part I

Chapter 10. The singular integral Introducing S(n) and J(n)

Probability and Stochastic Processes: A Friendly Introduction for Electrical and Computer Engineers Roy D. Yates and David J.

Fakultät III Univ.-Prof. Dr. Jan Franke-Viebach

COMPUTER GENERATED HOLOGRAMS Optical Sciences 627 W.J. Dallas (Monday, April 04, 2005, 8:35 AM) PART I: CHAPTER TWO COMB MATH.

Bifurcation Theory. , a stationary point, depends on the value of α. At certain values

Journal of Theoretical and Applied Information Technology 10 th January Vol. 47 No JATIT & LLS. All rights reserved.

Square of Hamilton cycle in a random graph

Combinatorial Networks Week 1, March 11-12

Approximation and Inapproximation for The Influence Maximization Problem in Social Networks under Deterministic Linear Threshold Model

Jones vector & matrices

Transcription:

//0 CSE, Wntr 0 Grdy Algorthms Chaptr Grdy Algorthms Bn Brnbaum Wdad Machmouch Slds by Kvn Wayn. Copyrght 00 Parson-Addson Wsly. All rghts rsrvd. Slds adaptd rom Larry Ruzzo, Stv Tanmoto, and Kvn Wayn Intrval Schdulng. Intrval Schdulng Intrval schdulng. Job starts at s and nshs at. Two obs compatbl thy don't ovrlap. Goal: nd maxmum subst o mutually compatbl obs. a b c d g 0 0 h Tm

//0 Intrval Schdulng: Grdy Algorthms Intrval Schdulng: Grdy Algorthms Grdy tmplat. Consdr obs n som natural ordr. Tak ach ob provdd t's compatbl wth th ons alrady takn. Grdy tmplat. Consdr obs n som natural ordr. Tak ach ob provdd t's compatbl wth th ons alrady takn. [Earlst start tm] Consdr obs n ascndng ordr o s. [Earlst nsh tm] Consdr obs n ascndng ordr o. countrxampl or arlst start tm [Shortst ntrval] Consdr obs n ascndng ordr o - s. [Fwst conlcts] For ach ob, count th numbr o conlctng obs c. Schdul n ascndng ordr o c. countrxampl or shortst ntrval countrxampl or wst conlcts Intrval Schdulng: Grdy Algorthm Intrval Schdulng: Analyss Grdy algorthm. Consdr obs n ncrasng ordr o nsh tm. Tak ach ob provdd t's compatbl wth th ons alrady takn. Sort obs by nsh tms so that... n. st o obs slctd A φ or = to n { (ob compatbl wth A) A A {} } rturn A Grdy: Thorm. Grdy algorthm s optmal. P. (by contradcton) Assum grdy s not optmal, and lt's s what happns. Lt,,... k dnot st o obs slctd by grdy. Lt,,... m dnot st o obs n th optmal soluton wth =, =,..., r = r or th largst possbl valu o r. r r+ ob r+ nshs bor r+ Implmntaton. O(n log n). Rmmbr ob * that was addd last to A. Job s compatbl wth A s *. OPT: r r+ why not rplac ob r+ wth ob r+?...

//0 Intrval Schdulng: Analyss Thorm. Grdy algorthm s optmal.. Intrval Parttonng P. (by contradcton) Assum grdy s not optmal, and lt's s what happns. Lt,,... k dnot st o obs slctd by grdy. Lt,,... m dnot st o obs n th optmal soluton wth =, =,..., r = r or th largst possbl valu o r. ob r+ nshs bor r+ Grdy: r r+ OPT: r r+... soluton stll asbl and optmal, but contradcts maxmalty o r. Intrval Parttonng Intrval Parttonng Intrval parttonng. Lctur starts at s and nshs at. Goal: nd mnmum numbr o classrooms to schdul all lcturs so that no two occur at th sam tm n th sam room. Intrval parttonng. Lctur starts at s and nshs at. Goal: nd mnmum numbr o classrooms to schdul all lcturs so that no two occur at th sam tm n th sam room. Ex: Ths schdul uss classrooms to schdul 0 lcturs. Ex: Ths schdul uss only. c d g c d b h b g a a h :0 0 0:0 :0 :0 :0 :0 :0 :0 Tm :0 0 0:0 :0 :0 :0 :0 :0 :0 Tm

//0 Intrval Parttonng: Lowr Bound on Optmal Soluton Intrval Parttonng: Grdy Algorthm D. Th dpth o a st o opn ntrvals s th maxmum numbr that contan any gvn tm. Grdy algorthm. Consdr lcturs n ncrasng ordr o start tm: assgn lctur to any compatbl classroom. Ky obsrvaton. Numbr o classrooms ndd dpth. Ex: Dpth o schdul blow = schdul blow s optmal. a, b, c all contan :0 Q. Dos thr always xst a schdul qual to dpth o ntrvals? c d Sort ntrvals by startng tm so that s s... s n. d 0 numbr o allocatd classrooms or = to n { (lctur s compatbl wth som classroom k) schdul lctur n classroom k ls allocat a nw classroom d + schdul lctur n classroom d + d d + } b g a :0 :0 0 0:0 :0 :0 :0 h :0 :0 Tm Implmntaton. O(n log n). For ach classroom k, mantan th nsh tm o th last ob addd. Kp th classrooms n a prorty quu. Intrval Parttonng: Grdy Analyss Obsrvaton. Grdy algorthm nvr schduls two ncompatbl lcturs n th sam classroom.. Schdulng to Mnmz Latnss Thorm. Grdy algorthm s optmal. P. Lt d = numbr o classrooms that th grdy algorthm allocats. Classroom d s opnd bcaus w ndd to schdul a ob, say, that s ncompatbl wth all d- othr classrooms. Ths d obs ach nd atr s. Snc w sortd by start tm, all ths ncompatblts ar causd by lcturs that start no latr than s. Thus, w hav d lcturs ovrlappng at tm s + ε. Ky obsrvaton all schduls us d classrooms.

//0 Schdulng to Mnmzng Latnss Mnmzng Latnss: Grdy Algorthms Mnmzng latnss problm. Sngl rsourc procsss on ob at a tm. Job rqurs t unts o procssng tm and s du at tm d. I starts at tm s, t nshs at tm = s + t. Latnss: l = max { 0, - d }. Goal: schdul all obs to mnmz maxmum latnss L = max l. Ex: t Grdy tmplat. Consdr obs n som ordr. [Shortst procssng tm rst] Consdr obs n ascndng ordr o procssng tm t. [Earlst dadln rst] Consdr obs n ascndng ordr o dadln d. d [Smallst slack] Consdr obs n ascndng ordr o slack d - t. latnss = latnss = 0 max latnss = d = d = d = d = d = d = 0 0 Mnmzng Latnss: Grdy Algorthms Mnmzng Latnss: Grdy Algorthm Grdy tmplat. Consdr obs n som ordr. Grdy algorthm. Earlst dadln rst. [Shortst procssng tm rst] Consdr obs n ascndng ordr o procssng tm t. Sort n obs by dadln so that d d d n t 00 d countrxampl [Smallst slack] Consdr obs n ascndng ordr o slack d - t. 0 0 t 0 or = to n Assgn ob to ntrval [t, t + t ] s t, t + t t t + t output ntrvals [s, ] max latnss = t d 0 0 countrxampl d = d = d = d = d = d = 0 0 0

//0 Mnmzng Latnss: No Idl Tm Mnmzng Latnss: Invrsons Obsrvaton. Thr xsts an optmal schdul wth no dl tm. d = d = d = 0 0 D. Gvn a schdul S, an nvrson s a par o obs and such that: < but schduld bor. nvrson bor swap d = d = d = 0 0 [ as bor, w assum obs ar numbrd so that d d d n ] Obsrvaton. Th grdy schdul has no dl tm. Obsrvaton. Grdy schdul has no nvrsons. Obsrvaton. I a schdul (wth no dl tm) has an nvrson, t has on wth a par o nvrtd obs schduld conscutvly. Mnmzng Latnss: Invrsons Mnmzng Latnss: Analyss o Grdy Algorthm D. Gvn a schdul S, an nvrson s a par o obs and such that: < but schduld bor. nvrson bor swap atr swap Clam. Swappng two conscutv, nvrtd obs rducs th numbr o nvrsons by on and dos not ncras th max latnss. ' Thorm. Grdy schdul S s optmal. P. Dn S* to b an optmal schdul that has th wst numbr o nvrsons, and lt's s what happns. Can assum S* has no dl tm. I S* has no nvrsons, thn S = S*. I S* has an nvrson, lt - b an adacnt nvrson. swappng and dos not ncras th maxmum latnss and strctly dcrass th numbr o nvrsons ths contradcts dnton o S* P. Lt l b th latnss bor th swap, and lt l ' b t atrwards. l ' k = l k or all k, l ' l I ob s lat: l = = d d (dnton) ( nshs at tm ) d ( < ) l (dnton)

//0 Grdy Analyss Stratgs Grdy algorthm stays ahad. Show that atr ach stp o th grdy algorthm, ts soluton s at last as good as any othr algorthm's.. Mnmum Spannng Tr Structural. Dscovr a smpl "structural" bound assrtng that vry possbl soluton must hav a crtan valu. Thn show that your algorthm always achvs ths bound. Exchang argumnt. Gradually transorm any soluton to th on ound by th grdy algorthm wthout hurtng ts qualty. Othr grdy algorthms. Kruskal, Prm, Dkstra, Human, Mnmum Spannng Tr Applcatons Mnmum spannng tr. Gvn a connctd graph G = (V, E) wth ralvalud dg wghts c, an MST s a subst o th dgs T E such that T s a spannng tr whos sum o dg wghts s mnmzd. MST s undamntal problm wth dvrs applcatons. Ntwork dsgn. tlphon, lctrcal, hydraulc, TV cabl, computr, road 0 G = (V, E) T, Σ T c = 0 Cayly's Thorm. Thr ar n n- spannng trs o K n. Approxmaton algorthms or NP-hard problms. travlng salsprson problm, Stnr tr Indrct applcatons. max bottlnck paths LDPC cods or rror corrcton mag rgstraton wth Rny ntropy larnng salnt aturs or ral-tm ac vrcaton rducng data storag n squncng amno acds n a protn modl localty o partcl ntractons n turbulnt lud lows autocong protocol or Ethrnt brdgng to avod cycls n a ntwork can't solv by brut orc

//0 Grdy Algorthms Grdy Algorthms Kruskal's algorthm. Start wth T = φ. Consdr dgs n ascndng ordr o cost. Insrt dg n T unlss dong so would crat a cycl. Smplyng assumpton. All dg costs c ar dstnct. Cut proprty. Lt S b any subst o nods, and lt b th mn cost dg wth xactly on ndpont n S. Thn th MST contans. Prm's algorthm. Start wth som root nod s and grdly grow a tr T rom s outward. At ach stp, add th chapst dg to T that has xactly on ndpont n T. Uss th sam approach as Dkstra s algorthm that you v sn bor. Cycl proprty. Lt C b any cycl, and lt b th max cost dg blongng to C. Thn th MST dos not contan. C S Rmark. All ths algorthms produc an MST. s n th MST s not n th MST 0 Cycls and Cuts Cycl-Cut Intrscton Cycl. St o dgs th orm a-b, b-c, c-d,, y-z, z-a. Clam. A cycl and a cutst ntrsct n an vn numbr o dgs. Cycl C = -, -, -, -, -, - Cycl C = -, -, -, -, -, - Cutst D = -, -, -, -, - Intrscton = -, - Cutst. A cut s a subst o nods S. Th corrspondng cutst D s th subst o dgs wth xactly on ndpont n S. Cut S = {,, } Cutst D = -, -, -, -, - P. (by pctur) S C V - S

//0 Grdy Algorthms Grdy Algorthms Smplyng assumpton. All dg costs c ar dstnct. Smplyng assumpton. All dg costs c ar dstnct. Cut proprty. Lt S b any subst o nods, and lt b th mn cost dg wth xactly on ndpont n S. Thn th MST T* contans. Cycl proprty. Lt C b any cycl n G, and lt b th max cost dg blongng to C. Thn th MST T* dos not contan. P. (xchang argumnt) Suppos dos not blong to T*, and lt's s what happns. Addng to T* crats a cycl C n T*. Edg s both n th cycl C and n th cutst D corrspondng to S thr xsts anothr dg, say, that s n both C and D. T' = T* { } - { } s also a spannng tr. Snc c < c, cost(t') < cost(t*). Ths s a contradcton. S P. (xchang argumnt) Suppos blongs to T*, and lt's s what happns. Dltng rom T* crats a cut S n T*. Edg s both n th cycl C and n th cutst D corrspondng to S thr xsts anothr dg, say, that s n both C and D. T' = T* { } - { } s also a spannng tr. Snc c < c, cost(t') < cost(t*). Ths s a contradcton. S T* T* Kruskal's Algorthm: Proo o Corrctnss Lxcographc Tbrakng Kruskal's algorthm. [Kruskal, ] Consdr dgs n ascndng ordr o wght. Cas : I addng to T crats a cycl, dscard accordng to cycl proprty. Cas : Othrws, nsrt = (u, v) nto T accordng to cut proprty whr S = st o nods n u's connctd componnt. To rmov th assumpton that all dg costs ar dstnct: prturb all dg costs by tny amounts to brak any ts. Impact. Kruskal and Prm only ntract wth costs va parws comparsons. I prturbatons ar sucntly small, MST wth prturbd costs s MST wth orgnal costs..g., all dg costs ar ntgrs, prturbng cost o dg by / n v S Implmntaton. Can handl arbtrarly small prturbatons mplctly by brakng ts lxcographcally, accordng to ndx. u Runnng Tm: O(m log n) Cas Cas

//0 MST Algorthms: Thory Dtrmnstc comparson basd algorthms. O(m log n) [Jarník, Prm, Dkstra, Kruskal, Boruvka] O(m log log n). [Chrton-Taran, Yao ] O(m β(m, n)). [Frdman-Taran ] O(m log β(m, n)). [Gabow-Gall-Spncr-Taran ] O(m α (m, n)). [Chazll 000] Holy gral. O(m). Notabl. O(m) randomzd. [Kargr-Kln-Taran ] O(m) vrcaton. [Dxon-Rauch-Taran ] Eucldan. -d: O(n log n). k-d: O(k n ). comput MST o dgs n Dlaunay dns Prm 0