0% found this document useful (0 votes)
21 views4 pages

Greedy Algorithms: A Scheduling Application: Correctness Proof Part I

The document provides part of a proof that an algorithm that orders jobs by decreasing ratios of weight to length is always correct. It assumes the ratios are distinct, and that the greedy schedule orders the jobs 1, 2, 3, etc. It then assumes the optimal schedule is different and has consecutive jobs out of order, and considers exchanging those jobs to get an even better schedule.

Uploaded by

sirj0_hn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views4 pages

Greedy Algorithms: A Scheduling Application: Correctness Proof Part I

The document provides part of a proof that an algorithm that orders jobs by decreasing ratios of weight to length is always correct. It assumes the ratios are distinct, and that the greedy schedule orders the jobs 1, 2, 3, etc. It then assumes the optimal schedule is different and has consecutive jobs out of order, and considers exchanging those jobs to get an even better schedule.

Uploaded by

sirj0_hn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Greedy Algorithms

A Scheduling Application:
Correctness Proof Part I
Algorithms: Design
and Analysis, Part II
Correctness Claim
Claim: Algorithm #2 (order jobs according to decreasing ratios
wj /lj ) is always correct.

Proof: By an Exchange Argument.

Plan: Fix arbitrary input of n jobs. Will proceed by contradiction.


Let σ = greedy schedule, σ ∗ = optimal schedule. (With σ ∗ better
than σ.)
Will produce schedule even better than σ ∗ , contradicting purported
optimality of σ ∗ .

Tim Roughgarden
Correctness Proof
Assume: All wj /lj ’s distinct.

Assume: [Just by renaming jobs] w1 /l1 > w2 /l2 > . . . > wn /ln .

Thus: Greedy schedule σ is just 1, 2, 3, . . . , n.

Thus: If optimal schedule σ ∗ 6= σ, then there are consecutive jobs


i, j with i > j.
[Only schedule where indices always go up is 1, 2, 3, . . . , n]

Tim Roughgarden
Correctness Proof (con’d)
So far:
1. w1 /l1 > w2 /l2 > . . . > wn /ln
2. In optimal σ ∗ , ∃ consecutive jobs i, j with i > j.

Thought experiment: Suppose we exchange order of i&j in σ ∗


(leaving other jobs unchanged):
more more
stuff stuff
j i
i >j exchange i, j →
i j

stuff stuff
σ∗ new schedule

Tim Roughgarden

You might also like