torressa / cspy

A collection of algorithms for the (Resource) Constrained Shortest Path problem in Python / C++ / C#
https://torressa.github.io/cspy/
MIT License
77 stars 24 forks source link

Return None if no feasible path is found #53

Closed Kuifje02 closed 3 years ago

Kuifje02 commented 3 years ago

Hi David,

I have noticed that if no feasible path is found, the following exception is raised:

Exception: Please call the .run() method first

This can happen in at least two situations:

I think it would be nice to return None (in bidirec.path/bidirec.total_cost, etc), instead of raising the Exception. This way the user would know that there is nothing wrong with his data, its just that there is no feasible path. Also the current exception may be misleading as the .run()method was called, but it was just not able to find a path successfully.

torressa commented 3 years ago

Thanks @Kuifje02! It is pretty annoying, I'll get rid of it in the next version (working on it...)

torressa commented 3 years ago

Just committed some WIP 3048e8a2948fd28e1debb4155156f1307cef9239 for the new release.. Coming soon!