-
Notifications
You must be signed in to change notification settings - Fork 0
/
out.py
96 lines (72 loc) · 5.13 KB
/
out.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import numpy as np
# import random
# import operator
# import pandas as pd
# import matplotlib.pyplot as plt
# print("Esta es una prueba :) ")
# # Data for plotting
# t = np.arange(0.0, 2.0, 0.01)
# s = 1 + np.sin(2 * np.pi * t)
# title = "some random string"
# plt.plot(t, s)
# plt.ylabel('Y axis')
# plt.xlabel('X axis ')
# plt.savefig(f"figures/{title}_progress.pdf")
# plt.close()
# print("savedd plot!")
# import numpy as np
# arr = np.array([[1, 2, 3], [4, 5, 6]])
# arr2 = np.array([[8, 9, 0], [4, 5, 6]])
# input_dictionary = {'one': 1, 'two': 2}
# file = open('Python.txt', 'w')
# file.write('Ruta = '+str(arr))
# file.write('\n')
# file.write(str(arr2))
# file.close()
# from sklearn.metrics import pairwise_distances
# def calculateAdj(cityList):
# n = len(cityList)
# x = np.empty([n, 2])
# for count, value in enumerate(cityList):
# x[count]= [value.x,value.y]
# mtx = pairwise_distances(x,x, n_jobs=-1)
# return mtx
#open and read the file after the overwriting:
# f=open("demofile3.txt", "r")
# print(f.read())
# from multiprocessing import Process
# from multiprocessing import Pipe
# from timeit import default_timer as timer
# def bubble_sort(con, array):
# check = True
# while check == True:
# check = False
# for i in range(0, len(array)-1):
# if array[i] > array[i+1]:
# check = True
# temp = array[i]
# array[i] = array[i+1]
# array[i+1] = temp
# print("Array sorted: ", array)
# te = "some text"
# rt = []
# rt.append(array)
# rt.append(te)
# con.send(rt)
# if __name__ == '__main__':
# conn1, conn2 = Pipe()
# tick = timer()
# a =[1,9,4,5,2,6,8,4]
# p = Process(target=bubble_sort, args=(conn2,a))
# p.start()
# p.join()
# value = conn1.recv()
# tock = timer()
# print(value, tock-tick)
# tick = timer()
# bubble_sort(conn2, a)
# tock = timer()
# print(tock-tick)
a = np.array([(1380.0,939.0), (776.0,392.0), (3683.0,1533.0), (3888.0,666.0), (1251.0,1832.0), (378.0,1048.0), (1393.0,1368.0), (928.0,1700.0), (1234.0,1946.0), (2573.0,1969.0), (2936.0,337.0), (1187.0,706.0), (2482.0,1183.0), (2588.0,302.0), (3913.0,192.0), (298.0,1513.0), (1286.0,525.0), (3893.0,102.0), (2728.0,1698.0), (3373.0,1646.0), (611.0,1384.0), (2716.0,1432.0), (3950.0,1558.0), (2848.0,96.0), (3479.0,821.0), (2097.0,981.0), (2678.0,1825.0), (463.0,1670.0), (3022.0,474.0), (3520.0,1079.0), (2597.0,1830.0), (2519.0,135.0), (3874.0,1318.0), (2599.0,901.0), (1247.0,1945.0), (123.0,862.0), (241.0,341.0), (457.0,334.0), (2139.0,1806.0), (3510.0,1671.0), (1256.0,61.0), (19.0,674.0), (3875.0,598.0), (2991.0,792.0), (2290.0,1810.0), (198.0,1810.0), (3640.0,43.0), (1115.0,1052.0), (742.0,1025.0), (1787.0,1009.0), (1429.0,134.0), (3113.0,885.0), (2573.0,599.0), (2576.0,1676.0), (2863.0,558.0), (3854.0,923.0), (3384.0,1498.0), (2178.0,1619.0), (2721.0,1482.0), (1795.0,962.0), (2542.0,236.0), (1625.0,1651.0), (1323.0,280.0), (3416.0,143.0), (611.0,673.0), (938.0,955.0), (839.0,620.0), (53.0,857.0), (3955.0,1743.0), (2574.0,946.0), (3085.0,1528.0), (22.0,987.0), (252.0,1240.0), (2961.0,1605.0), (3911.0,1673.0), (738.0,1325.0), (1621.0,1830.0), (3822.0,899.0), (929.0,1766.0), (3815.0,169.0), (2421.0,1007.0), (1724.0,1642.0), (1807.0,1711.0), (953.0,268.0), (178.0,24.0), (161.0,906.0), (1424.0,1728.0), (2586.0,1286.0), (984.0,965.0), (3447.0,1830.0), (3756.0,882.0), (1178.0,100.0), (1917.0,687.0), (327.0,265.0), (890.0,1846.0), (2945.0,1622.0), (274.0,1420.0), (872.0,1559.0), (376.0,825.0), (2628.0,1479.0)])
b = np.array([(1380.0,939.0), (776.0,392.0), (3683.0,1533.0), (3888.0,666.0), (3822.0,899.0), (1621.0,1830.0), (738.0,1325.0), (3911.0,1673.0), (2961.0,1605.0), (2945.0,1622.0), (890.0,1846.0), (327.0,265.0), (1917.0,687.0), (1178.0,100.0), (3756.0,882.0), (3447.0,1830.0), (984.0,965.0), (2586.0,1286.0), (1424.0,1728.0), (161.0,906.0), (178.0,24.0), (953.0,268.0), (1807.0,1711.0), (1724.0,1642.0), (2421.0,1007.0), (3815.0,169.0), (929.0,1766.0), (1251.0,1832.0), (378.0,1048.0), (1393.0,1368.0), (928.0,1700.0), (1234.0,1946.0), (2573.0,1969.0), (2936.0,337.0), (1187.0,706.0), (2482.0,1183.0), (2588.0,302.0), (3913.0,192.0), (3640.0,43.0), (1115.0,1052.0), (742.0,1025.0), (1787.0,1009.0), (1429.0,134.0), (3113.0,885.0), (2573.0,599.0), (2576.0,1676.0), (2863.0,558.0), (3854.0,923.0), (3384.0,1498.0), (2178.0,1619.0), (2721.0,1482.0), (1795.0,962.0), (2542.0,236.0), (1625.0,1651.0), (1323.0,280.0), (3416.0,143.0), (611.0,673.0), (938.0,955.0), (839.0,620.0), (53.0,857.0), (19.0,674.0), (1256.0,61.0), (3510.0,1671.0), (2139.0,1806.0), (457.0,334.0), (241.0,341.0), (123.0,862.0), (1247.0,1945.0), (2599.0,901.0), (3874.0,1318.0), (2519.0,135.0), (2597.0,1830.0), (3520.0,1079.0), (3022.0,474.0), (463.0,1670.0), (2678.0,1825.0), (2097.0,981.0), (3479.0,821.0), (2848.0,96.0), (3950.0,1558.0), (2716.0,1432.0), (611.0,1384.0), (3373.0,1646.0), (2728.0,1698.0), (3893.0,102.0), (1286.0,525.0), (298.0,1513.0), (198.0,1810.0), (2290.0,1810.0), (2991.0,792.0), (3875.0,598.0), (3955.0,1743.0), (2574.0,946.0), (3085.0,1528.0), (22.0,987.0), (252.0,1240.0), (274.0,1420.0), (872.0,1559.0), (376.0,825.0), (2628.0,1479.0)])
print(a)