Online Algorithm - The Secretary Problem
Online Algorithm - The Secretary Problem
Presented by:
TigerHATS
www.tigerhats.org
Monzur Morshed
Online Algorithm
An online algorithm is a strategy . - that can process its input piece-by-piece in a serial fashion - decides what to do based only on past information and with no (or inexact) knowledge about the future.
Online algorithm
An Online algorithm responds to a sequence of service requests, each an associated cost. If an algorithm is given the entire sequence of service requests in advance, it is said to be an offline algorithm. We often employ a competitive analysis to analyze an online algorithm.
Secretary problem K-server problem Greedy algorithm Adversary Model Job shop scheduling List update problem Metrical task systems Odds algorithm Paging Problem Real-time computing Ski rental problem Linear search problem Search games Algorithms for calculating variance Bandit problem Ukkonen's algorithm
Methods of Analysis
Pros: can make very robust statements about the performance of a strategy. Cons: results tend to be pessimistic.
Methods of Analysis
Probabilistic Analysis
Assume a distribution generating the input. Find an algorithm which minimizes the
expected cost of the algorithm.
Pros: can incorporate information predicting the future. Cons: can be difficult to determine probability distributions accurately.
Competitive Analysis
Rules of the game: There is a single secretarial position to fill. There are n applicants for the position, n is known. The applicants can be ranked from best to worst with no ties. The applicants are interviewed sequentially in a random order, with each order being equally likely. After each interview, the applicant is accepted or rejected. The decision to accept or reject an applicant can be based only on the relative ranks of the applicants interviewed so far. Rejected applicants cannot be recalled. The object is to select the best applicant. Win: If you select the best applicant. Lose: otherwise Note: An applicant should be accepted only if it is relatively best among those already observed
A relatively best applicant is called a candidate Reward Function yj(x1,,xn) = j/n if applicant j is a candidate, = 0 otherwise Lets say the interviewer rejects the first r-1 applicants and then accept the next relatively best applicant. We wish to find the optimal r
Algorithm:
Observe first n/e elements. Let v=maximum. Pick the next element whose value is > v.
Theorem: Pr(picking max elt. of S) > 1/e.* Proof: Select best elt. if ith best elt is best in first 1/e elts and best elt is first among best (i-1) elts.
2nd best through (i-1)st best ith best best Threshold time t = n/e time t = n
Input Set of secretaries {1, , n}, each has a value vi Feasible or independent family of subsets of {1, , n} Secretaries arrive in random order, and alg. must decide online whether to select each secretary Goal is to select maximum weight feasible set
Performance measure is competitive ratio: E[weight of selected set]/[weight of max ind. set]
The optimal strategy is appealingly simple: Interview the first applicants without making any hiring decisions, then hire the next applicant whose quality exceeds the best of the first m. If you reach the end of the sequence without hiring anyone, then hire the last applicant no matter what.
n = P ( k th applicant is best) P ( k th applicant is selected | it is best) k =r n 1 = P ( best of first k - 1 appears before stage r ) k =r n n 1 r 1 r 1 n 1 = = n k = r k 1 k = r n k 1
** (r-1)/(r-1) = 1 if r = 1
For optimal r,
Pr +1 Pr r n 1 r 1 n 1 n r +1 k 1 n r k 1
r +1 n
1 1 k 1
r* = min{r 1 :
n r* P 1 1 2 1 3 2 4 2 5 3
1 1} r +1 k 1
6 3 7 3 8 4 9 4
1.000 0.500
Thank you