
Secretary Problem - nate_martin
http://en.wikipedia.org/wiki/Secretary_problem#body
======
Cogito
The section on experimental studies touches on it briefly, but it's important
to note that costs involved in the selection process are not considered in the
standard construction of the problem.

From wikipedia:

> _In large part, this work has shown that people tend to stop searching too
> soon. This may be explained, at least in part, by the cost of evaluating
> candidates._

and then

> _For example, when trying to decide at which gas station to stop for gas,
> people might not search enough before stopping. If true, then they would
> tend to pay more for gas than they might had they searched longer._

So you might pay more for gas if you don't use the optimal strategy, but waste
more money in fuel costs searching for the cheaper price than you save buy
purchasing at that price.

Perhaps most interestingly, there is a formulation of the problem that
requires a decision to be made within a certain time period, from an unknown
number of candidates who arrive over that time period. If you know (or can
estimate) the arrival times of the candidates, you can use a very similar
strategy to achieve optimal results.

Essentially, wait until you have seen 1/e of expected candidates in the time
frame you have allowed for (based on the arrival density function you know or
estimated) then pick the next best option.

This puts a limit on the amount of searching you do, and so provides an
optimal strategy with a bounded limit on how long you search for; it provides
a bound on the cost involved in the search assuming the cost is related to
time taken.

In the searching for gas example, you could use this strategy if you knew
roughly how often you pass a gas station, and how long you are willing to
search for.

~~~
sesqu
The formulation you're talking about is mentioned in the article, under
"unknown number of applicants".

However, it's worth pointing out that the strategy is unacceptable for the gas
station scenario, because of the high probability of total failure.

------
philjohn
There's a TV show in the UK that uses a spin on this - it's called 4 rooms.

The premise is that people come on the show with, what they consider to be, a
valuable artifact. They then have the chance to take it to 4 collectors who
will offer them a sum of money for said artifact.

The aim is to come away with the best offer you can get - but you only get one
shot with each collector, you can't go back to a previous one because all
other offers have been lower.

~~~
oggy
Are the collectors aware of the order in which they talk to the seller? That
is, is the 4th collector aware that he's the "last chance" for the seller?

~~~
ronaldx
No, it's claimed they are not aware.

Although it's not clear how they avoid timing attacks.

------
blinry
Note that if you want to optimize the quality of the candidate, not the
probability of picking _the_ best one, it's better to stop after sqrt(n)
candidates:
[https://en.wikipedia.org/wiki/Secretary_problem#Cardinal_pay...](https://en.wikipedia.org/wiki/Secretary_problem#Cardinal_payoff_variant)

------
cschmidt
This gets posted on HN occasionally, and when it does I post this fun blog
post by Michael Trick, a CMU Operations Research professor, who used the
Secretary problem to pick his wife:

[http://mat.tepper.cmu.edu/blog/?p=1392](http://mat.tepper.cmu.edu/blog/?p=1392)

------
Johnie
The same strategy can be used in dating too.

When you live in a major city and the dating options are boundless, there is
always someone around the corner that is "perfect" or more perfect than the
current person that you are dating. Next thing you know, you're in your late
30s and still single.

~~~
gargarplex
I always feel bad when I see these posts. I'm 26 and in a major city, but
finding dates is a serious problem for me. My looks are only slightly below
average (4/10) but my personality is probably the deal breaker.

~~~
aegiso
Having been where you've been, may I suggest that the dealbreaker is that
you're treating dating like a World of Warcraft inventory checklist? I wish
someone had told me that when I was saying the same things.

~~~
riffraff
FWIW, I do think there are similarities between dating and RPGs that I wish I
had understood before

* you can improve your character: confidence is important, if you feel ugly sometimes you can do stuff about it (i.e. go to gym). Ditto if you are a boring talker, or if you are a poor listener.

* grind. If you are, like I was, a guy that has a couple hours on a weekend to meet a new possible date it's hard to find the "right" one. Try to increase the chances (go out more, frequent new places) and do try more.

~~~
gargarplex
This is fair enough and true. Back when I was in my early twenties and late
teens I used to grind all the time (going out to bars and talking to women).
And although I experienced more than my fair share of rejection/disinterest, I
achieved plenty of success and abundance.

These days I am just lazily sending out messages on OKCupid. And when I do go
out to bars, I almost never approach.

So the "grind" reminder is totally fair.

------
philbarr
Hmm, I wonder if this could be used to find a decent pub whilst in a strange
city?

It's always a problem when you're on holiday and you know there are n pubs
around, but you don't want to spend all your time going around and checking
each and every pub 'cos that gets tedious. The question is - how many pubs
should I visit before I give up?

As a general rule is this saying you should visit n/e pubs and then just pick
the next best one?

~~~
prof_hobart
It would. But you'd need to know, or at least guess, how many pubs there were
in the city (to know when you'd reached n/e), and it would also depend on
whether the pubs were randomly distributed or not. If there's nice end and a
trashy end of town, you could easily have exhausted all of the good pubs
before you hit the n/e.

~~~
philbarr
Yes, I guess you'd have to use real world factors to try and trim down your n
before you start with the n/e thing. Although if you're in a strange place you
probably won't know that much about which areas are good or not.

~~~
sesqu
However, to find merely a good pub, √n is enough, given the assumptions
mentioned later in the article.

------
sk5t
Quite interesting that discarding the first n/e candidates produces a 1/e
probability of choosing the optimal one...

As for real-world applications, the only one that comes readily to mind is
rolling up a D&D character, supposing one has only the patience for some
predetermined n rolls. Somewhat ironically it is not a realistic fit for
hiring, as there is seldom a need to accept or eliminate candidates
immediately, interviewing more than 5-6 people for a role is torturous, and an
interviewer uses his experience interviewing and interacting with people
generally to have no mathematical prejudice against hiring the very first
pretty-good option.

~~~
thaumasiotes
> Quite interesting that discarding the first n/e candidates produces a 1/e
> probability of choosing the optimal one...

Freeform thoughts from here:

1/e is the probability of failing (every time) if you try a 1/ _n_ chance _n_
times, where _n_ is large.

To get the optimal choice, there are two (generously defined) requirements:

\- #1 does not occur in the discarded group

\- #1 occurs before everyone else who was not discarded, but exceeds the
maximum of the discarded group

The second one seems hairy to me, so I'll wrap things up here. ;p

> As for real-world applications, the only one that comes readily to mind is
> rolling up a D&D character

This was introduced to me as a marriage problem, and wikipedia also notes it
by that name. The analogy never seemed inaccurate to me; it's frowned upon to
evaluate candidates simultaneously and rare to accept someone other than the
latest candidate.

------
brandonhsiao
Is it possible to explain in layman's terms why 1/e is the magic number?

~~~
gargarplex
The function that approximates the best ideal solution can be approximated
with the log function. It's kind of like why the taylor polynomials means that
e^pi*i = -1

~~~
mchusma
I don't think that was exactly a lay explanation. Was interested myself.

~~~
gargarplex
Yeah, it totally wasn't. I failed.

Okay, so one of the really interesting properties of mathematics is that
complicated functions can sometimes be simplified by simple functions.

For example, the gamma function is an extension of the factorial function (4!
= 4 _3_ 2*1).

[http://upload.wikimedia.org/math/a/c/5/ac57cb1b5db9b61155d86...](http://upload.wikimedia.org/math/a/c/5/ac57cb1b5db9b61155d862c7a02fe425.png)

Amazingly, you are able to represent one idea in another, different way.

So, with the secretary problem, you are able to break down the optimal
solution as this:

[http://upload.wikimedia.org/math/6/f/4/6f4d3a757d9efe51b8b17...](http://upload.wikimedia.org/math/6/f/4/6f4d3a757d9efe51b8b1718dc4c58f67.png)

The | notation means "given". So x|b means "x, given b".

For these abstract formulations, they are reduced to already-existing
calculations..

Finally, you get the big sigma symbol. This is called a Summation. Summations
tend to be able to be approximated using integrals, since an integral is the
area under the curve, which is also a summation of sorts.

Many integrals can be defined using the "log" function, which has base "e". In
this case, when you add in "infinity" for the summation, it converges towards
1/e.

Hope this helps some. If it doesn't, well, I was fired from my job TA'ing
calculus =B so..

------
zindlerb
Very interesting! I assume this is posted because it parallels how YC does
their interview admissions. I think the YC method has some differences to this
problem. YC has already seen the applications for groups, and probably already
developed some kind of best to worse ranking of the applicants. The interview
most likely functions as a confirmation that the teams live up to their great
application. Additionally, YC expands its class to fit the number of qualified
applicants. In this problem there is single spot to fill.

Edit: It is also totally possible many people upvoted this article only
because it is interesting. If that is true ignore my post.

------
kokey
Interesting. It describes roughly the strategy that I've settled on when
looking for accommodation to rent. I think it also has the added advantage of
making you feel you've made a good decision.

------
vijucat
I, like many others, used to have the attitude that "puzzles are for
interviews". But recently, I have started seeing that there can be practical
applications for seemingly academic ideas.

For example, I know a proprietary trader who uses a concept similar to this
from the field of Optimal Stopping for his trading system exclusively, i.e.,
his entire trading strategy, managing tens of millions of dollars for a big
bank, is basically an application of Optimal Stopping to the markets!

------
vehementi
What about needing to hire M candidates out of N applicants?

~~~
hoonose
There's a large body of work on variations of the secretary problem. The one I
know of which is most relevant to your question is section 4 of the following:
[http://www.cs.cornell.edu/~rdk/papers/secArt4.pdf](http://www.cs.cornell.edu/~rdk/papers/secArt4.pdf)

Section 6 is particularly interesting, where you're further restricted - you
want to choose multiple secretaries, but there's certain constraints on the
sets you can choose. For example, the secretaries might be edges in a graph,
and you can't pick a subset of edges which would result in a cycle (this is a
"graphic matroid," which is an example of a mathematical object known as a
matroid). The reason why this formulation of the problem is interesting is
because the best known algorithm is O(sqrt(log k))-competitive (where k is the
rank of the matroid), whereas it is conjectured that an O(1)-competitive
algorithm exists.

------
jmtame
I worked on several iterations in the dating space for about a year, and this
type of stuff was pretty interesting to me. Wrote a bit more about it here:
[https://medium.com/unfinished-
thoughts/2cac1e6cc7b4](https://medium.com/unfinished-thoughts/2cac1e6cc7b4)

------
imdsm
Well, that was fun. (use console output)

Single candidate:
[http://jsbin.com/cupiloye/1/edit](http://jsbin.com/cupiloye/1/edit)

M candidates:
[http://jsbin.com/woyehiyu/1/edit](http://jsbin.com/woyehiyu/1/edit)

------
cshimmin
See also Feynman's Restaurant Problem:
[http://www.feynmanlectures.info/exercises/Feynmans_restauran...](http://www.feynmanlectures.info/exercises/Feynmans_restaurant_problem.html)

------
forgotprevpass
On a related note, can someone suggest a good textbook optimal stopping?

~~~
judk
If you get a stream kf recommendations, how will you choose which one to read?

~~~
tunesmith
Since the first candidate always gets ignored, I'll recommend "Green Eggs And
Ham".

------
FLUX-YOU
I'm going to be the dumb guy ranting here and say that I dislike this word
problem since external knowledge of the world can change your strategy. I
might be stopping too soon because the time cost of evaluating candidates is
far too high compared to the work that needs to be done immediately. The
sooner I get someone in, the sooner that work gets done, the less behind we
all get, the less workload for the new secretary, the better he/she will
perform, and the better the first impression.

You might also be able to recognize a rock star secretary immediately or
recognize obviously incompetent people. There's a competence threshold that's
present here and has to be addressed if you dissect the analogy. Going for
'best' here has diminishing returns beyond a certain level of competence. The
immediate need to decline/accept also really doesn't make sense if we're
trying to explain this with a hiring analogy.

However, the Game of Googol nails it and I really like this approach much
better when explaining this problem. It's a game with arbitrary rules so I
can't easily use my worldly experience biases to solve the problem.

~~~
chaz
I think the difference is that you're reading it as practical word problem,
when the intent is to present a math problem.

I first heard about this problem in a politically incorrect variation: a tribe
chief is given the opportunity to choose a wife from a pool of n women,
presented in a random order, one at a time. He can choose any woman, but can't
choose a woman who he has already passed up. What's the strategy for the chief
to choose the most beautiful wife?

~~~
aaronsnoswell
How is that variation politically incorrect? Genuine question here. If
anything, to me it seems culturally correct.

~~~
roel_v
Do you really need to ask? Are you seriously incapable of seeing that some
people might be offended (stupidly, if you ask me, but that doesn't make them
any less so) by a story where a woman is apparently picked like cattle by a
feudal lord?

~~~
greenpresident
I suspect he meant to say that the analogy accurately depicts something that
really happens. An assessment that, incidentally, is pretty politically
incorrect in itself.

~~~
dannypgh
Ah, yes, what an accurate depiction of the "tribe."

Seriously, if you want to go the accurate route, probably best to pick a
specific people where that's what actually happens. Not having done that, the
problem as stated advances stereotypes of peoples that are referred to as
"tribes" as being primitive and misogynistic.

Perhaps use "nation" instead, or better yet, formulate the problem
differently.

