Replies: 2 comments 2 replies
-
(maybe toList is ok if it's the absolute last step in the constraint chain?) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Your answer most likely lies in the consecutive constraint collector. This allows you to group data into clusters, and to check their length as well as the length of the gaps between the clusters. This operation is fully incremental. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to implement a constraint that's something like "the maximum number of hours worked in any N day period by a single employee is M" in an employee scheduling problem, where hours are a property of individual shifts. In Postgresql I'd probably use some kind of window function (PARTITION OVER etc), but I couldn't find a primitive that did that in timefold. I can sort of see how I could use toList once I group over Employee by sorting and manually sliding a time window over that list, but I was wondering: is there a more idiomatic way to handle this?
Beta Was this translation helpful? Give feedback.
All reactions