Problem
The speed_factor in the vehicle does not scale vehicle travel times properly for higher values.
Specifically, the output produced is same for the same values of std::round(100/speed_factor). So,
- with
speed_factor > 200, all durations are 0 and random routes are computed
- the scaling logic is flawed if
100 <= speed_factor <= 200, i.e., the result is same for any speed factor in this range.
- the results are "almost" fine if
0 < speed_factor <= 100, but the time values in the output may not be exact. e.g. speed_factor = 70 and speed_factor = 100 produce the same result, because 100/70 ~ 100/100 ~ 1.
For small values of speed_factor, everything is fine.
Also,
speed_factor = 0 sounds like an undefined behaviour.
speed_factor < 0 is also possible, leading to random outputs.
To Reproduce
Change the speed_factor values in the input json and compare the result.
Expectation
Only positive values of speed_factor must be allowed, and the vehicle travel times shall scale properly for any values of the speed_factor.
Problem
The
speed_factorin the vehicle does not scale vehicle travel times properly for higher values.Specifically, the output produced is same for the same values of
std::round(100/speed_factor). So,speed_factor > 200, all durations are0and random routes are computed100 <= speed_factor <= 200, i.e., the result is same for any speed factor in this range.0 < speed_factor <= 100, but the time values in the output may not be exact. e.g.speed_factor = 70andspeed_factor = 100produce the same result, because100/70 ~ 100/100 ~ 1.For small values of
speed_factor, everything is fine.Also,
speed_factor = 0sounds like an undefined behaviour.speed_factor < 0is also possible, leading to random outputs.To Reproduce
Change the
speed_factorvalues in the input json and compare the result.Expectation
Only positive values of
speed_factormust be allowed, and the vehicle travel times shall scale properly for any values of thespeed_factor.