There are hundreds of thousands of periodic tasks, where each must be performed with its own repeat period: once at 12 o'clock, for others, at 15 minutes, for example.
In addition to the period P , the task has two more parameters: the time T , when it can already be started (not earlier), and the urgency coefficient K , which means how quickly the priority of this task increases linearly since T. Other things being equal, K = 1/Period .
The workflow is discrete, it is launched in “steps” every 5 minutes per crown. Each time he takes an armful of tasks, from those that can already be performed, focusing on the priorities at the moment of these tasks, and no more than its own “capacity”, which is limited.
Situation: at one point in time, 1000 new assignments came at once. With a capacity of 300 tasks in one step, such a peak will cause an avalanche of delays in all tasks. Therefore, this 1000 tasks must be gradually scattered, so that they go not at a single moment, but + -. But they “departed” for these new positions not instantly, but for some time. For example You can limit the rate of "creeping" of each task in% of its period.
Question : how to adjust the phase of the periodic tasks so that the load peaks “smear” over time? In this case, it is necessary that if some task moved, it did it gradually, in small steps. Here it is important that the interval of each assignment be as close as possible to the target - for someone it is 12 hours, for someone 15 minutes.
By analogy with the physical world, as I imagine, it looks like a pile of particles (sand crystals) on the surface. In order for the grains of sand to be distributed more or less evenly, the surface must be shaken over and over again. Each time the particles tend to move away from their neighbors. And this gradually leads to a uniform distribution.
Maybe there is a well-known algorithm that describes such a model?
T = Tпред + Period- SergiksTyou have "floating"? in my opinion, this greatly simplifies the required algorithm. - aleksandr barakinTfixed, the problem would not have a solution. And so it is floating, but with "viscosity." - SergiksTI understood that the task has a certainT0(possibly in the future), and it should be started at the momentT0+n*P, wheren=0, 1, 2, …, ∞. - aleksandr barakin