Grouping a BiConstraintStream #1045
Replies: 2 comments 6 replies
-
I should add, I have the constraint fully functional by grouping all tasks into one mega list and then looping it with all slices, but the benchmark tests show that it's just painfully slow, so I am trying to approach this in a more performant way. |
Beta Was this translation helpful? Give feedback.
-
Without having access to your codebase, I'm going to type up some Java code to solve your issue, hoping that you'll be able to adapt it to the specifics of your codebase:
This code will take all the splices overlapping a task, group them by task, and sum their durations. Side note: in the summation function, you'd be well-advised to only sum the actual overlap, and not the entire splice duration; that way, your penalty will better reflect the size of the actual breach of the constraint, and therefore help you avoid score traps. |
Beta Was this translation helpful? Give feedback.
-
I am hoping I can get some advice for how to frame this, because it's escaping me.
I have a series of
Task
planning entities, and a set of time intervals in my solution that I called aShiftSlice
that is marked with@ProblemFactCollectionProperty
. What I need to do is add up all the tasks that overlap a given slice of time, to see if I have to many tasks at any one given point in time for a predefined limit (each slice has a property for the limit of that slice of time).What I am trying to do (maybe wrongly) is
This last part is where it is falling apart, and I am pretty sure I am approaching grouping incorrectly. Basically I want to get a given slice, and a list of all tasks that overlap that slice, so I can count them per slice and assign a possible penalty. I so see there is a
sum
collector, which i will have to explore (because ultimately that's what I am doing), but am I even approaching this in the right line of thought?Beta Was this translation helpful? Give feedback.
All reactions