csci 3160 design and analysis of algorithms tutorial 12 chengyu lin
TRANSCRIPT
![Page 1: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/1.jpg)
CSCI 3160 Design and Analysis of Algorithms
Tutorial 12
Chengyu Lin
![Page 2: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/2.jpg)
Outline
• Online Algorithm
• Competitive Analysis
• Primal-Dual Method
![Page 3: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/3.jpg)
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](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/4.jpg)
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](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/5.jpg)
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](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/6.jpg)
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](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/7.jpg)
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](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/8.jpg)
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](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/9.jpg)
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](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/10.jpg)
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](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/11.jpg)
Competitive ratio
• Combine together, competitive ratio
![Page 12: CSCI 3160 Design and Analysis of Algorithms Tutorial 12 Chengyu Lin](https://reader036.vdocument.in/reader036/viewer/2022082817/56649da95503460f94a96c66/html5/thumbnails/12.jpg)
End
• Questions?