nodelist = [] for i in range(start_index, dimension + start_index - 1): x, y = lines[i].strip().split()[1:] nodelist.append([float(x), float(y)]) # calculate the euclidean distances between every point. # this creates a matrix of distances between every pair # of points. now we are ready to calculate the optimal path. dists = euclidean_distances(nodelist) print() print("> Starting execution for file: {}".format(name)) print("> Matrix dimensions: {}\n".format(dists.shape)) cli_n = Numbers(prompt="> Select number of iterations: ") iterations = cli_n.launch() print() print( "> Calculating solution. \nProblems over 500 cities can take several minutes...\n" ) start_time = time.time() solution = solve_float_matrix(dists, runs=iterations) end_time = time.time() - start_time solution_pairs = sliding_window_view(solution, 2) total_length = np.sum([dists[pair[0], pair[1]] for pair in solution_pairs]) print("> Proposed solution: {} with length {:.2f}\n".format(
from bullet import Numbers prompt = Numbers("How old are you? ", type=int) prompt.launch()