CSE 101 Algorithm Design and Analysis Sanjoy Dasgupta, Russell - - PDF document

β–Ά
cse 101
SMART_READER_LITE
LIVE PREVIEW

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 1

Algorithm Design and Analysis Sanjoy Dasgupta, Russell Impagliazzo, and Ragesh Jaiswal (with input from Miles Jones) Lecture 15: Another Scheduling Problem

CSE 101

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?

EVENT SCHEDULING WITH MULTIPLE ROOMS

slide-2
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
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
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
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
SLIDE 6

Β‘ 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(𝑃𝑇).

CONCLUSION: GREEDY IS OPTIMAL

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.

ACHIEVES-THE-BOUND