Commit 37dd45ec authored by Alberts S's avatar Alberts S
Browse files

Cleanup

parent ebff059d
......@@ -210,11 +210,6 @@ class ControllerStatic(CapybaraNetty):
if not path_is_already_known:
node_improved_path_info.append(improvement_candidate)
def is_improvement_viable_route(self, improvements: List[Improvement]):
# TODO check whether improvement is viable (e.g is stable for x... seconds)
# Or do we check it as part of Improvement obj?
pass
def find_viable_paths(self, G):
def filter_node(n1):
return G.nodes[n1].get("type") == "router" or (G.nodes[n1].get("type") == "target" and n1 == target)
......@@ -224,16 +219,8 @@ class ControllerStatic(CapybaraNetty):
# We need G routers + single target, filter out all other targets
# otherwise the graph finds shortest path with including external targets
G_subgraph = nx.subgraph_view(G, filter_node=filter_node)
# TODO nonimportant - add cutoff
lengths, paths = nx.single_source_dijkstra(G_subgraph, source=target, weight="weight")
# TODO remove reversed since it was used for testing
for key, path in reversed(paths.items()):
"""
if len(path) > 2 and not (
path[0] in self.external_targets_for_optimizations
and path[-1] in self.external_targets_for_optimizations
):
"""
for key, path in paths.items():
# Avoid a case where self is referenced i.e 'x.x.x.x' - > path to x.x.x.x is [x.x.x.x]
if len(path) > 1:
optimized_ms = G[key][path[0]]["weight"] - lengths[key]
......@@ -268,22 +255,6 @@ class ControllerStatic(CapybaraNetty):
optimized_ms=optimized_ms,
is_current_viable_path=is_current_viable_path,
)
"""
else:
# if a node becomes inactive - we still need to upsert it and make sure its not marked as best path anymore
for node in path:
self.upsert_node_paths(
G,
node,
target=target,
path=path[::-1],
optimized_ms=0,
is_current_viable_path=False,
is_current_best_path=False,
)
# How do we handle internal routes?
"""
return G
def set_viable_improvement_routes(self, G: nx.Graph) -> None:
......
......@@ -33,7 +33,7 @@ class Visualizer(CapybaraNetty):
if target_filtered_graph.number_of_nodes() > 0:
await self.draw_graphs(
target_filtered_graph,
f"optimizations_target_{target}",
f"optimizations_target_{self.translate_target_name(target)}",
)
else:
self.__logger.debug(f"Not drawing graph for {target=} since the filtered graph is empty")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment