fix some errors when routing

This commit is contained in:
Laura Klünder 2016-12-21 11:33:53 +01:00
parent 351f34e584
commit 0445dcc464
2 changed files with 2 additions and 2 deletions

View file

@ -269,7 +269,7 @@ class Graph:
orig_points_i, orig_distances, orig_ctypes = self.get_location_points(origin, 'orig') orig_points_i, orig_distances, orig_ctypes = self.get_location_points(origin, 'orig')
dest_points_i, dest_distances, dest_ctypes = self.get_location_points(destination, 'dest') dest_points_i, dest_distances, dest_ctypes = self.get_location_points(destination, 'dest')
if not orig_points_i or not dest_points_i: if not len(orig_points_i) or not len(dest_points_i):
raise NoRouteFound() raise NoRouteFound()
add_orig_point = origin if isinstance(origin, PointLocation) else None add_orig_point = origin if isinstance(origin, PointLocation) else None

View file

@ -264,7 +264,7 @@ class GraphRoom():
def _build_router(self, ctypes, public, nonpublic, avoid, include): def _build_router(self, ctypes, public, nonpublic, avoid, include):
ctype_factors = np.ones((len(self.ctypes), 1, 1))*1000 ctype_factors = np.ones((len(self.ctypes), 1, 1))*1000
ctype_factors[ctypes] = 1 ctype_factors[ctypes, :, :] = 1
distances = np.amin(self.distances*ctype_factors, axis=0).astype(np.float32) distances = np.amin(self.distances*ctype_factors, axis=0).astype(np.float32)
factors = np.ones_like(distances, dtype=np.float16) factors = np.ones_like(distances, dtype=np.float16)