PhysicsOfMobility/ridepy

Delay is not updated in is_timewindow_violated_dueto_insertion()

matdahl opened this issue · 1 comments

auto delta_cpat = new_departure - old_departure;

Shouldn't this update the delay/delta_cpat variable defined in

auto delta_cpat = (est_arrival_first_stop_after_insertion -

so that the new delay is used when checking the next stop?

Currently, the value computed in this line is lost after leaving the else block.

PS: to check whether the delay totally vanished, it's more save to check new_departure == old_departure or even better stop->time_window_min >= stop->estimated_arrival_time + delta_cpat to avoid rounding errors that might prevent breaking the loop here.

Thanks for reporting this! I have fixed in #215.