I have this problem of scheduling tasks. Each task has a suggested start time T (it needs to start at [T-10, T+10]), takes L minutes to complete and uses a number of resources [R1, R2,…]. When a resource is being used, no other task can use it. Given that only the start time is flexible, my goal is to schedule the tasks so that they can access any resource they need or point out all the conflicts that needs resolving.
Which algorithm can I use for this purpose? Thank you.
Since you’ve tagged this as
prolog, I recommend implementing it in constraint logic programming (CLP) and using the algorithms built into your CLP implementation. Partial example:Another predicate would check that no two tasks use the same resource concurrently:
Finally, call
labelingon all the constrained variables to give them consistent values. This uses CLP(fd), which works for integer time units. CLP(R) does the same for real-valued time but it slightly more complicated. Links are for SWI-Prolog but SICStus and ECLiPSe have similar libraries.