19
Presented by: Monzur Morshed Tiger HATS www.tigerhats.org Online Algorithm The Secretary Problem

Online Algorithm - The Secretary Problem

Embed Size (px)

DESCRIPTION

This is an overview of The Secretary Problem which is an Online Algorithm.

Citation preview

Page 1: Online Algorithm - The Secretary Problem

Presented by:

Monzur Morshed

TigerHATSwww.tigerhats.org

Online Algorithm The Secretary Problem

Page 2: Online Algorithm - The Secretary Problem

The International Research group dedicated to Theories, Simulation and Modeling, New Approaches, Applications, Experiences, Development, Evaluations, Education, Human, Cultural and Industrial Technology

TigerHATS - Information is power

Page 3: Online Algorithm - The Secretary Problem

Online Algorithm

An online algorithm is a strategy …….

- that can process its input piece-by-piece in aserial fashion

- decides what to do based only on pastinformation and with no (or inexact) knowledgeabout the future.

Page 4: Online Algorithm - The Secretary Problem

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.

Page 5: Online Algorithm - The Secretary Problem

Application of Online AlgorithmResource Allocation

- Scheduling- Memory Management- Routing

Robot Motion Planning- Exploring an unknown terrain- Finding a destination

Computational Finance

Page 6: Online Algorithm - The Secretary Problem

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

List of Online Algorithms

Page 7: Online Algorithm - The Secretary Problem

Methods of Analysis

Competitive Analysis (Worst Case)• For any input, the cost of online algorithm is

never worse than c times the cost of the optimal offline algorithm.

Pros: can make very robust statements about the performance of a strategy.

Cons: results tend to be pessimistic.

Page 8: Online Algorithm - The Secretary Problem

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.

Page 9: Online Algorithm - The Secretary Problem

Competitive Analysis if knew whole input in advance, easy to

optimize

compare to full knowledge optimum

k-competitive if for all sequences :

σ

)(σMINC

Page 10: Online Algorithm - The Secretary Problem

The secretary problem is one of many namesfor a famous problem of the optimal stoppingtheory. The problem has been studiedextensively in the fields of applied probability,statistics, and decision theory.

It is also known as the marriage problem, thesultan's dowry problem, the fussy suitorproblem, the googol game, and the best choiceproblem.

The Secretary Problem

Page 11: Online Algorithm - The Secretary Problem

The Classical Secretary Problem (CSP) 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

Page 12: Online Algorithm - The Secretary Problem

CSP – Solution Framework 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

Page 13: Online Algorithm - The Secretary Problem

The Secretary Algorithm 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 i’th best elt is best in first 1/e elts and

best elt is first among best (i-1) elts.

Happens with probability (1/e) ¢ (1-1/e)i ¢ (1/i).* Elements come in a random order.

Threshold time t = n/e

time t = n

i’th best best2nd best through (i-1)st best

Page 14: Online Algorithm - The Secretary Problem

Generalized Secretary Problems 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]

Page 15: Online Algorithm - The Secretary Problem

The optimal strategy is appealingly simple: Interview the first

applicants without making any hiring decisions, then hire the nextapplicant whose quality exceeds the best of the first m. If you reach the endof the sequence without hiring anyone, then hire the last applicant nomatter what.

Page 16: Online Algorithm - The Secretary Problem

CSP – Solution Framework Cont.

∑=

∑= −

−=

−−

=

∑=

=

∑=

=

∑=

=

n

rk

n

rk knr

kr

n

rkrk - P

n

n

rkthkPthkP

n

rkthkPrP

111

11

n1

) stage before appears 1first ofbest (1

best) isit | selected isapplicant (best) isapplicant (

selected) andbest isapplicant (

Probability that the best applicant is selected is

** (r-1)/(r-1) = 1 if r = 1

Page 17: Online Algorithm - The Secretary Problem

CSP – Solution Framework Cont. For optimal r,

∑∑

+

+

+

≤−

−−

≤−

n

r

n

r

n

r

rr

k

knr

k

PP

1

1

1

11

11

111

1nr

∑+

≤−

≥=n

r krr

1}1

11:1min{*

n 1 2 3 4 5 6 7 8 9r* 1 1 2 2 3 3 3 4 4P 1.000 0.500 0.500 0.458 0.433 0.428 0.414 0.410 0.406

Page 18: Online Algorithm - The Secretary Problem

CSP – for large n

368.0/*

1log

)log(1

1large, is

1*

1

==

=⇒=⇒

≈−

+∑

ePenr

(n/r*)rn

k

If n

r

n

r

Page 19: Online Algorithm - The Secretary Problem

Thank you