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_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)))
示例#9
0
#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()
data2008.select_data()

print('Setting Institution Attributes')
all_institutions = []
for x in data2008.finaldata: