Skip to content

Commit 00e2ef3

Browse files
committed
[Refactor] Adjust handling of removed operation nodes in JobShopGraph
1 parent 4cb5ed9 commit 00e2ef3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

job_shop_lib/graphs/_job_shop_graph.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ def __init__(
128128

129129
if add_operation_nodes:
130130
self.add_operation_nodes()
131-
132-
self.removed_nodes[NodeType.OPERATION.name.lower()] = [
133-
False
134-
] * instance.num_operations
135-
136131
self.edge_types = set[tuple[str, str, str]]()
137132

138133
def get_networkx_graph(self) -> nx.DiGraph:
@@ -242,6 +237,10 @@ def add_node(self, node_for_adding: Node) -> None:
242237
self.instance_id_map[NodeType.OPERATION.name.lower()][
243238
operation.operation_id
244239
] = node_for_adding
240+
if NodeType.OPERATION.name.lower() not in self.removed_nodes:
241+
self.removed_nodes[NodeType.OPERATION.name.lower()] = [
242+
False
243+
] * self.instance.num_operations
245244
elif node_for_adding.node_type == NodeType.MACHINE:
246245
self.instance_id_map[NodeType.MACHINE.name.lower()][
247246
node_for_adding.machine_id

0 commit comments

Comments
 (0)