• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Dec 9th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import tsp
4.     for i in range (0,len(distance_list)):
5.         if ((distance_list[i][1]-distance_list[i][0])/distance_list[i][0] < 0.3 ):
6.             #print(distance_list[i])
9.
12.     for i in range (0,len(distance_list)):
13.         if ((distance_list[i][1]-distance_list[i][0])/distance_list[i][0] < 0.15 ):
14.             #print(distance_list[i])
17.
24.                 temp_list1 = clusterList[Min1]
25.                 clusterList[Min1].pop()
27.                 temp_list2 = clusterList[Min2]
28.                 clusterList[Min2].pop()
29.                 tsp1_1 = tsp.tsp(clusterList[Min1])
30.                 tsp1_2 = tsp.tsp(temp_list1)
31.                 tsp2_1 = tsp.tsp(clusterList[Min2])
32.                 tsp2_2 = tsp.tsp(temp_list2)
33.                 Extra1 = tsp1_1[0] - tsp1_2[0]
34.                 Extra2 = tsp2_1[0] - tsp2_2[0]
35.                 if(Extra1 >= Extra2 and CapLimit(temp_list2,VC) == True):
36.                         clusterList[Min2] = temp_list2
37.
38.                 elif(Extra2 > Extra1 and CapLimit(temp_list1,VC) == True):
39.                         clusterList[Min1] = temp_list1
40.         return clusterList
41.
42. def CapLimit(list1,VC):
43.         cap = 0
44.         for i in range(0,len(list1)):
45.                 cap = list1[i][3] + cap
46.         if(cap <= VC):
47.                 return True
48.         else:
49.                 return False
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?