def plot2():
	AvgWT = [0]*16
	AvgUtil = [0]*16
	arrival_means = [0.5 + 0.025*i for i in range(16)]
	employee_langs = [('English', 'Bengali', 'Hindi')]*5 + [('Malayalam','Telugu','Tamil','English')]*5 + [('Marathi', 'Kannada', 'English', 'Hindi')]*5
	for n in range(16):
		(W, U) = cc.run_sim(employee_langs, arrival_mean=arrival_means[n], verbose=False)
		(AvgWT[n], _, AvgUtil[n]) = cc.simplify(W, U)

	plt.figure()
	plt.plot(arrival_means, AvgWT, 'o-')
	plt.xlabel('Average inter-arrival time (minutes)')
	plt.ylabel('Average waiting time')
	plt.show()

	plt.figure()
	plt.plot(arrival_means, AvgUtil, 'o-')
	plt.xlabel('Average inter-arrival time (minutes)')
	plt.ylabel('Average utilization of employees (percentage)')
	plt.show()
def plot1():
	AvgWT = np.zeros((8,8))
	for n in range(8):
		employee_langs = [('Hindi',),('Bengali',),('Marathi',),('Kannada',),('Telugu',),('Malayalam',),('Tamil',),('English',)]*(n+2)
		(W,U) = cc.run_sim(employee_langs, verbose=False)
		AvgWT[:,n] = np.array(W.iloc[:,0])

	x_range = [i+2 for i in range(8)]
	plt.figure()
	for i in range(8):
		plt.subplot(2,2,i%4 +1)
		plt.plot(x_range, AvgWT[i,:], 'o-')
		plt.xlabel('No. of Employees')
		plt.ylabel('Avg. Waiting Time (minutes)')
		plt.title(cc.idx_lang[i])
		if i == 3:
			plt.tight_layout()
			plt.show()
			plt.figure()
	plt.tight_layout()
	plt.show()
employee_langs = [('English', 'Bengali', 'Hindi')] * 5 + [
    ('Malayalam', 'Telugu', 'Tamil', 'English')
] * 5 + [('Marathi', 'Kannada', 'English', 'Hindi')] * 5

# Unilingual:
#employee_langs = [('Hindi',)]*4 + [('Bengali',)]*2 + [('Marathi',)]*2 +[ ('Kannada',), ('Malayalam',), ('Telugu',), ('Tamil',)] + [('English',)]*3

# Bilingual:
#employee_langs = [('Hindi','Malayalam')]*5 + [('Bengali','Telugu')]*3 + [('Marathi','Kannada')]*3 + [('English', 'Tamil')]*4

n_employees = len(employee_langs)

Utils = np.zeros((n, n_employees))

for i in range(n):
    (W, U) = cc.run_sim(employee_langs, time=480, verbose=False)
    MaxWaitTimes[i, :] = np.transpose(np.array(W.iloc[:, 1]))
    AvgWaitTimes[i, :] = np.transpose(np.array(W.iloc[:, 0]))
    Utils[i, :] = np.transpose(np.array(U.iloc[:, 1]))

# Compute the maximum of the maximum waiting times ():
MaxMaxWaitTimes = np.max(MaxWaitTimes, axis=0)

# Compute the average of the average waiting times:
AvgAvgWaitTimes = np.mean(AvgWaitTimes, axis=0)
AvgUtils = np.mean(Utils, axis=0)

D1 = pd.DataFrame(
    {
        'Average Waiting Time': AvgAvgWaitTimes,
        'Maximum Waiting Time': MaxMaxWaitTimes
# Some employees are be added to the multilingual employee configuration:

employee_langs = [('English', 'Bengali', 'Hindi')]*5 + [('Malayalam','Telugu','Tamil','English')]*5 + [('Marathi', 'Kannada', 'English', 'Hindi')]*5

configurations1 = [employee_langs + [('English', 'Bengali', 'Hindi')], employee_langs + [('English', 'Bengali', 'Hindi')]*2, 
	employee_langs + [('Malayalam','Telugu','Tamil','English')], employee_langs + [('Malayalam','Telugu','Tamil','English')]*2, 
	employee_langs + [('Marathi', 'Kannada', 'English', 'Hindi')], employee_langs + [('Marathi', 'Kannada', 'English', 'Hindi')]*2, 
	employee_langs + [('Hindi', 'Marathi', 'English')], employee_langs + [('English', 'Tamil', 'Telugu')], employee_langs + [('Hindi', 'Bengali')], employee_langs + [('Hindi', 'Bengali')]*2,
	employee_langs + [('English', 'Telugu')], employee_langs + [('English', 'Telugu')]*2]

n = len(configurations1)

increments = np.expand_dims([len(config)-len(employee_langs) for config in configurations1],axis=1)

(W_def, U_def) = cc.run_sim(employee_langs, verbose=False)
avg_W_def = np.transpose(W_def.iloc[:,0])

avg_W = np.zeros((n,8))
percent_dec = np.zeros((n,8))

for i, config in enumerate(configurations1):
	(W,U) = cc.run_sim(config, verbose=False)
	avg_W[i,:] = np.transpose(W.iloc[:,0])
	percent_dec[i, :] =(avg_W_def - avg_W[i,:])/avg_W_def * 100

employee_added_langs =[', '.join(l) for l in [('English', 'Bengali', 'Hindi')]*2 + [('Malayalam','Telugu','Tamil','English')]*2 + [('Marathi', 'Kannada', 'English', 'Hindi')]*2 + [('Hindi', 'Marathi', 'English')] + [('English', 'Tamil', 'Telugu')] + [('Hindi', 'Bengali')]*2 + [('English', 'Telugu')]*2]

avg_W_df = pd.DataFrame(data=np.c_[increments, avg_W], columns = ['No. of emp added']+list(cc.lang_idx.keys()), 
	index=employee_added_langs)