I am looking for an algorithm to calculate the next set of operations in a sequence. Here is a simple sequence definition.
- Task 1A will run every 500 hours.
- Task 2A will run every 1000 hours.
- Task 3A will run every 1500 hours.
So, at t = 500, do 1A. For t = 1000, do both 1A and 2A, for t = 1500 do 1A and 3A, but not 2A, since 1500 is not a multiple of 1000. You get the idea.
It would be very easy if I had the actual time, but I do not. I have a history of tasks (for example, the last time [1A + 2A] was executed).
Knowing the last time (for example, [1A + 2A]) is not enough to decide:
- [1A + 2A] can be at t = 1000: the following - [1A + 3A] at t = 1500
- [1A + 2A] can be at t = 5000: next - [1A] at t = 5500
Is there an algorithm for this? This seems like a familiar problem (some sort of sieve?), But I can't find a solution.
It should also be βscalable," because I actually have more than three tasks.
source share