Algorithm Design and Analysis Sanjoy Dasgupta, Russell Impagliazzo, and Ragesh Jaiswal (with input from Miles Jones) Lecture 15: Another Scheduling Problem
CSE 101 Algorithm Design and Analysis Sanjoy Dasgupta, Russell - - PDF document
CSE 101 Algorithm Design and Analysis Sanjoy Dasgupta, Russell - - PDF document
CSE 101 Algorithm Design and Analysis Sanjoy Dasgupta, Russell Impagliazzo, and Ragesh Jaiswal (with input from Miles Jones) Lecture 15: Another Scheduling Problem EVENT SCHEDULING WITH MULTIPLE ROOMS Suppose you have a conference to plan with
SLIDE 1
SLIDE 2
Suppose you have a conference to plan with π events and you have an unlimited supply of rooms. How can you assign events to rooms in such a way as to minimize the number of rooms? Ideas for a greedy algorithm?
EVENT SCHEDULING WITH MULTIPLE ROOMS EVENT SCHEDULING
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
SLIDE 3
Suppose you have a conference to plan with π events and you have an unlimited supply of rooms. How can you assign events to rooms in such a way as to minimize the number of rooms? Β‘ Greedy choice:
Β§ Number each room from 1 to π. Β§ Sort the events by earliest start time. Β§ Put the first event in room 1. Β§ For events 2β¦π, put each event in the smallest numbered room that is available.
EVENT SCHEDULING WITH MULTIPLE ROOMS
Some general methods to prove optimality: Β§ Modify-the-solution, aka Exchange: most general Β§ Greedy-stays-ahead: often the most intuitive Β§ Greedy-achieves-the-bound: also used in approximation, LP, network flow Β§ Unique-local-optimum: dangerously close to a common fallacy Which one to use is up to you.
TECHNIQUES TO PROVE OPTIMALITY
SLIDE 4
- 1. Logically determine a bound on the value of the solution that must
be satisfied by any valid answer.
- 2. Then show that the greedy strategy achieves this bound and
therefore is optimal.
ACHIEVES-THE-BOUND
Β‘ Let π’ be any time during the conference. Β‘ Let πΆ(π’) be the set of events taking place at time π’. Bounding Lemma: Any valid schedule requires at least |πΆ π’ | rooms. Proof: There are |πΆ π’ | events taking place at time π’. They all need to be in different rooms. So we need at least |πΆ π’ | rooms. Β‘ Let π = πππ¦ |πΆ π’ |
- ver all t.
Β‘ Then π is a lower bound on the number of rooms needed.
ACHIEVES-THE-BOUND
SLIDE 5
EVENT SCHEDULING
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Achieves-the-Bound Lemma: Let π be the number of rooms picked by the greedy algorithm. Then at some point π’, πΆ π’ β₯ π. In other words there are at least π events happening at time π’. Proof: Let π’ be the starting time of the first event to be scheduled in room π. Then by the greedy choice, room π was the least number room available at that time. This means at time π’, there was an event happening in rooms room 1, room 2, β¦, room π β 1. And plus an event happening in room π Therefore πΆ π’ β₯ π.
ACHIEVES-THE-BOUND
SLIDE 6