Skip to content

Scaling logic of speed_factor is flawed for high values #591

@krashish8

Description

@krashish8

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions