Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added conditional time windows #555

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

marcanpilami
Copy link

Use case: some vehicles are not allowed to go to some places only at certain times. For example, many european towns restrict "big" trucks during day time to prevent blocking small roads, but small vehicles stay allowed. Or markets at certain hours forbid all but the smallest vehicles. Etc.

So we need a mecanism to make TW optional. This is what is implemented here: TW can now be inherited, implementing a new extension point verifying if the TW should be applied. If not, the TW is reduced to the default TW (infinity, as already used in other classes).

Side note: I've first asked how to do on S/O at https://stackoverflow.com/questions/76993532/jsprit-conditional-time-windows - I'm very open to other solutions of course. This is my first foray into jsprit code so I would understand if it was found lacking in many ways.

@marcanpilami
Copy link
Author

The PR was updated since its inception: first version only allowed conditional time window. Current version now also allows to do time window exclusions (so as for example to forbid a place for some vehicle types during some hours, as in our initial use case stated above).

To do this, the time window container (TimeWindows), which was already an interface, now allows multiple implementations. This container becomes responsible for giving the list of time windows to apply, dependening on the insertion context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants