-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Describe the bug
At line 155-163, the indentation of "if-else" seems wrong.
The "for" loop will constantly check if the current cumulative resource usage (total_res) exceeds the minimum resource usage (self.min_res), is it correct and reasonable?
Suggestions
I have modified the source code like this:
flag = 1
# Check path for resource feasibility by adding one edge at a time
for edge in shortest_path_edges_w_data:
cost += edge[2]["weight"]
if isinstance(self.REF, BuiltinFunctionType):
total_res += self._edge_extract(edge)
else:
total_res = self.REF(
total_res, edge[0], edge[1], edge[2]["res_cost"], None, None
)
total_res = array(total_res)
if not ((all(edge[2]["res_cost"] <= self.max_res) and all(edge[2]["res_cost"] >= self.min_res))
):
flag = 0
break
if flag:
# Fesible path found. Save attributes.
if save:
self.save(total_res, cost)
return True
Looking forward your reply. Thank you.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels