Upload
brenda-taylor
View
213
Download
0
Embed Size (px)
Citation preview
CSCI 3160 Design and Analysis of Algorithms
Tutorial 12
Chengyu Lin
Outline
• Online Algorithm
• Competitive Analysis
• Primal-Dual Method
Online vs. Offline
• Each round part of the input is revealed
• Make irrevocable decision each round
• Example: Secretary Problem
Applications
• Real-world problems (secretary problem)
• Streaming Algorithm (memory limited computation, big data)
• Online Machine Learning
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
Ski rental problem
• rounds with unknown
• Each rounds you can decide– Rent a ski : cost 1– Buy a ski : cost
• Optimal cost:
Primal-Dual Method
Primal: Dual:
: the ‘probability’ of buying a ski: the ‘probability’ of renting a ski at -th round: helping make decision
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:
Primal-Dual Algorithm
•for each new if , where
• Intuitively, at -th round, we rent with probability
Primal-Dual Algorithm
• Pick uniformly at random.• Suppose is the first day that , then rent in all
days before and buy on day .
• Facts:– Rental probability : – Buying probability:
Competitive ratio
• Combine together, competitive ratio
End
• Questions?