-
Notifications
You must be signed in to change notification settings - Fork 30
Omit end variables in scheduling constraints #694
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
base: master
Are you sure you want to change the base?
Conversation
demand_at_t += demand * ((start[job] <= t) & (t < end[job])) | ||
else: | ||
demand_at_t += demand[job] * ((start[job] <= t) & (t < end[job])) | ||
demand_at_t += demand[job] * ((start[job] <= t) & (start[job] + duration[job] > t)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the above? It covers the case that the demand is given as a single number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is fixed in the constructor (already a while, but decompose was not adapted yet)
assert is_any_list(start), "start should be a list" | ||
assert is_any_list(duration), "duration should be a list" | ||
assert is_any_list(end), "end should be a list" | ||
|
||
assert demand is not None, "demand should be provided but was None" | ||
assert capacity is not None, "capacity should be provided but was None" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what should be done here, but I am not really a fan of giving them a default value (making them optional) and then not allowing the optional value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I also agree it is quite annoying... For now this is the best I could come up with, as you cannot make an argument in the middle optional...
Proposal to omit the end variables in scheduling constraints such as Cumulative and NoOverlap.
Makes
end
None by default, and adapts solver behaviour accordingly.It was not possible to make the "dummy" end variables in the constructor, as then they would be added to
user_vars
in the solver interface, which is incorrect.Most solvers don't actually need the
end
variables in their interface either, except for OR-Tools.Added a helper-function
get_end_vars
to create these dummy end variables.