CMSC 451: Interval Scheduling

Similar documents
Near Optimal Solutions

each college c i C has a capacity q i - the maximum number of students it will admit

Topic: Greedy Approximations: Set Cover and Min Makespan Date: 1/30/06

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

5.1 Bipartite Matching

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

CS311H. Prof: Peter Stone. Department of Computer Science The University of Texas at Austin

Network Flow I. Lecture Overview The Network Flow Problem

CSC2420 Spring 2015: Lecture 3

Full and Complete Binary Trees

Graphs without proper subgraphs of minimum degree 3 and short cycles

Find-The-Number. 1 Find-The-Number With Comps

Minimizing Probing Cost and Achieving Identifiability in Probe Based Network Link Monitoring

Algorithm Design and Analysis

Scheduling Shop Scheduling. Tim Nieberg

Solutions to Homework 6

MapReduce and Distributed Data Analysis. Sergei Vassilvitskii Google Research

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

Introduction to Scheduling Theory

Every tree contains a large induced subgraph with all degrees odd

Lecture 16 : Relations and Functions DRAFT

Large induced subgraphs with all degrees odd

Today s topic: So far, we have talked about. Question. Task models

Exponential time algorithms for graph coloring

Lecture 17 : Equivalence and Order Relations DRAFT

Analysis of Algorithms, I

Social Media Mining. Graph Essentials

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

Approximation Algorithms

Reading 13 : Finite State Automata and Regular Expressions

Online Supplement for Maximizing throughput in zero-buffer tandem lines with dedicated and flexible servers by Mohammad H. Yarmand and Douglas G.

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

Midterm Practice Problems

Diversity Coloring for Distributed Data Storage in Networks 1

Lecture 11: Sponsored search

Network (Tree) Topology Inference Based on Prüfer Sequence

136 CHAPTER 4. INDUCTION, GRAPHS AND TREES

Efficient Fault-Tolerant Infrastructure for Cloud Computing

Definition Given a graph G on n vertices, we define the following quantities:

Single machine parallel batch scheduling with unbounded capacity

On the k-path cover problem for cacti

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

Triangle deletion. Ernie Croot. February 3, 2010

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

Network File Storage with Graceful Performance Degradation

CSE 4351/5351 Notes 7: Task Scheduling & Load Balancing

Chapter Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

Lecture 1: Course overview, circuits, and formulas

Chapter 1 Section 4: Compound Linear Inequalities

CMPSCI611: Approximating MAX-CUT Lecture 20

Dynamic Programming. Lecture Overview Introduction

Offline sorting buffers on Line

An Innocent Investigation

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS. Received December May 12, 2003; revised February 5, 2004

Improved Algorithms for Data Migration

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new GAP (2) Graph Accessibility Problem (GAP) (1)

Aperiodic Task Scheduling

1 Introduction. Dr. T. Srinivas Department of Mathematics Kakatiya University Warangal , AP, INDIA

Online Adwords Allocation

Tutorial 8. NP-Complete Problems

GRAPH THEORY LECTURE 4: TREES

Randomized algorithms

Lecture 6 Online and streaming algorithms for clustering

1 Approximating Set Cover

Small Maximal Independent Sets and Faster Exact Graph Coloring

On the Unique Games Conjecture

Answer: (a) Since we cannot repeat men on the committee, and the order we select them in does not matter, ( )

Lecture 4 Online and streaming algorithms for clustering

Single machine models: Maximum Lateness -12- Approximation ratio for EDD for problem 1 r j,d j < 0 L max. structure of a schedule Q...

GCDs and Relatively Prime Numbers! CSCI 2824, Fall 2014!

Graph Theory Problems and Solutions

CMSC 858T: Randomized Algorithms Spring 2003 Handout 8: The Local Lemma

Section IV.1: Recursive Algorithms and Recursion Trees

CS 598CSC: Combinatorial Optimization Lecture date: 2/4/2010

Linear functions Increasing Linear Functions. Decreasing Linear Functions

CS473 - Algorithms I

Why? A central concept in Computer Science. Algorithms are ubiquitous.

ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015

Satisfiability Checking

Scheduling Single Machine Scheduling. Tim Nieberg

Data Structures and Algorithms Written Examination

An Empirical Study of Two MIS Algorithms

Class Notes CS Creating and Using a Huffman Code. Ref: Weiss, page 433

Distributed Load Balancing for Machines Fully Heterogeneous

Graphing Parabolas With Microsoft Excel

Introduction to Graph Theory

Tenacity and rupture degree of permutation graphs of complete bipartite graphs

Guessing Game: NP-Complete?

Follow the Perturbed Leader

The Minimum Consistent Subset Cover Problem and its Applications in Data Mining

Data Structures. Chapter 8

Problem Set 7 Solutions

Classification - Examples

Transcription:

CMSC 451: Interval Scheduling Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Section 4.1 of Algorithm Design by Kleinberg & Tardos.

Interval Scheduling You want to schedule jobs on a supercomputer. Requests take the form (s i, f i ) meaning a job that runs from time s i to time f i. You get many such requests, and you want to process as many as possible, but the computer can only work on one job at a time. Interval Scheduling Given a set J = {(s i, f i ) : i = 1,..., n} of job intervals, find the largest S J such that no two intervals in S overlap.

Greedy Algorithm Greedy Algorithms Not easy to define what we mean by greedy algorithm Generally means we take little steps, looking only at our local choices Often among the first reasonable algorithms we can think of Frequently doesn t lead to optimal solutions, but sometimes it does.

Example Greedy Algorithms TreeGrowing is an example of a greedy framework for most choices of nextedge functions. Topological sort & testing bipartiteness were greedy algorithms Interval Scheduling turns out to have a nice greedy algorithm that works.

Ideas for Interval Scheduling A greedy framework: S = set of input intervals (s i, f i) While S is not empty: q = nextinterval(s) Output interval q Remove intervals that overlap with q from S What are possible rules for nextinterval?

Ideas for Interval Scheduling What are possible rules for nextinterval? 1 Choose the interval that starts earliest. Rationale: start using the resource as soon as possible. 2 Choose the smallest interval. Rationale: try to fit in lots of small jobs. 3 Choose the interval that overlaps with the fewest remaining intervals. Rationale: keep our options open and eliminate as few intervals as possible.

Rules That Don t Work 1 Earliest start time 2 Shortest job 3 Fewest conflicts

Rules That Don t Work 1 Earliest start time 1 2 Shortest job 3 Fewest conflicts

Rules That Don t Work 1 Earliest start time 1 2 Shortest job 1 3 Fewest conflicts

Rules That Don t Work 1 Earliest start time 1 2 Shortest job 1 3 Fewest conflicts 2 3 1

Optimal Greedy Algorithm Choose the interval with the earliest finishing time. Rationale: ensure we have as much of the resource left as possible. S = set of input intervals {(s[i], f[i])} While S is not empty: q = a request in S that has the soonest finishing time Output interval q Remove intervals that overlap with q from S This algorithm chooses a compatible set of intervals.

How to Prove Optimality How can we prove the schedule returned is optimal? Let A be the schedule returned by this algorithm. Let OPT be some optimal solution. Might be hard to show that A = OPT, instead we need only to show that A = OPT. Note the distinction: instead of proving directly that a choice of intervals A is the same as an optimal choice, we prove that it has the same number of intervals as an optimal. Therefore, it is optimal.

Notation Let these be the schedules of A and OPT : A: i 1, i 2,..., i k OPT: j 1, j 2,..., j m Let f (i) be the finishing time of job i. Theorem For all r k we have f (i r ) f (j r ). Proof. By induction. True when r = 1 because we chose greedily. Assume f (i r 1 ) f (j r 1 ). Then we have f (i r 1 ) f (j r 1 ) s(j r ), where s(j r ) is the start time of job j r. So, job j r is available when the greedy algorithm makes its choice. Hence, f (i r ) f (j r ).

Greedy is Optimal Theorem This greedy algorithm is optimal for Interval Scheduling. Proof. Suppose not. Then if A has k jobs, OPT has m > k jobs. By our lemma, after k jobs we have this situation: i k j k+1 j k j k+1 So, job j k+1 must have been available to the greedy algorithm.

Implementation 1 Sort the intervals based on f i takes O(n log n). 2 Scan down this list, output the first element that starts after the finishing time of the last item output takes O(n). increasing finishing time f 1 f 2 f 3 f 4 f 5 f 5 f 6 f 7 s 1 s 2 s 3 s 4 s 5 s 5 s 6 s 7 LatestFinishingTime = finishing time of last scheduled interval

Extensions Online algorithms: What if you don t know all the intervals at the start? Current active area of research. What if some intervals are more important than others? Weighted interval scheduling. We ll see this later.

Interval Partitioning Problem Other rules of scheduling intervals also lead to nice greedy algorithms. For example: Interval Partitioning Problem

Interval Partitioning Problem Interval Partitioning Problem Given intervals (s i, f i ) assign them to processors so that you schedule every interval and use the smallest # of processors. Now, we re trying to minimize the # of processors (or rooms) used. Another way to think of it: Each processor corresponds to a color. We re trying to color intervals with the fewest # of colors so that no two overlapping intervals get the same color.

Interval Partitioning Problem Definition Depth is the maximum number of intervals passing over any time point. Theorem The number of processors needed is at least the depth of the set of intervals. depth = 3

We need at least depth processors. Can we find a schedule with no more than depth processors?

Greedy Alg for Interval Partitioning Yes: Let {1,..., d} be a set of labels, where d = depth. Sort intervals by start time For j = 1,2,3,...,n Let Q = set of labels that haven t been assigned to a preceding interval that overlaps Ij If Q is not empty, Pick any label from Q and assign it to Ij Else Leave Ij unlabeled Endfor

Every interval gets a label No overlapping intervals get the same label because we exclude the labels that have already been used. Every interval gets a label: The only way it wouldn t is if we ve run out of labels. That would mean, when coloring interval I that d intervals with start times before I overlap I : I d So, when coloring i, there must be a color free.

Graph Coloring Graph Coloring Given a graph G and a number k, color the nodes with k colors such that no edge connects 2 vertices of the same color (or report that it can t be done).

Graph Coloring Graph Coloring Given a graph G and a number k, color the nodes with k colors such that no edge connects 2 vertices of the same color (or report that it can t be done).

Interval Graph Coloring When k 3, Graph Coloring is hard in general. We saw an algorithm for Graph Coloring when k = 2. Interval Graph Coloring Given a graph G derived from a set of intervals and a number k, color the nodes with k colors such that no edge connects 2 vertices of the same color (or report that it can t be done). Now we ve seen an algorithm for solving Graph Coloring on the restricted class of graphs called Interval Graphs.