def setup_app():
    applist = []
    for qualty in [100, 20, 90, 80, 50, 30, 40, 10, 70, 60]:
        name = App()
        name.quality = qualty
        name.name = 'a' + str(qualty)
        applist.append(name)
    return applist
def setup_app():
    applist=[]
    for qualty in [100,20,90,80,50,30,40,10,70,60]:
        name = App()
        name.quality = qualty
        name.name = 'a'+str(qualty)
        applist.append(name)
    return applist
 def test_rank_interviewed_inst(self):
     """Select institions that will be ranked"""
     app=App()
     app.quality = 50
     app.num_applied_to = 5
     app.observe = 1
     app.applied_to_range = [.4, 1.2]
     app.apply_list(setup_inst())
     desired = {'i30','i40', 'i50', 'i60', 'i70'}
     actual = set([inst.name for inst in app.applied_to])
     self.assertEqual(actual, desired)
def setup_app():
    applist=[]
    for qualty in [100,20,90,80,50,30,40,10,70,60, 25,95,85,55,35, 45, 15, 75, 65, 15, 10, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
        name = App()
        name.quality = qualty
        name.observed_1 = .8
        name.observed_2 = 1.25
        name.applied_to = 3
        name.name = 'a'+str(qualty)
        applist.append(name)
    return applist
 def test_rank_interviewed_inst(self):
     """Select institions that will be ranked"""
     app = App()
     app.quality = 50
     app.num_applied_to = 5
     app.observe = 1
     app.applied_to_range = [.4, 1.2]
     app.apply_list(setup_inst())
     desired = {'i30', 'i40', 'i50', 'i60', 'i70'}
     actual = set([inst.name for inst in app.applied_to])
     self.assertEqual(actual, desired)
 def test_apply_list1(self):
     """Setup 1: number to apply to = number in desired range
     """
     app = App()
     app.quality = 50
     app.num_applied_to = 5
     app.applied_to_range = [.4, 1.2]
     app.apply_list(setup_inst())
     desired = {'i30', 'i40', 'i50', 'i60', 'i70'}
     actual = set([inst.name for inst in app.applied_to])
     self.assertEqual(desired, actual,
                      'desired '+str(desired)+' != '+ 'Actual '+str(actual))
 def test_apply_list1(self):
     """Setup 1: number to apply to = number in desired range
     """
     app = App()
     app.quality = 50
     app.num_applied_to = 5
     app.applied_to_range = [.4, 1.2]
     app.apply_list(setup_inst())
     desired = {'i30', 'i40', 'i50', 'i60', 'i70'}
     actual = set([inst.name for inst in app.applied_to])
     self.assertEqual(
         desired, actual,
         'desired ' + str(desired) + ' != ' + 'Actual ' + str(actual))
 def test_apply_list2(self):
     '''Setup 2: number to apply to > number in desired range
     range will be expanded
     '''
     app = App()
     app.quality = 50
     app.num_applied_to = 5
     app.observe = 1
     app.applied_to_range = [.8, 1.2]
     app.apply_list(setup_inst())
     desired = set(['i50', 'i60', 'i70', 'i80'])
     actual = set([inst.name for inst in app.applied_to])
     self.assertEqual(desired, actual,
                      'desired '+str(desired)+' != '+ 'Actual '+str(actual))
 def test_apply_list3(self):
     """Setup 3: number to apply to < number in desired range.
     This may be ambiguous becuase the institutions ar randomly selected from
     the list if larger than the number that will be applied to.
     """
     app = App()
     app.quality = 50
     app.num_applied_to = 3
     app.observe = 1
     app.applied_to_range = [.5, 1.5]
     app.apply_list(setup_inst())
     desired = {'i40', 'i50', 'i60'}
     actual = set([inst.name for inst in app.applied_to])
     self.assertEqual(len(desired), len(actual),
                      'desired '+str(len(desired))+' != '+ 'Actual '+str(len(actual)))
 def test_apply_list2(self):
     '''Setup 2: number to apply to > number in desired range
     range will be expanded
     '''
     app = App()
     app.quality = 50
     app.num_applied_to = 5
     app.observe = 1
     app.applied_to_range = [.8, 1.2]
     app.apply_list(setup_inst())
     desired = set(['i50', 'i60', 'i70', 'i80'])
     actual = set([inst.name for inst in app.applied_to])
     self.assertEqual(
         desired, actual,
         'desired ' + str(desired) + ' != ' + 'Actual ' + str(actual))
 def test_apply_list3(self):
     """Setup 3: number to apply to < number in desired range.
     This may be ambiguous becuase the institutions ar randomly selected from
     the list if larger than the number that will be applied to.
     """
     app = App()
     app.quality = 50
     app.num_applied_to = 3
     app.observe = 1
     app.applied_to_range = [.5, 1.5]
     app.apply_list(setup_inst())
     desired = {'i40', 'i50', 'i60'}
     actual = set([inst.name for inst in app.applied_to])
     self.assertEqual(
         len(desired), len(actual), 'desired ' + str(len(desired)) +
         ' != ' + 'Actual ' + str(len(actual)))
Exemple #12
0
        self.observe_2 = tname.observe_2 = (r.gauss(1, .1)- tname.observe_1)
        self.observed_1 = r.gauss(1, .2)
        self.observed_2 = (r.gauss(1, .1)- tname.observed_1) # based on applicant interviewed, percentage
        self.num_to_rank = 7 * tname.openings
        self.accept_range = [.7, None] # as a % [.5, 1.5] if [.7, None] then there is no upper limit

#Make the list of Applicants

print('Make a list of Applicants')
all_applicants = []
for x in range(1, 5000):
    tname = 'app'+str(x)
    tname = Applicant()
    tname.name = x
    # Comment out the Following to use defualt
    tname.quality = max(min(r.gauss(50, 20), 100), 1) # on a scale 0-100
    tname.observe_1 = r.gauss(1, .2) # as a percentage, Applicant error in observing the institutions quality
    tname.observe_2 = (r.gauss(1, .1)- tname.observe_1)
    tname.observed_1 = r.gauss(1, .2) # as a percentage, Institutions error (as seen) in observing the applicants quality
    tname.observed_2 = (r.gauss(1, .1)- tname.observed_1) # CORRECT change to observed_1 after interview default = 1
    tname.applied_to_range = [.8, 1.2] # as a percentage, for example [0.8, 1.2]
    tname.num_applied_to = 12 # the maximum number that the applicant applies to

    all_applicants.append(tname) #Add Applicant to the list of Applicants

# Import institution mAtch data
# Make the list of Institutions
print('importing institution data')
data2008 = InstitutionData('/Users/vmd/Dropbox/Match/residency-match-simulation/matchdata2008.csv', 140, 'C', 1)
data2008.read_data_file()
data2008.prep_data()