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

Dominance criteria? #96

Closed the-soomin-woo closed 2 years ago

the-soomin-woo commented 2 years ago

Hi @torressa,

I have been using your package pulled a few months ago. I'm studying how the dominance rule was implemented and read a recent post here.

Q1) Did you implement the update from the post in the cspy? I don't see a difference on the labelling.cc.. Q2) I would love to design a custom dominance rule in the cspy, but I am unsure where it runs. I see there are functions defined like checkDominance(), fullDominance(), and runDominanceEff(). But I don't see any of these functions used in the functions like extend() or checkFeasibility(). Am I missing something or the current implementation doesn't run the dominance check?

I've said it before but let me say it again, your work is amaze-balls. Thank you!

Soomin

torressa commented 2 years ago

Thanks for your kind words Soomin! :)

The dominance check lives only in checkDominance, so if you want to change it will be there. The version of the dominance in the discussion you linked ended up being just slightly different than the previous version (only change is the check for equality in the unreachable nodes). It has not been released or pushed to master yet, but you can see it in the dev branch. I have, for example, created a custom dominance check for the pickup and delivery VRP, you can see it in the vrpy_patch15 branch.

Dominance is ran when you have a new candidate label and want to check that it is not dominated / if it dominates other labels, this is done mostly in runDominanceEff, where checkDominance is called twice:

https://github.com/torressa/cspy/blob/ab62a01aac25755ab0ee8a76d9d82e4d76b8a1f8/src/cc/labelling.cc#L304-L314

fullDominance is kind off strong dominance, as label dominance is checked in both directions. But again, checkDominance is where the magic happens.

Label extension (extend) and feasibility checks are independent of this. Also, the comments of what each function does, check out the header files *.h or the C++ API.

the-soomin-woo commented 2 years ago

Thank you for your awesome reply, @torressa!