Example #1
0
def greedy_LTD_start():
	'''
	Shortcut: called by the user, in order to retrieve several solutions and compare them each other
	Parameters used to create the graphs are take as input from the user
	'''
	# Number of nodes
	n = inc.input_int('Number of nodes', minValue = 1)
	# Extreme values for the traffic matrix
	TM_min = inc.input_int('Traffic matrix lower bound', minValue = 1)
	TM_max = inc.input_int('Traffic matrix upper bound', minValue = TM_min)
	# Delta values
	delta_in = inc.input_int('Delta_in (max #rx per node)', minValue = 1)
	delta_out = inc.input_int('Delta_out (max #tx per node)', minValue = 1)
	# Traffic matrix
	traffic_matrix = tm.random_TM(n, TM_min, TM_max)
	# Results:
	T1 = greedy_LTD_mesh(n, traffic_matrix, delta_in, delta_out)
	T1_bis = LTD_random(n, len(T1.edges()), delta_in, delta_out, traffic_matrix)
	T2 = greedy_LTD_ring(n, traffic_matrix, delta_in, delta_out)
	T2_bis = LTD_random(n, len(T2.edges()), delta_in, delta_out, traffic_matrix)
Example #2
0
 for i in range(len(ns)):
     # Number of nodes in the topology
     n = ns[i]
     # Retrieve number of nodes per row/column
     nr = nrs[i]
     nc = ncs[i]
     # Estimated max flow, for every N
     est_f_max_A = 0.0
     est_f_max_B = 0.0
     # Estimated computational time, for each N
     est_time_A = 0.0
     est_time_B = 0.0
     # FOr every N-nodes topology, repeat th simulation several times
     for s in range(n_simulations):
         # Compute traffic matrix (same for A and B)
         traffic_matrix = tm.random_TM(n, 0.5, 1.5)
         # Experiment number
         exp = 'Exp #%s, Sim #%s - ' % (str(t).zfill(2),
                                        str(s).zfill(2))
         # Information strings
         exp_info = '%sN = %d, Nr = %d, Nc = %d' % (exp, n, nr, nc)
         title = '%sManhattan LTD' % (exp)
         print('\n\n%s' % (exp_info))
         # SOLUTION
         # Non-optimized
         T_A = L2.LTD_manhattan(n, nr, nc, traffic_matrix, title, False,
                                False)
         est_f_max_A += T_A['max_flow']
         est_time_A += T_A['time']
         # Optimized
         title = '%sManhattan LTD Smart' % (exp)