fix some errors when routing
This commit is contained in:
parent
351f34e584
commit
0445dcc464
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue