Closed dreinon closed 3 years ago
Perhaps another way to see the problem would be to add a restriction to constraints, for example, a constraint that applies if and only if a task is scheduled within a given time interval
Right, well, it was just an example, I actually need it in order to compute an expression related to tasks starts and ends from a specific time interval. I need to use this expression in an indicator
The expression is about tasks distance in a time interval. It's a loss indicator that gets all the tasks of a resource in a certain time interval, goes through the tasks two by two in order, and sums 1 if they are not consecutive (task[i].end != task[i+1].start
) or 0 if they are.
My point is that if the solver minimizes this indicator, then there won't be as many tasks that are not contiguous, but with the constraint mentioned at #83, this might get solved.
Just to go on with the issue title, to get the tasks that are scheduled in a time interval for a certain resource, you can use the busy_intervals
dict for which keys are tasks:
worker = Worker('myWorker')
for task in worker.busy_interval:
task_is_scheduled_in_this_interval = And(task.start >= bound_min, task.end<=bound_max)
task_is_scheduled_in_this_interval
would be a BoolRef that wouldn't become a bool until problem is solved right?
right.
Ok thanks! Closing this issue.
Hi, following the #80 issue, it would be nice to have an iterator-kind expression that lets you work with the tasks of a resource that will be schedules between an specified time interval.
This would allow many things. For instance, if days are represented in the problem as a partition of the time, then we would be able to apply constraints only to the tasks that will be scheduled in a specific day.