cse 101
play

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


  1. 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 π‘œ 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? Brute Force: Β‘ Certainly you won’t need more than π‘œ rooms. Β‘ So how many ways can you assign π‘œ events to π‘œ rooms?

  2. EVENT SCHEDULING WITH MULTIPLE ROOMS 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 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

  3. EVENT SCHEDULING WITH MULTIPLE ROOMS 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. TECHNIQUES TO PROVE OPTIMALITY 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.

  4. ACHIEVES-THE-BOUND 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 𝑀 = 𝑛𝑏𝑦 |𝐢 𝑒 | over all t. Β‘ Then 𝑀 is a lower bound on the number of rooms needed.

  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 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 𝐢 𝑒 β‰₯ 𝑙 .

  6. CONCLUSION: GREEDY IS OPTIMAL Β‘ Let 𝐻𝑇 be the greedy solution. Β‘ Let 𝑃𝑇 be any other schedule. Β‘ Let L = max |B(t)| over all t. Β‘ By the Bounding lemma, Cost( 𝑃𝑇 ) β‰₯ L. Β‘ By the achieves-the-bound lemma, Cost( 𝐻𝑇 ) = |B(t)| ≀ L for some t. Β‘ Putting the two together, Cost( 𝐻𝑇 ) ≀ Cost( 𝑃𝑇 ). ACHIEVES-THE-BOUND The way it works: Β‘ Argue that when the greedy solution reaches its peak cost , it reveals a bound . Β‘ Then show this bound is also a lower bound on the cost of any other solution. Β‘ So we are showing : Cost( 𝐻𝑇 ) ≀ Bound ≀ Cost ( 𝑃𝑇 ) This is a proof technique that does not work in all cases.

Recommend


More recommend