12
CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

Embed Size (px)

Citation preview

Page 1: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

CSCI 3160 Design and Analysis of Algorithms

Tutorial 12

Chengyu Lin

Page 2: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

Outline

• Online Algorithm

• Competitive Analysis

• Primal-Dual Method

Page 3: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

Online vs. Offline

• Each round part of the input is revealed

• Make irrevocable decision each round

• Example: Secretary Problem

Page 4: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

Applications

• Real-world problems (secretary problem)

• Streaming Algorithm (memory limited computation, big data)

• Online Machine Learning

Page 5: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

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

Page 6: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

Ski rental problem

• rounds with unknown

• Each rounds you can decide– Rent a ski : cost 1– Buy a ski : cost

• Optimal cost:

Page 7: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

Primal-Dual Method

Primal: Dual:

: the ‘probability’ of buying a ski: the ‘probability’ of renting a ski at -th round: helping make decision

Page 8: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

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:

Page 9: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

Primal-Dual Algorithm

•for each new if , where

• Intuitively, at -th round, we rent with probability

Page 10: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

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:

Page 11: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

Competitive ratio

• Combine together, competitive ratio

Page 12: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin

End

• Questions?