<jupyter_start><jupyter_text>Examples<jupyter_code># reading the input file as a list
with open('Test_01_15.24.txt') as f:
    reader = csv.reader(f, delimiter=" ")
    d = list(reader)

n  = int(d[0][0]) # n is number of cities
d.pop(0)

d = [[int(i[0]),float(i[1]),float(i[2])] for i in d] # convert d into integers

start_time = time.time()
tsp, total_travel_length = tsp_heuristic_xtrick(d)
print('############    tsp_heuristic with x trick   ############')
print('#########################################################')
print('#########################################################')
print('\n __________Total travel length is:________________')
print(total_travel_length)
print('\n __________Visited cities in order (from city 1) is:________________')
print(tsp)
print('\n ______The shortest tour to travel has length of (from the figure to double check):_________')
tot_dist = plot_TSP(tsp,d)
print(tot_dist)

print("\n --- %s seconds ---" % (time.time() - start_time))
# reading the input file as a list
with open('nn.txt') as f:
    reader = csv.reader(f, delimiter=" ")
    d = list(reader)

n  = int(d[0][0]) # n is number of cities
d.pop(0)

d = [[int(i[0]),float(i[1]),float(i[2])] for i in d] # convert d into integers

start_time = time.time()
tsp, total_travel_length = tsp_heuristic_xtrick(d)
print('############    tsp_heuristic with x trick   ############')
print('#########################################################')
print('#########################################################')
print('\n __________Total travel length is:________________')
print(total_travel_length)
# print('\n __________Visited cities in order (from city 1) is:________________')
# print(tsp)
# print('\n ______The shortest tour to travel has length of (from the figure to double check):_________')
# tot_dist = plot_TSP(tsp,d)
# print(tot_dist)

print("\n --- %s seconds ---" % (time.time() - start_time))
# reading the input file as a list
with open('tsp.txt') as f:
    reader = csv.reader(f, delimiter=" ")
    d = list(reader)

n  = int(d[0][0]) # n is number of cities
d.pop(0)

d = [[int(i[0]),float(i[1]),float(i[2])] for i in d] # convert d into integers

start_time = time.time()
tsp, total_travel_length = tsp_heuristic_xtrick(d)
print('############    tsp_heuristic with x trick   ############')
print('#########################################################')
print('#########################################################')
print('\n __________Total travel length is:________________')
print(total_travel_length)
print('\n __________Visited cities in order (from city 1) is:________________')
print(tsp)
print('\n ______The shortest tour to travel has length of (from the figure to double check):_________')
tot_dist = plot_TSP(tsp,d)
print(tot_dist)

print("\n --- %s seconds ---" % (time.time() - start_time))<jupyter_output>############    tsp_heuristic with x trick   ############
#########################################################
#########################################################

 __________Total travel length is:________________
32981.96301468098

 __________Visited cities in order (from city 1) is:________________
[1, 2, 6, 5, 4, 8, 7, 9, 3, 13, 12, 10, 11, 15, 19, 18, 22, 23, 21, 17, 20, 16, 25, 24, 14, 1]

 ______The shortest tour to travel has length of (from the figure to double check):_________
32981.96301468098

 --- 0.0448758602142334 seconds ---
{'fraction_non_alphanumeric': 0.28408091468777485, 'fraction_numerical': 0.03488712987393726, 'mean_word_length': 5.85140562248996, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '206946', 'license': 'MIT', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1040, 'n_words': 316, 'path': 'tsp_heuristic/tsp_heuristic_xtrick.ipynb', 'repo_name': 'saniaki/tsp', 'size': '3411'}