# remainings[0] = 0 # remainings[1] = min_period # remainings[remaining_count] = remaining # >>> def remainings(idx, remaining_count, remaining, min_delay): # ... a = (remaining / remaining_count - min_delay) / (remaining_count - 1) # ... b = min_delay - a # ... return a * idx * idx + b * idx
ok hash out context issue. remaining here i'm not sure what it means. it's defined as the time left at remainings[remaining_count] i guess that would be mark_time. the time of last execution. now we want to know the delay for the next time. so then remainings[remaininng_count] = eta - mark_time # remainings[0] = 0 # remainings[1] = min_period # remainings[remaining_count] = eta - mark_time # >>> def remainings(idx, remaining_count, eta, mark_time, min_delay): # ... a = ((eta - mark_time) / remaining_count - min_delay) / (remaining_count - 1) # ... b = min_delay - a # ... return (a * idx + b) * idx we could then recast everything based on absolute times which might be clearer for me after some thought and noting i guess that means just subtracting from eta at first # reversetimepoint[0] = eta # reversetimepoint[1] = eta - min_delay # reversetimepoint[remaining_count] = mark_time # >>> def reversetimepoints(idx, remaining_count, eta, mark_time, min_delay): # ... a = (mark_time / remaining_count - min_delay) / (remaining_count - 1) # ... b = eta - min_delay - a # ... return eta - (a * idx + b) * idx want to solve for a,b,c again