correctly implement avoid/exclude
This commit is contained in:
parent
d5a52bf9e3
commit
49757f7c06
8 changed files with 114 additions and 46 deletions
|
@ -211,7 +211,7 @@ class Graph:
|
|||
level.draw_png(points, lines)
|
||||
|
||||
# Router
|
||||
def build_routers(self, allowed_ctypes, public, nonpublic, avoid, include):
|
||||
def build_routers(self, allowed_ctypes, allow_nonpublic, avoid, include):
|
||||
routers = {}
|
||||
|
||||
empty_distances = np.empty(shape=(len(self.level_transfer_points),) * 2, dtype=np.float16)
|
||||
|
@ -223,7 +223,7 @@ class Graph:
|
|||
level_transfers[:] = -1
|
||||
|
||||
for i, level in enumerate(self.levels.values()):
|
||||
routers.update(level.build_routers(allowed_ctypes, public, nonpublic, avoid, include))
|
||||
routers.update(level.build_routers(allowed_ctypes, allow_nonpublic, avoid, include))
|
||||
router = routers[level]
|
||||
|
||||
level_distances = empty_distances.copy()
|
||||
|
@ -268,7 +268,7 @@ class Graph:
|
|||
def _allowed_points_index(self, points, allowed_points_i):
|
||||
return np.array(tuple(i for i, point in enumerate(points) if point in allowed_points_i))
|
||||
|
||||
def get_route(self, origin: Location, destination: Location, allowed_ctypes, public, nonpublic, avoid, include):
|
||||
def get_route(self, origin: Location, destination: Location, allowed_ctypes, allow_nonpublic, avoid, include):
|
||||
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')
|
||||
|
||||
|
@ -285,7 +285,7 @@ class Graph:
|
|||
best_route = NoRoute
|
||||
|
||||
# get routers
|
||||
routers = self.build_routers(allowed_ctypes, public, nonpublic, avoid, include)
|
||||
routers = self.build_routers(allowed_ctypes, allow_nonpublic, avoid, include)
|
||||
|
||||
# route within room
|
||||
orig_rooms = set(point.room for point in orig_points)
|
||||
|
@ -428,7 +428,6 @@ class Graph:
|
|||
distance = shortest_paths.min()
|
||||
|
||||
# Is this route better than the previous ones?
|
||||
print('vialevels', distance, best_route.distance)
|
||||
if distance < best_route.distance:
|
||||
# noinspection PyTypeChecker
|
||||
from_point, to_point = np.argwhere(shortest_paths == distance)[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue