N
N
Nick Chopper2021-03-29 19:44:27
Mathematics
Nick Chopper, 2021-03-29 19:44:27

How to soften exponential shutter speed?

It would be strange that the exhibitor was not such an exhibitor. I'm using an exponential backoff algorithm delay = min(2^attempt * base_delay, max_delay)and I'm happy with how the delay soars from ten seconds to a couple of hours on the first attempts, but I'm not happy with further growth rates. I would like to somehow soften the increments for large values ​​of attempt, but to my shame I can’t figure out how.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twobomb, 2021-03-29
@twobomb

I don’t quite understand, well, it may be necessary to reduce the attemp increment, which will give smoother and longer values.
And if you need everything to go quickly at first, and more smoothly at the end. Then at the beginning you take a big step, and the closer to the end, the smaller the step. Thus, at first the set will go quickly, and in the future it will develop into a slower and smoother one, depending on how much you change the increment step.
You can multiply each increment step by such garbage
(1 - last_delay / max_delay)
last_delay is the previous delay, the first step can be made equal to zero
But anyway, in this case, the closer to the end, the more it tends to infinity and krch there is an option that it never will end so you need to modify a little for example like this
(0.2 + (1 - last_delay/max_delay) * 0.8)
How to use it? Multiply the increment of your attemp by this crap
For example, you have step = 0.5
So every iteration
step = 0.5 * (0.2 + (1 - last_delay/max_delay) * 0.8)
Krch I'm not a mathematician, think try

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question