Closed WarnerLensing closed 4 years ago
Cheers @WarnerLensing ! Looking into it
Got a fix for the mono-directional cases and bi-directional when both directions are searched. A bit triciker to make it compatible for when either direction is not searched.
Sorry, might take a bit of time, if urgent, use the version in the patch41
branch with either
direction="forward"/"backward"
direction="both"
with method="generated"
.Fixed, in branch patch43
. Will be merged and released on Pypi.
Hi, I am experiencing an issue concerning the minimum resources provided to the bidirectional algorithms. According to the documentation min_res is the minimum resource usage to be enforced for the resulting path. However, if I implement a min_res that is higher than 0, it is just added to the consumed resource instead of enforcing the resulting path to use this as lower bound. An example:
from cspy import BiDirectional
from networkx import DiGraph
from numpy import array
G = DiGraph(directed=True, n_res=2)
G.add_edge("Source", "A", res_cost=array([1, 1]), weight=10)
G.add_edge("A", "B", res_cost=array([1, 0]), weight=3)
G.add_edge("A", "C", res_cost=array([1, 1]), weight=10)
G.add_edge("B", "C", res_cost=array([1, 0]), weight=3)
G.add_edge("B", "Sink", res_cost=array([1, 1]), weight=5)
G.add_edge("C", "Sink", res_cost=array([1, 1]), weight=0)
max_res, min_res = [4, 20], [0, 3]
bidirec = BiDirectional(G, max_res, min_res, direction="forward")
bidirec.run()
print(bidirec.path)
print(bidirec.consumed_resources)
the output is:
[Source', 'A', 'B', 'C', 'Sink']
[4 5]
It seems like it is just adding min_res to the consumed resources. To satisfy the minimum resources it should pick edge (A,C). Now it picks edges (A,B) and (B,C) instead. My operating system is macOS Mojave 10.14.6. Can anyone help me solving this problem?