ICU = [15, 20, 17]
krange = [0, float('inf')]
table = [['ICU beds', 'SDU beds' ,'ArrivalCount', 'Served Outside', 'Arrival Count', 'Critical Arrival', 'Semi-Critical Arrival', 'Balk Threshold', 'Abandonment Rate', 'Balk Rate', 'Bump Rate', 'Expected Wait Time', 'P(Return to Critical)', 'P(Return to Semi-Critical)', 'P(Offplacement of Critical patient)', 'P(Offplacement of Semi-critical patient)', 'E_time_offplaced_C', 'E_time_offplaced_S', 'Average Queue Length', 'P-cost', 'Cost', 'Half', 'No SDU']]
for p in rangeset:
	halfcostB = 0
	nosducostB = 0
	halfcostQ = 0
	nosducostQ = 0
	for b in ICU:
		for k in krange:

			# start_time = time.time()
			row = []
			#Determine which simulation to run based on mode
			if mode == 1 or mode == 2:
				AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(13001000, 1000, b, (20-b)*3 + 11, k, .65, .07, .07, .07, .07, 2.5, 2.5*1.5, 1.2, 1.2*1.5, 1.5, 9, 9*p, 1, 1)
			elif mode == 3 or mode == 4:
				AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(13001000, 1000, b, (20-b)*3 + 11, k, .65, .07, .07, .07, .07, 2.5, 2.5*1.5, 1.2, 1.2*1.5, 1.5*p, 9, 9, 1, 1)
			elif mode == 5 or mode == 6:
				AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(13001000, 1000, b, (20-b)*3 + 11, k, .65, .07*p, .07, .07*p, .07, 2.5, 2.5*1.5, 1.2, 1.2*1.5, 1.5, 9, 9, 1, 1)
			elif mode == 7 or mode == 8:
				AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(13001000, 1000, b, (20-b)*3 + 11, k, .65, .07, .07*p, .07, .07*p, 2.5, 2.5*1.5, 1.2, 1.2*1.5, 1.5, 9, 9, 1, 1)
			elif mode == 9 or mode == 10:
				AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(13001000, 1000, b, (20-b)*3 + 11, k, .65, .07, .07, .07, .07, 2.5, 2.5*1.5, p, p*1.5, 1.5, 9, 9, 1, 1)
			elif mode == 11 or mode == 12:
				AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(13001000, 1000, b, (20-b)*3 + 11, k, .65, .07, .07, .07, .07, p, p*1.5, 1.2, 1.2*1.5, 1.5, 9, 9, 1, 1)
			elif mode == 13 or mode == 14:
				AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(13001000, 1000, b, (20-b)*3 + 11, k, p, .07, .07, .07, .07, 2.5, 2.5*1.5, 1.2, 1.2*1.5, 1.5, 9, 9, 1, 1)
			elif mode == 15 or mode == 16:
				AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(13001000, 1000, b, (20-b)*3 + 11, k, .65, .07, .07, .07, .07, 2.5, 2.5*1.5, 1.2, 1.2*1.5, 1.5, 9, 9, p, p)
			row.append(b)
k = int(sys.argv[1])
p = int(sys.argv[2])
ICU = [15, 20, 17]
krange = [0, float('inf')]
k = krange[k]
table = [['ICU beds', 'SDU beds' ,'ArrivalCount', 'Served Outside', 'Arrival Count', 'Critical Arrival', 'Semi-Critical Arrival', 'Balk Threshold', 'Abandonment Rate', 'Balk Rate', 'Bump Rate', 'Expected Wait Time', 'P(Return to Critical)', 'P(Return to Semi-Critical)', 'P(Offplacement of Critical patient)', 'P(Offplacement of Semi-critical patient)', 'E_time_offplaced_C', 'E_time_offplaced_S', 'Average Queue Length', 'P-cost', 'Cost', 'Half', 'No SDU']]

halfcostB = 0
nosducostB = 0
halfcostQ = 0
nosducostQ = 0
for b in ICU:

	# start_time = time.time()
	AR, BaR, BuR, EWT, PrC, PrS, PoC, PoS, EtoC, EtoS, aql, SS, ArrC, CArr, SCArr = ISF1.simulation(20001000, 1000, b, (20-b)*3 + 11, k, .65, .07, .07, .07, .07, 2.5, 2.5*1.5, 1.2, 1.2*1.5, 1.5*p, 9, 9, 1, 1)
		
	row.append(b)
	row.append((20-b)*3 + 11)
	row.append(ArrC)
	row.append(SS)
	row.append(ArrC)
	row.append(CArr)
	row.append(SCArr)
	row.append(k)
	row.append(AR)
	row.append(BaR)
	row.append(BuR)
	row.append(EWT)
	row.append(PrC)
	row.append(PrS)