The Secretary Problem also known as marriage problem, the sultan’s dowry problem, and the best choice problem is an example of Optimal Stopping Problem.
This problem can be stated in the following form: Imagine an administrator who wants to hire the best secretary out of n rankable applicants for a position. The applicants are interviewed one by one in random order. A decision about each particular applicant is to be made immediately after the interview. Once rejected, an applicant cannot be recalled. During the interview, the administrator can rank the applicant among all applicants interviewed so far but is unaware of the quality of yet unseen applicants. The question is about the optimal strategy (stopping rule) to maximize the probability of selecting the best applicant.
Optimal Stopping : In mathematics, the theory of optimal stopping or early stopping is concerned with the problem of choosing a time to take a particular action, in order to maximize an expected reward or minimize an expected cost.
If the decision to hire an applicant was to be taken in the end of interviewing all the n candidates, a simple solution is to use maximum selection algorithm of tracking the running maximum (and who achieved it) and selecting the overall maximum at the end. The difficult part of this problem is that the decision must be made immediately after interviewing a candidate.
1/e law of Optimal Strategy
According to this strategy, the optimal win probability is always at least 1/e.
The optimal stopping rule prescribes always rejecting the first n/e applicants that are interviewed (where e is the base of the natural logarithm and has the value 2.71828) and then stopping at the first applicant who is better than every applicant interviewed so far (or continuing to the last applicant if this never occurs). This strategy is called the 1/e stopping rule because the probability to select the best candidate is 1/e, in other words, this strategy selects the best candidate about 37% of time.
If you think carefully, it might seem obvious that one cannot select the first candidate because the first candidate has no one to compare with. A better strategy is to choose a few candidates as a sample to set the benchmark for remaining candidates. So the sample will be rejected and will only be used for setting benchmark.
- If a sample is too small, we don’t get information enough for setting the benchmark for remaining candidates.
- If a sample is too large, though we get plenty of information but we have also burned too many of the potential candidates. This leaves us with very few candidates to choose from, and hence making the strategy a poor one.
- The best strategy is to choose the perfect or optimal sample size (ideal sample size) which can be done using 1/e law that is rejecting n/e candidates (this n/e is the sample size).
The optimal sample size and Probability of success for different values of n are :
Optimal Sample size k = n / e
Probability of success is given by :
where x = k / n
The probability of selecting the best applicant in the classical secretary problem converges toward 1/e = 0.368 (approx)
Program to Test Secertary Problem :
Note* : The Optimal Strategy doesn’t always find the best candidate but selects the almost best candidates most of the times.
Candidates : 1 2 3 4 5 6 7 8 Talents : 5 3 8 6 5 7 8 6 Sample size is 3 Best candidate found is 7 with talent 8
Alternate Optimal Strategy : This strategy instead of choosing the sample size as n/e, it selects square root of n as the optimal sample size (i.e. sqrt(n)).
This article is contributed by Shubham Rana. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Number of stopping station problem
- Tiling Problem
- Fibonacci problem (Value of Fib(N)*Fib(N) - Fib(N-1) * Fib(N+1))
- Josephus Problem Using Bit Magic
- Josephus problem | Set 1 (A O(n) Solution)
- The Lazy Caterer's Problem
- Frobenius coin problem
- Problem of 8 Neighbours of an element in a 2-D Matrix
- The Knight's tour problem | Backtracking-1
- Hungarian Algorithm for Assignment Problem | Set 1 (Introduction)
- Maths behind number of paths in matrix problem
- Optimal Strategy for a Game | DP-31
- Maximum possible sub-array sum after at most X swaps
- Find N distinct numbers whose bitwise Or is equal to K