Download presentation
Published byBrenda Taylor Modified over 9 years ago
1
CSCI 3160 Design and Analysis of Algorithms Tutorial 12
Chengyu Lin
2
Outline Online Algorithm Competitive Analysis Primal-Dual Method
3
Online vs. Offline Each round part of the input is revealed
Make irrevocable decision each round Example: Secretary Problem
4
Applications Real-world problems (secretary problem)
Streaming Algorithm (memory limited computation, big data) Online Machine Learning
5
Competitive Analysis Competitive Ratio β quantifies how good an online algorithm is. (Like approximation ratio) π΄πΏπΊ : Output of online algorithm πππ : Output of the optimal offline algorithm Competitive ratio πΌ=max π΄πΏπΊ πππ , πππ π΄πΏπΊ
6
Ski rental problem π rounds with unknown π Each rounds you can decide
Rent a ski : cost 1 Buy a ski : cost π΅ Optimal cost: min π, π΅
7
Primal-Dual Method Primal: Dual: π₯ : the βprobabilityβ of buying a ski
min π΅β
π₯+ π=1 π π§ π π .π‘. π₯+ π§ π β₯1, βπβ π π₯β₯0, π§ π β₯0, βπβ π Dual: max π=1 π π¦ π π .π‘. π=1 π π¦ π β€π΅ βπ π¦ π β[0,1] βπ π₯ : the βprobabilityβ of buying a ski π§ π : the βprobabilityβ of renting a ski at π-th round π¦ π : helping make decision
8
Primal-Dual Method Explore a solution (π,π) which is feasible for primal and dual, respectively. π : algorithmβs output π : a lower bound of the optimal solution (recall the weak duality theorem) Complementary slackness for optimal: π₯ π΅β π=1 π π¦ π =0 π§ π 1β π¦ π =0
9
Primal-Dual Algorithm
π₯=0, π¦ π =0 for each new π=1,2,β¦,π if π₯< π₯βπ₯+ π₯ π΅ + 1 ππ΅ , where π= π΅ π΅ β π§ π =1βπ₯ π¦ π =1 Intuitively, at π-th round, we rent with probability π§ π
10
Primal-Dual Algorithm
Pick πΌβ[0,1] uniformly at random. Suppose π‘ is the first day that π=1 π‘ π₯ π β₯πΌ, then rent in all days before π‘ and buy on day π‘. Facts: Rental probability : 1β π=1 πβ1 π₯ π = π§ π Buying probability: π=1 π‘ π₯ π =π₯
11
Competitive ratio ππ’ππ πππ β€ππ’ππ πππ‘β€ππππππ πππ‘=πππ
ππππππ πππ β€(1+ 1 π )ππ’ππ πππ Combine together, competitive ratio β€ π πβ1
12
End Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.