Question: Please use Python when writing the code. How to choose applicants - assign each person a number 1 through 30 and randomly select M applicants
Please use Python when writing the code.
How to choose applicants - assign each person a number 1 through 30 and randomly select "M" applicants for the "look phase", and do this for all possible values of M (M=0 through M=29). Create a loop to randomly shuffle the applicants for each trial.
How to compare applicants - assume "1" corresponds to the best applicant and "30" corresponds to the worst. For a given "M", we want to find the first instance in which a number appears after interviewing "M" applicants that is lower than all the applicant numbers in the "M" phase, and choose them as the roommate.

You are looking for a new roommate to help share the rent on your expensive just-off-campus apartment. You are willing to interview up to 30 people, but you have no prior information about any of the applicants, so you'll be interviewing them in random order. You hope to get the best but here's the challenge: after each interview you need to decide then and there whether to accept that person as your new roommate. If you decide not to, then you'll go on to interview the next person but the current applicant will be "lost you've rejected them and they won't want to hear back from you ever again. You decide to use a "look, then leap strategy in which you will first interview M applicants but not accept any, and then the next applicant you interview who is better than all of the first M applicants will be your new roommate. If none are better (i.e., if it turns out that the best candidate was in the group of M) then you won't get a new roommate and will need to activate Plan B: getting a part-time job so you can afford to keep the apartment on you own. Write a program that allows you to simulate this situation 10,000 times for each possible value of M so that you can find the best M, the number of applicants you should interview during the look phase to maximize the probability of getting the best roommate when you "leap. (Hint: you should find that the probability is maximum at M 11.) For this first assignment, your program should be a simple script file (no functions, no classes, ...). Your program should present the results as two subplots in a single figure window. The first plot should be the probability of finding the best vs. M (see example below - your graph may differ somewhat because this is a stochastic simulation); the second plot should show the probability of not finding anyone vs. M. Look-then-leap to get the best 0.40 probability of getting the best 20 25 number of candidates in the look phase (M)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
