-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buggy planning in 2093 #1020
Comments
I had a look and was able to find the problem. It happens during scaling of end of job time window to vroom/src/algorithms/validation/choose_ETA.cpp Lines 1255 to 1256 in 830ad8c
The job time window is default, that is start is 0 and end is std::numeric_limits<Duration>::max() . This is expected as evidenced by the assertion in vroom/src/algorithms/validation/choose_ETA.cpp Lines 1253 to 1254 in 830ad8c
but then the scaling function cannot fit the scaled value in the Duration type.As a quick check I changed the scaling function to check for this max value inline UserDuration scale_to_user_duration(Duration d) {
if (d == std::numeric_limits<Duration>::max()) {
return std::numeric_limits<UserDuration>::max();
}
return static_cast<UserDuration>(d / DURATION_FACTOR);
} and it worked fine, but this isn't really a proper solution. Maybe it would be better to redefine the default time window to |
Thanks for investigating. I get it that when But now I first thought the overflow was related to the higher values in the vehicle time window. But it looks like the overflow is happening for both instances (and any time we have a default TW), it's just that in the second instance the vroom/src/algorithms/validation/choose_ETA.cpp Lines 1255 to 1262 in 830ad8c
@kkarbowiak do you share this analysis? In which case this is worse than I first thought. |
Well, adding the following assert to diff --git a/src/structures/typedefs.h b/src/structures/typedefs.h
index 79ef1ec1..49f9607d 100644
--- a/src/structures/typedefs.h
+++ b/src/structures/typedefs.h
@@ -195,6 +195,8 @@ inline Duration scale_from_user_duration(UserDuration d) {
}
inline UserDuration scale_to_user_duration(Duration d) {
+ assert(d <= DURATION_FACTOR * static_cast<Duration>(
+ std::numeric_limits<UserDuration>::max()));
return static_cast<UserDuration>(d / DURATION_FACTOR);
} We should probably add that prior to any fix to fail early in any other similar situation, same for Your suggestion on updating the default |
Yes, the overflow happens in any instance with a default TW. It looks like the bug will affect all calculations with dates starting at May, 1st, 2035. |
Yup. Will have a PR ready today. |
I'd still like to get that fixed in 2023. ;-) |
Fixed in #1040 |
I've noticed a buggy behavior of
plan
mode when using high values of timestamps. This was showing up in a more complex setup but can be reproduced with the following randomly generated minimal (non-)working example.Now using plan mode on those yields different results:
The delay showing up is on the job step which is clearly wrong. The fact that some delay shows up on a non time constrained task, plus the fact that it happens when significantly increasing the TW values seems to hint to some kind of overflow somewhere.
The text was updated successfully, but these errors were encountered: