Closed dreinon closed 2 years ago
Does that occur each time you launch the script?
Yes, but only with this worker
It's weird because all workers have the same periods, and it only happens with this exact one worker
Does it have something specific compared to the other workers?
The number of tasks assigned to it and its unavailability. These elements are different for each worker.
Found out the reason! Since this worker only had one task assigned, it didn't make sense to create a ResourceTasksDistance constraint. Maybe we can add a corner case to the constraint to avoid this case, only letting users use it with workers who have more than one tasks assigned.
ok, could you contribute at most 10 lines of code so that I can reproduce the bug and add this case to the unittest suite?
import processscheduler as ps
# Error
pb = ps.SchedulingProblem('problem', 5)
worker = ps.Worker('worker')
task = ps.FixedDurationTask('task', 1)
task.add_required_resource(worker)
ps.ResourceTasksDistance(worker, 0, [(0,5)])
solver = ps.SchedulingSolver(pb)
solver.solve()
import processscheduler as ps
# Fixed adding another task
pb = ps.SchedulingProblem('problem', 5)
worker = ps.Worker('worker')
task1 = ps.FixedDurationTask('task1', 1)
task2 = ps.FixedDurationTask('task2', 1)
task1.add_required_resource(worker)
task2.add_required_resource(worker)
ps.ResourceTasksDistance(worker, 0, [(0,5)])
solver = ps.SchedulingSolver(pb)
solver.solve()
I'm getting the following error when executing the scheduler, when it gets to
ps.ResourceTasksDistance(worker, 0, periods)
:Periods variable is:
[(3, 8), (17, 20), (8, 20), (28, 35), (8, 16), (28, 38), (2, 3), (0, 2), (35, 38), (24, 28), (21, 24), (20, 28), (0, 8), (16, 17), (20, 21)]
Assertion hashes since this constraint is declared are:
Any ideas?
Thanks!