Reputation: 661
I want to implement the following job/resource scheduling problem:
I am looking for:
If there were no resource pools, but only 1 resource of each type, the problem would probably be much simpler. I am familiar with the basics in graph theory and simple dataflow analysis algorithms.
Upvotes: 3
Views: 412
Reputation: 65506
I think I'd modify your description by introducing the concept of "named resources" where a named resource is a name and a collection of unnamed resources. Then jobs can depend on named and unnamed resources, and every named resource must stay resident from the time that the first job using it starts to the time that the last job using it ends.
Formally, we have
For checking schedule feasibility, there's no reason to run jobs in parallel. Therefore, what we want is a linear extension of < of ≺ that fits. In formal terms closer to what a solver could handle, we would define < from a bijection π from J to {0, 1, …, n-1} that satisfies
∑x ∈ X [sx ≤ t ≤ ex] Z(x) + U(π-1(t)) ≤ A,
where [condition] is the Iverson bracket (1 if the condition is met, else 0) and ≤ is the standard partial order on vectors.
To test schedule feasibility, I'd feed something like this formulation to a CP-SAT solver (e.g., https://developers.google.com/optimization/cp/cp_solver).
To schedule online, I'd use a variant of Dijkstra's Banker's algorithm that uses the offline test to see whether it's safe to start a job whose dependencies are finished. This will get the parallelism back since it may be OK to start multiple jobs.
Upvotes: 1