diff --git a/sampo/schemas/landscape.py b/sampo/schemas/landscape.py index 950d9e55..ca362e47 100644 --- a/sampo/schemas/landscape.py +++ b/sampo/schemas/landscape.py @@ -87,7 +87,7 @@ def __init__(self, holders: list[ResourceHolder] = None, lg: LandGraph = None, zone_config: ZoneConfiguration = ZoneConfiguration()): - self.WAY_LENGTH = np.Inf + self.WAY_LENGTH = np.inf self.dist_mx: list[list[float]] = None self.path_mx: np.array = None self.road_mx: list[list[str]] = None @@ -178,7 +178,7 @@ def construct_route(self, from_node: LandGraphNode, to_node: LandGraphNode, for u in range(self.lg.vertex_count): if v == u: path_mx[v][u] = 0 - elif adj_matrix[v][u] != np.Inf and self.road_mx[v][u] in roads_available_set: + elif adj_matrix[v][u] != np.inf and self.road_mx[v][u] in roads_available_set: path_mx[v][u] = v from_ind = self._node2ind[from_node] @@ -246,7 +246,7 @@ def _build_routes(self): for u in range(count): if v == u: path_mx[v][u] = 0 - elif dist_mx[v][u] != np.Inf: + elif dist_mx[v][u] != np.inf: path_mx[v][u] = v for road in self.lg.nodes[v].roads: if self.lg.node2ind[road.finish] == u: @@ -257,8 +257,8 @@ def _build_routes(self): for i in range(self.lg.vertex_count): for u in range(self.lg.vertex_count): for v in range(self.lg.vertex_count): - if (dist_mx[u][i] != np.Inf and dist_mx[u][i] != 0 - and dist_mx[i][v] != np.Inf and dist_mx[i][v] != 0 + if (dist_mx[u][i] != np.inf and dist_mx[u][i] != 0 + and dist_mx[i][v] != np.inf and dist_mx[i][v] != 0 and dist_mx[u][i] + dist_mx[i][v] < dist_mx[u][v]): dist_mx[u][v] = dist_mx[u][i] + dist_mx[i][v] path_mx[u][v] = path_mx[i][v] diff --git a/sampo/schemas/landscape_graph.py b/sampo/schemas/landscape_graph.py index e76174d7..828be0ee 100644 --- a/sampo/schemas/landscape_graph.py +++ b/sampo/schemas/landscape_graph.py @@ -136,7 +136,7 @@ def _to_adj_matrix(self) -> tuple[np.array, dict[LandGraphNode, int], dict[str, id2ind = { v.id: i for i, v in enumerate(self.nodes) } - adj_mtrx = np.full((len(node2ind), len(node2ind)), np.Inf) + adj_mtrx = np.full((len(node2ind), len(node2ind)), np.inf) for v, i in node2ind.items(): for child in v.roads: c_i = node2ind[child.finish] diff --git a/tests/schemas/landscape.py b/tests/schemas/landscape.py index 4c593028..da7fc0c9 100644 --- a/tests/schemas/landscape.py +++ b/tests/schemas/landscape.py @@ -24,7 +24,7 @@ def dijkstra(node_ind, n, target_node_ind): return distances[node_ind][target_node_ind] - MAX_WEIGHT = np.Inf + MAX_WEIGHT = np.inf landscape = setup_landscape_many_holders landscape.build_landscape() @@ -49,7 +49,7 @@ def test_holder_sorting(setup_lg, setup_landscape_many_holders): correct = 0 for node in lg.nodes: target_holder = landscape.get_sorted_holders(lg.node2ind[node])[0][1] - min_dist = np.Inf + min_dist = np.inf received_holder = 0 for holder in holders: dist = landscape.dist_mx[lg.node2ind[node]][lg.node2ind[holder]]