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

Label::checkDominance can break out if all_res_equal=false #92

Closed mgalati13 closed 2 years ago

mgalati13 commented 2 years ago

This may not make a big performance difference, but it seems like after L167, when all_res_equal=false in https://github.com/torressa/cspy/blob/master/src/cc/labelling.cc

that you can break out of the loop, since all_res_equal can't be true at that point.

mgalati13 commented 2 years ago

Another small improvement that might help is during that loop to flag if resource consumption is >. Then you can break out without going into another loop.

Something like issue92.txt.

mgalati13 commented 2 years ago

issue92.txt

torressa commented 2 years ago

Hi @mgalati13! Thanks for reporting this. I have already changed this, waiting for some other changes for the next release https://github.com/torressa/cspy/blob/beb3cb829f3932bf07bf3951eb82aeba5a560a5d/src/cc/labelling.cc#L167-L173