CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

Similar documents
CSE 421 Greedy Algorithms / Interval Scheduling

Algorithm Design and Analysis

CS 374: Algorithms & Models of Computation, Spring 2017 Greedy Algorithms Lecture 19 April 4, 2017 Chandra Chekuri (UIUC) CS374 1 Spring / 1

Greedy Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 10

Greedy Algorithms. Kleinberg and Tardos, Chapter 4

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Greedy Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 9

Simple Dispatch Rules

Algorithm Design and Analysis

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

CSE 417. Chapter 4: Greedy Algorithms. Many Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

CMSC 451: Lecture 7 Greedy Algorithms for Scheduling Tuesday, Sep 19, 2017

Proof methods and greedy algorithms

Algorithm Design Strategies V

CS 6901 (Applied Algorithms) Lecture 3

Greedy Algorithms My T. UF

Lecture 6: Greedy Algorithms I

Dynamic Programming( Weighted Interval Scheduling)

1 Basic Definitions. 2 Proof By Contradiction. 3 Exchange Argument

CSE 421 Dynamic Programming

Minimizing the Number of Tardy Jobs

Algorithms: COMP3121/3821/9101/9801

CS 161: Design and Analysis of Algorithms

Design and Analysis of Algorithms

Approximation Algorithms (Load Balancing)

CS 580: Algorithm Design and Analysis

This means that we can assume each list ) is

Recoverable Robustness in Scheduling Problems

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

CS 6783 (Applied Algorithms) Lecture 3

Matroids. Start with a set of objects, for example: E={ 1, 2, 3, 4, 5 }

Knapsack and Scheduling Problems. The Greedy Method

Scheduling Online Algorithms. Tim Nieberg

Coin Changing: Give change using the least number of coins. Greedy Method (Chapter 10.1) Attempt to construct an optimal solution in stages.

Embedded Systems 15. REVIEW: Aperiodic scheduling. C i J i 0 a i s i f i d i

Embedded Systems 14. Overview of embedded systems design

APTAS for Bin Packing

CS60007 Algorithm Design and Analysis 2018 Assignment 1

K-center Hardness and Max-Coverage (Greedy)

More Approximation Algorithms

Activity selection. Goal: Select the largest possible set of nonoverlapping (mutually compatible) activities.

EECS 477: Introduction to algorithms. Lecture 12

A lower bound for scheduling of unit jobs with immediate decision on parallel machines

CS 580: Algorithm Design and Analysis

Greedy Homework Problems

CMPSCI611: The Matroid Theorem Lecture 5

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

Dynamic Programming: Interval Scheduling and Knapsack

(a) Write a greedy O(n log n) algorithm that, on input S, returns a covering subset C of minimum size.

Lecture 2: Scheduling on Parallel Machines

The Greedy Method. Design and analysis of algorithms Cs The Greedy Method

CSE 421 Weighted Interval Scheduling, Knapsack, RNA Secondary Structure

1 Some loose ends from last time

Lecture 2: Divide and conquer and Dynamic programming

CS 561, Lecture: Greedy Algorithms. Jared Saia University of New Mexico

Dynamic Programming. Cormen et. al. IV 15

Today s Outline. CS 561, Lecture 15. Greedy Algorithms. Activity Selection. Greedy Algorithm Intro Activity Selection Knapsack

1 Ordinary Load Balancing

Weighted Activity Selection

Approximation Algorithms for scheduling

Recap & Interval Scheduling

Outline / Reading. Greedy Method as a fundamental algorithm design technique

4. How to prove a problem is NPC

Exercises Solutions. Automation IEA, LTH. Chapter 2 Manufacturing and process systems. Chapter 5 Discrete manufacturing problems

Single Machine Models

Scheduling Lecture 1: Scheduling on One Machine

6. DYNAMIC PROGRAMMING I

CSEP 521 Applied Algorithms. Richard Anderson Winter 2013 Lecture 1

CS325: Analysis of Algorithms, Fall Final Exam

University of Twente. Faculty of Mathematical Sciences. Scheduling split-jobs on parallel machines. University for Technical and Social Sciences

Single Machine Problems Polynomial Cases

Algorithms Exam TIN093 /DIT602

the tree till a class assignment is reached

Do not turn this page until you have received the signal to start. Please fill out the identification section above. Good Luck!

Machine Minimization for Scheduling Jobs with Interval Constraints

More on NP and Reductions

RCPSP Single Machine Problems

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Algorithms Design & Analysis. Approximation Algorithm

Partition is reducible to P2 C max. c. P2 Pj = 1, prec Cmax is solvable in polynomial time. P Pj = 1, prec Cmax is NP-hard

Analysis of Algorithms - Midterm (Solutions)

Online Scheduling of Parallel Jobs on Two Machines is 2-Competitive

How much can lookahead help in online single machine scheduling

SINGLE MACHINE SEQUENCING Part 2. ISE480 Sequencing and Scheduling Fall semestre

Bipartite Matchings. Andreas Klappenecker

6.2 Deeper Properties of Continuous Functions

Aperiodic Task Scheduling

Scheduling Lecture 1: Scheduling on One Machine

ECS122A Handout on NP-Completeness March 12, 2018

JOB SEQUENCING WITH DEADLINES

Combinatorial Structure of Single machine rescheduling problem

CS583 Lecture 11. Many slides here are based on D. Luebke slides. Review: Dynamic Programming

CS781 Lecture 3 January 27, 2011

LPT rule: Whenever a machine becomes free for assignment, assign that job whose. processing time is the largest among those jobs not yet assigned.

Guaranteeing Solution Quality for SAS Optimization Problems by being Greedy

CS481: Bioinformatics Algorithms

DAA Unit- II Greedy and Dynamic Programming. By Mrs. B.A. Khivsara Asst. Professor Department of Computer Engineering SNJB s KBJ COE, Chandwad

Online Interval Coloring and Variants

Networked Embedded Systems WS 2016/17

Matching Residents to Hospitals

Transcription:

Course Overview Material that will be covered in the course: Basic graph algorithms Algorithm Design Techniques Greedy Algorithms Divide and Conquer Dynamic Programming Network Flows Computational intractability

Introduction A local (greedy) decision rule leads to a globally optimal solution. There are two ways to show the above property: Greedy stays ahead Exchange argument

Problem : Given a set of n intervals of the form (S(i), F (i)), find the largest subset of non-overlapping intervals.

Problem : Given a set of n intervals of the form (S(i), F (i)), find the largest subset of non-overlapping intervals. Candidate greedy choices: Earliest start time Smallest duration Least overlapping

Problem : Given a set of n intervals of the form (S(i), F (i)), find the largest subset of non-overlapping intervals. Candidate greedy choices: Earliest start time Smallest duration Least overlapping Earliest finish time

Problem : Given a set of n intervals of the form (S(i), F (i)), find the largest subset of non-overlapping intervals. Algorithm GreedySchedule - Initialize R to contain all intervals - While R is not empty - Choose an interval (S(i), F (i)) from R that has the smallest value of F (i) - Delete all intervals in R that overlaps with (S(i), F (i))

Problem : Given a set of n intervals of the form (S(i), F (i)), find the largest subset of non-overlapping intervals. Algorithm GreedySchedule - Initialize R to contain all intervals - While R is not empty - Choose an interval (S(i), F (i)) from R that has the smallest value of F (i) - Delete all intervals in R that overlaps with (S(i), F (i)) Question: Let O denote some optimal subset and A be the subset given by GreedySchedule. Can we show that A = O?

Question: Let O denote some optimal subset and A be the subset given by GreedySchedule. Can we show that A = O? Question Can we show that O = A?

Question: Let O denote some optimal subset and A be the subset given by GreedySchedule. Can we show that A = O? Question Can we show that O = A? Yes we can! We will use greedy stays ahead method to show this. Proof sketch Let a 1, a 2,..., a k be the sequence of requests that GreedySchedule picks and o 1, o 2,..., o l be the requests in O sorted in non-decreasing order by finishing time. Claim 1: F (a 1 ) F (o 1 ).

Question: Let O denote some optimal subset and A be the subset given by GreedySchedule. Can we show that A = O? Question Can we show that O = A? Yes we can! We will use greedy stays ahead method to show this. Proof sketch Let a 1, a 2,..., a k be the sequence of requests that GreedySchedule picks and o 1, o 2,..., o l be the requests in O sorted in non-decreasing order by finishing time. Claim 1: F (a 1 ) F (o 1 ). Claim 2: If F (a 1 ) F (o 1 ), F (a 2 ) F (o 2 ),..., F (a i 1 ) F (o i 1 ), then F (a i ) F (o i ).

Question: Let O denote some optimal subset and A be the subset given by GreedySchedule. Can we show that A = O? Question Can we show that O = A? Yes we can! We will use greedy stays ahead method to show this. Proof sketch Let a 1, a 2,..., a k be the sequence of requests that GreedySchedule picks and o 1, o 2,..., o l be the requests in O sorted in non-decreasing order by finishing time. We will show by induction that i, F (a i ) F (o i ) Claim 1 (base case): F (a 1 ) F (o 1 ). Claim 2 (inductive step): If F (a 1 ) F (o 1 ), F (a 2 ) F (o 2 ),..., F (a i 1 ) F (o i 1 ), then F (a i ) F (o i ). GreedySchedule could not have stopped after a k.

Problem : Given a set of n intervals of the form (S(i), F (i)), find the largest subset of non-overlapping intervals. Algorithm GreedySchedule - Initialize R to contain all intervals - While R is not empty - Choose an interval (S(i), F (i)) from R that has the smallest value of F (i) - Delete all intervals in R that overlaps with (S(i), F (i)) Running time?

Problem : Given a set of n intervals of the form (S(i), F (i)), find the largest subset of non-overlapping intervals. Algorithm GreedySchedule - While R is not empty - Choose an interval (S(i), F (i)) from R that has the smallest value of F (i) - Delete all intervals in R that overlaps with (S(i), F (i)) Running time? O(n log n)

Job scheduling Problem Job scheduling: You are given n jobs and you are supposed to schedule these jobs on a machine. Each job i consists of a duration T (i) and a deadline D(i). The lateness of a job w.r.t. a schedule is defined as max(0, F (i) D(i)), where F (i) is the finishing time of job i as per the schedule. The goal is to minimise the maximum lateness.

Job scheduling Problem Job scheduling: You are given n jobs and you are supposed to schedule these jobs on a machine. Each job i consists of a duration T (i) and a deadline D(i). The lateness of a job w.r.t. a schedule is defined as max(0, F (i) D(i)), where F (i) is the finishing time of job i as per the schedule. The goal is to minimise the maximum lateness. Greedy strategies Smallest jobs first.

Job scheduling Problem Job scheduling: You are given n jobs and you are supposed to schedule these jobs on a machine. Each job i consists of a duration T (i) and a deadline D(i). The lateness of a job w.r.t. a schedule is defined as max(0, F (i) D(i)), where F (i) is the finishing time of job i as per the schedule. The goal is to minimise the maximum lateness. Greedy strategies Smallest jobs first. Earliest deadline first. Algorithm GreedyJobSchedule - Sort the jobs in non-decreasing order of deadlines and schedule the jobs on the machine in this order.

Job scheduling Algorithm GreedyJobSchedule - Sort the jobs in non-decreasing order of deadlines and schedule the jobs on the machine in this order. Claim 1: There is an optimal schedule with no idle time (time when the machine is idle). Definition A schedule is said to have inversion if there are a pair of jobs (i, j) such that 1 D(i) < D(j), and 2 Job j is performed before job i as per the schedule. Claim 2: There is an optimal schedule with no idle time and no inversion.

End