rohams / capstone

Capstone project
0 stars 0 forks source link

graph_groups() #6

Closed rohams closed 10 years ago

rohams commented 10 years ago

The graph_groups() function is described as following:


Function Name: graph_groups(map, routes, brks) Input: map, routes array, brks array output: none

Description: draw a graph of the routes on the map

Create paths with routes and brks and use google.maps.Polyline function to draw the paths on the map.

Example: assuming routes and brks are as following: routes: 1,5,4,2,3,6,7,9,8 brks: 2,4

we create the paths such that: path1: 1,5,4 path2: 2,3 path3: 6,7,9,8

rohams commented 10 years ago

One thing I forgot: The same way you did the distance matrix, we need to have another array such that each element of the array is the distance of the store from DC (distribution centre), let's call it dcDist.

example dcDist = [a1 null a2 a3] where a1 is the distance of store with index 1 from DC and a2 is the distance of store with index 3 from DC and so on. This array also needs to be updated when the user adds a new store.


and in graph_groups() I should make the following correction in the example:

Example: assuming routes and brks are as following: routes: 1,5,4,2,3,6,7,9,8 brks: 2,4

we create the paths such that: path1: dc,1,5,4 path2: dc, 2,3 path3: dc, 6,7,9,8

shzq commented 10 years ago

Sorry, may I know what brks is?

rohams commented 10 years ago

brks (short form of breaks) indicates how your routes array is broken down into paths. (each path is for one truck). So if we have 5 trucks, then brks array should have 4 elements. (to break up the routes array into 5 paths). If look at the example you will understand how this is done. To be precise, brks elements indicate where in the routes array the next path starts. In the example, brks[0]=2 indicates the next path starts at routes[3]=2 and brks[1]=4 indicates the next path starts at routes[5] =6. Needless to say that you always consider the fact that all the paths start from dc.

shzq commented 10 years ago

Will routes and brks be a global variable?

I think I need it for when we want to update the graph_groups (I'm making update_ggroup() function)

shzq commented 10 years ago

Maybe I should wait until we have a meeting. There could be many ways we want to update the graphs

rohams commented 10 years ago

Routes and brks are not global. They are local variables.