Skip to content

Commit

Permalink
added plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
metalcyanide committed Dec 20, 2019
2 parents e96c081 + ddc0032 commit 3dc1287
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
37 changes: 36 additions & 1 deletion Clustering_by_Kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,40 @@ def plot_clusters(groups, numclusters):

plt.show()

def findSuitablek(data, minimum, maximum):
mumcluster = minimum
groups = cluster(data, numcluster)
diff = []
for i in range(minimum, maximum+1):
groups = cluster(data,numcluster)
minlen = min([len(i) for i in groups])
maxlen = max([len(i) for i in groups])
diff.append(maxlen - minlen)
mindiff = min(diff)
for i in len(diff):
if(diff[i] == mindiff):
return i+minimum


def groupclusters(data, numcluster, seats):
groups = cluster(data, numcluster)
gcluster = [[] [] []]

for i in groups:
if(len(groups) < 0.6 * seats):
gcluster[0].append(i)
elif (len(groups) <1.2 * seats):
gcluster[1].append(i)
else:
gcluster[2].append(i)

for i in gcluster[2]:
getgroup = cluster(i, len(i)/(0.85 * seats))
for j in getgroup:
gcluster[1].append(i)

plot_clusters(cluster(data, 4),4)
return gcluster[1]


plot_clusters(cluster(data, 4))

12 changes: 10 additions & 2 deletions presentation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,31 @@ outline:
b. constraints and their priorities.
c. impact of this problem in real time, eg. millions of dollars can
be saved by having efficient soln.
Garbage Truck Scheduling
Reduces Carbon footprint
this problem impacts areas such as these

d. the general methods of solving this; eg. linear programming and
heuristic approaches in it, ant colonization and why these fail.

(finish above in around 5 mins)

2. Our Solution

Make a flowchart of the process

a. Use TSP as we want to minimise cost eventually(explain TSP too).
b. Problem in using TSP though, is its bad time complexity.
c. Hence use clustering to improve time; explain the derivation
d. This serves another purpose as well i.e bus size and percent occupancy,
how: assign 1 bus for each cluster and run TSP for that cluster
e. Now we have to make sure size of each cluster is >85% of bus cap
and number of clusters is <= total number of buses available,
to handle this, explain the process given by Chaithanya.
to handle this, explain the process given by Chaithanya.(60%, 120%)

f. We use KMeans algo for clustering, use the longitude and latitude
data to make a 2d plot of the bus stops and their group decided
by the algo.
by the algo.(also explain the number of clusters decided)
g. To handle time window, run TSP on weighted graph, alpha beta
method and plot a graph to find alpha such that time is within
limit.
Expand Down
Binary file added quantumtsp.pdf
Binary file not shown.

0 comments on commit 3dc1287

Please sign in to comment.