camp_pops_retrofitted = [] errors_retrofitted = [] abs_errors_retrofitted = [] # calculate retrofitted time. refugees_in_camps_sim = 0 for c in camps: refugees_in_camps_sim += c.numAgents # t_retrofitted = d.retrofit_time_to_refugee_count(refugees_in_camps_sim, camp_names) # calculate errors for i in range(0, len(camp_locations)): camp_number = camp_locations[i] errors += [ a.rel_error(locations[camp_number].numAgents, loc_data[i]) ] abs_errors += [ a.abs_error(locations[camp_number].numAgents, loc_data[i]) ] # errors when using retrofitted time stepping. # TODO: T_RETROFITTED IS USED HERE BUT IS STILL INITIALIZED ON 0...... # camp_pops_retrofitted += [d.get_field(camp_names[i], t_retrofitted, FullInterpolation=True)] camp_pops_retrofitted += [ d.get_field(camp_names[i], t, FullInterpolation=True) ] errors_retrofitted += [ a.rel_error(camps[i].numAgents, camp_pops_retrofitted[-1]) ] abs_errors_retrofitted += [
camp_locations = [26, 27, 29, 30, 31] camps = [] for i in camp_locations: camps += [locations[i]] camp_names = ["Mahama", "Nduta", "Nyarugusu", "Nakivale", "Lusenda"] refugees_in_camps_sim = 0 for c in camps: refugees_in_camps_sim += c.numAgents # calculate errors for i in range(0, len(camp_locations)): camp_number = camp_locations[i] errors += [ a.rel_error(locations[camp_number].numAgents, loc_data[i]) ] abs_errors += [ a.abs_error(locations[camp_number].numAgents, loc_data[i]) ] output = "%s" % t for i in range(0, len(errors)): camp_number = camp_locations[i] output += ",%s,%s,%s" % (locations[camp_number].numAgents, loc_data[i], errors[i]) if refugees_raw > 0: #output_string += ",%s,%s,%s,%s" % (float(np.sum(abs_errors))/float(refugees_raw), int(sum(loc_data)), e.numAgents(), refugees_raw) output += ",%s,%s,%s,%s,%s,%s" % (
camp_pops_retrofitted = [] errors_retrofitted = [] abs_errors_retrofitted = [] # calculate retrofitted time. refugees_in_camps_sim = 0 for c in camps: refugees_in_camps_sim += c.numAgents t_retrofitted = d.retrofit_time_to_refugee_count(refugees_in_camps_sim, camp_locations) # calculate errors j=0 for i in camp_locations: errors += [a.rel_error(lm[i].numAgents, loc_data[j])] abs_errors += [a.abs_error(lm[i].numAgents, loc_data[j])] # errors when using retrofitted time stepping. camp_pops_retrofitted += [d.get_field(i, t_retrofitted, FullInterpolation=True)] errors_retrofitted += [a.rel_error(lm[i].numAgents, camp_pops_retrofitted[-1])] abs_errors_retrofitted += [a.abs_error(lm[i].numAgents, camp_pops_retrofitted[-1])] j += 1 output = "%s" % t for i in range(0,len(errors)): output += ",%s,%s,%s" % (lm[camp_locations[i]].numAgents, loc_data[i], errors[i])
loc_data = [] camps = [] for i in camp_locations: camps += [lm[i]] loc_data += [d.get_field(i, t)] # calculate retrofitted time. refugees_in_camps_sim = 0 for c in camps: refugees_in_camps_sim += c.numAgents # calculate errors j = 0 for i in camp_locations: errors += [a.rel_error(lm[i].numAgents, loc_data[j])] abs_errors += [a.abs_error(lm[i].numAgents, loc_data[j])] j += 1 output = "%s" % t for i in range(0, len(errors)): output += ",%s,%s,%s" % (lm[camp_locations[i]].numAgents, loc_data[i], errors[i]) if refugees_raw > 0: #output_string += ",%s,%s,%s,%s" % (float(np.sum(abs_errors))/float(refugees_raw), int(sum(loc_data)), e.numAgents(), refugees_raw) output += ",%s,%s,%s,%s,%s,%s" % ( float(np.sum(abs_errors)) / float(refugees_raw), int(sum(loc_data)), e.numAgents(), refugees_raw,
t_retrofitted = d.retrofit_time_to_refugee_count( refugees_in_camps_sim, camp_names) # calculate error terms. camp_pops = [] errors = [] abs_errors = [] camp_pops_retrofitted = [] errors_retrofitted = [] abs_errors_retrofitted = [] for i in range(0, len(camp_names)): # normal 1 step = 1 day errors. camp_pops += [ d.get_field(camp_names[i], t, FullInterpolation=True) ] errors += [a.rel_error(camps[i].numAgents, camp_pops[-1])] abs_errors += [a.abs_error(camps[i].numAgents, camp_pops[-1])] # errors when using retrofitted time stepping. camp_pops_retrofitted += [ d.get_field(camp_names[i], t_retrofitted, FullInterpolation=True) ] errors_retrofitted += [ a.rel_error(camps[i].numAgents, camp_pops_retrofitted[-1]) ] abs_errors_retrofitted += [ a.abs_error(camps[i].numAgents, camp_pops_retrofitted[-1]) ]