9/5/20 Outline • Background: What is an Online Problem? Maximizing Revenue for the • Analyzing Online Algorithms: Competitive Analysis • Online Dial a Ride Problem Online Dial-A-Ride Problem • Related Open Problems Ananya Das Christman Middlebury College 1 2 Classical Computer Science Problems Classical Computer Science Problems • Sorting • Sorting 24 19 5 12 3 1 14 82 80 24 19 5 12 3 1 14 82 80 All input known • Closest Points • Closest Points in advance – Offline Problems a 5 19 24 • Shortest Paths • Shortest Paths c b 12 3 3 4 d e 1 Classical Computer Science Problems Ski Rental Problem • Sorting 24 19 5 12 3 1 14 82 80 Online problem - • Closest Points input arrives over time a 5 19 24 • Shortest Paths c b 12 3 5 6 d e 1 1
9/5/20 Ski Rental Problem Ski Rental Problem 7 8 Ski Rental Problem Offline Ski Rental Problem Rent or Buy? • Ski resort – cheap but owner often shuts down in the middle of the season to go to Florida… • Cost to Rent: $ 1 /day, Cost to Buy: $ 10 • Input: d = number of days resort will stay open • Goal: Decide whether to Rent or Buy to achieve cheapest cost Alg-Check_d(input: d): if (d < 10) Rent (Cost = d) Optimal Algorithm else Buy (Cost = 10) 9 10 Online Ski Rental Problem Outline • Background: What is an Online Problem? Everyday for a ski season, you decide: • Analyzing Online Algorithms: Competitive Analysis Rent – or – Buy? • Online Dial a Ride Problem • Related Open Problems Input (# days open) arrives over time Need a “good” Online Algorithm 11 12 2
9/5/20 Optimistic Algorithm for Ski Rental Pessimistic Algorithm for Ski Rental Optimist-Alg: Worst input? Pessimist-Alg: Worst input? If open on first Ø Resort closes on Day 2 while (open): Ø Resort stays open all day: BUY RENT season Day 1 Day 2 … Day 90 Total Cost Day 1 Day 2 … Day 90 Total Cost Optimist-Alg (ON) $10 X X X $10 Pessimist-Alg (ON) $1 $1 $1 $1 $90 OPT $1 X X X $1 OPT $10 - - - $10 13 14 Cautious-Optimist for Ski Rental How to Analyze an Online Algorithm? • Compare its cost to the optimal offline cost, Cautious-Optimist: Pessimist-Alg: Worst input? given the worst possible input. while (open): Ø Resort closes on Day 5 For the first 3 RENT days: RENT If still open on day 4, BUY Day 1 Day 2 Day 3 Day 4 Day 5 … Day 90 Total Cost Cautious-Alg (ON) $1 $1 $1 $10 X X X $13 OPT $1 $1 $1 $1 X X X $4 15 16 Optimist Competitive Ratio How to Analyze an Online Algorithm? • Compare its cost to the optimal offline cost, Optimist-Alg: Worst input? given the worst possible input. If open on first Ø Resort closes on Day 2 day: BUY !"#$(&') competitive ratio • Compare using ratio: !"#$(&)*) !"#$(&') • If !"#$(&)*) ≤ , then ON is , -competitive Day 1 Day 2 … Day 90 Total Cost Optimist-Alg (ON) $10 X X X $10 OPT $1 X X X $1 Competitive Analysis !"#$(&)*) = 10 !"#$(&') 1 17 18 3
9/5/20 Pessimist Competitive Ratio Cautious-Optimist Competitive Ratio Pessimist-Alg: Worst input? Cautious-Optimist: Pessimist-Alg: Worst input? while (open): Ø Resort stays open all while (open): Ø Resort closes on Day 5 RENT For the first 3 RENT season days: RENT !"#$(&)*) = 13 !"#$(&') 4 = 3.25 If still open on Day 1 Day 2 … Day 90 Total Cost day 4, BUY Pessimist-Alg (ON) $1 $1 $1 $1 $90 OPT $10 - - - $10 Day 1 Day 2 Day 3 Day 4 Day 5 … Day Total 90 Cost !"#$(&)*) = 90 !"#$(&') Cautious-Alg (ON) $1 $1 $1 $10 X X X $13 OPT $1 $1 $1 $1 X X X $4 10 19 20 New-Cautious-Optimist Competitive Ratio Generalized Competitive Ratio New-Cautious-Optimist: Worst input? Generalized-Algorithm: For any ! : "#$%('() "#$%('*+) < 2 Ø Resort closes on Day 11 Let b = cost to buy skis For the first b-1 days, For the first 9 RENT days, RENT Worst input? !"#$(&)*) = 19 !"#$(&') Ø Resort closes on Day b+1 If open on the b th day, 10 = 1.9 If open on the 10 th BUY day, BUY Day 1 Day 2 … Day 9 Day 10 Day … Day Total 11 90 Cost Day Day … Day Day Day … Day Total Cost 1 2 b-1 b b+1 90 New-Cautious (ON) $1 $1 $1 $1 $10 X X - $19 Generalized (ON) $1 $1 $1 $1 $b X X X $(b-1) + b OPT $10 - - - - X X - $10 OPT $b - - - - X X X $b 21 22 Generalized Competitive Ratio Outline Day Day … Day Day Day … Day Total Cost • Background: What is an Online Problem? 1 2 b-1 b b+1 90 Generalized (ON) $1 $1 $1 $1 $b X X X $(b-1) + b • Analyzing Online Algorithms: Competitive Analysis OPT $b - - - - X X X $b • Online Dial a Ride Problem !"#$ %& = ( − 1 + ( = 2( − 1 • Related Open Problems !"#$ %-. = ( !"#$ %-. < 2 − 1 !"#$(%&) Best ratio for any online algorithm! ( (no other number of rental days yields a better ratio) 3 %& is: (2 − 4 – competitive 2 23 25 4
9/5/20 Offline Dial-A-Ride Online Dial-A-Ride driver destination-1 destination-1 source-1 source-1 Goal: Serve requests to revenue1 = $10 source-3 source-3 maximize total revenue revenue2 = $30 within time limit source-2 revenue3 = $50 source-2 Time Limit = 24 destination-2 destination-2 destination-3 destination-3 26 27 [ N. Wilson; Joint Automatic Control Conference, 1971] [N. Ascheuer, S. Krumke, and J. Rambau; STACS 2000] Applications OFFline vs ONline OFFline ~ “ Reservation Service”: Receives all requests in advance Source Destination Time Revenue Oak Street Airport 9am $15 Maple Ave Grocery 3pm $10 Pine Street Airport 12pm $5 2 nd Street Elm Rd. 2:30pm $50 1st Street Main Street 6:30pm $12 29 30 OFFline vs ONline OFFline vs ONline ONline ~ Uber : Receives each request only when it is released ONline ~ Uber : Receives each request only when it is released 5 min $12 Revenue = $15 Revenue = $15 32 33 5
9/5/20 OFFline vs ONline OFFline vs ONline ONline ~ Uber : Receives each request only when it is released ONline ~ Uber : Receives each request only when it is released 5 min 7 min 5 min 7 min 7 min $12 $17 $12 $17 $100 Revenue = $15 Revenue = $15 Accept Accept 34 35 Online-Dial-A-Ride Online-Dial-A-Ride with Revenue Input: Model with a complete weighted Graph • Complete Weighted Graph • Initial Location of Server (origin) a • Requests: (source, destination, release time, revenue) Node (Location) • Time Limit (T) Time Limit T = 24 origin Edge (Road) a c $11 b $20 Goal: Serve requests to Maximize Total Revenue c b within T d e $15 d e Offline version is NP-hard 1 $12 36 37 1. Christman, Chung, Jaczko, Westvold [ATMOS 2017] Worst Input? Segmented-Best-Path (SBP) Algorithm 1 1. Let max be the maximum edge weight in the graph. • Every request takes a long time to serve V 2. Split the total time T into T/max “segments”, (where max is the maximum edge max weight in the graph) each of length max. • After each request we serve, we have to move for a long time 3. While there is still time remaining: V Alternate between: max a) Find the request set with the highest a revenue that can be served within time max; MOVE let S denote this set. Move to the source of takes time Alternate between the first request in S. SERVE ≤ max c b moving and serving, each (Wait until the end of the time segment) $11 $20 for max time b) Serve the requests in set S. d e (Wait until the end of the time segment) 38 39 1. Christman, Chung, Jaczko, Li, Westvold, Xu, Yuen [IWOCA 2020] 6
9/5/20 SBP Example SBP Example origin origin t=0 a a Revenue earned = $11 4 4 4 4 1 1 c c t=6 b b 5 5 5 5 5 $11 5 $11 $10 $10 d e d e 2 2 t=12 MOVE MOVE T = 24, max = 6 T = 24, max = 6 SERVE SERVE 40 41 SBP Example SBP Example origin origin a a $11 $11 Revenue earned = $11 Revenue earned = $11 $6 $6 4 4 4 4 1 1 c c b b 5 5 5 5 5 5 $10 $10 d e d e t=18 2 2 t=12 MOVE MOVE T = 24, max = 6 T = 24, max = 6 SERVE SERVE 42 43 SBP Example SBP Example origin origin a a $11 $11 Revenue earned = $11 + $6 Revenue earned = $11 + $6 + $11 $6 $6 4 4 4 4 = $28 1 1 t=24 c c b b 5 5 5 5 5 5 $10 $10 d e d e 2 2 MOVE MOVE T = 24, max = 6 T = 24, max = 6 SERVE SERVE 44 45 7
Recommend
More recommend