Skip to content
Snippets Groups Projects
Commit 1be223dd authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Enable sorting of print_slacks

parent aaf8003d
No related branches found
No related tags found
1 merge request!306Enable sorting of print_slacks
Pipeline #95429 passed
......@@ -262,8 +262,20 @@ class Schedule:
raise ValueError(f"No operation with graph_id {graph_id} in schedule")
return self.backward_slack(graph_id), self.forward_slack(graph_id)
def print_slacks(self) -> None:
"""Print the slack times for all operations in the schedule."""
def print_slacks(self, order: int = 0) -> None:
"""
Print the slack times for all operations in the schedule.
Parameters
----------
order : int, default: 0
Sorting order.
* 0: alphabetical on Graph ID
* 1: backward slack
* 2: forward slack
"""
res = [
(
op.graph_id,
......@@ -280,7 +292,7 @@ class Schedule:
)
for r in res
]
res.sort(key=lambda tup: tup[order])
print("Graph ID | Backward | Forward")
print("---------|----------|---------")
for r in res:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment