Skip to content

Commit

Permalink
Fix edge distance bug
Browse files Browse the repository at this point in the history
Distances in y axis were being incorrectly substracted
  • Loading branch information
argenos committed Dec 1, 2017
1 parent 223e1e6 commit c022d9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion factory/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def add_streets(self):
# Add euclidean distance multiplied by some value
loc1 = self.G.nodes[edge[0]]['location']
loc2 = self.G.nodes[edge[1]]['location']
dist = ((loc1['x']-loc2['x'])**2 + (loc2['y']-loc2['y'])**2)**0.5
dist = ((loc1['x']-loc2['x'])**2 + (loc1['y']-loc2['y'])**2)**0.5
self.G.edges[edge]['dist'] = dist * uniform(1.0, 2.0)

def draw(self, filename=None, verbose=False):
Expand Down

0 comments on commit c022d9c

Please sign in to comment.