Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 3160 Design and Analysis of Algorithms Tutorial 12

Similar presentations


Presentation on theme: "CSCI 3160 Design and Analysis of Algorithms Tutorial 12"β€” Presentation transcript:

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?


Download ppt "CSCI 3160 Design and Analysis of Algorithms Tutorial 12"

Similar presentations


Ads by Google