-
Notifications
You must be signed in to change notification settings - Fork 322
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
Prevent overflows when using custom matrix costs #50
Comments
With some matrix vroom fails on assert or run forever probably due to overflow.
|
This is indeed due to the huge costs that can't be added without overflowing. With those kind of failing examples, the solving part is ok again when switching from The trouble here is that those huge values describe points that can't be reached (from or to), so the problem is ill-formed. For example, using So we should rely on the user to avoid this situation altogether (remove inaccessible points), but maybe there is a need for a warning of some kind here, or a limitation of the input cost in the matrix that would guarantee everything is fine afterwards ? |
We should decide on a way to prevent overflows causing troubles when huge costs are used in custom input. Trying to reproduce the above with current {
"vehicles": [
{
"id": 0,
"start_index": 0,
"end_index": 0
}
],
"jobs": [
{
"id": 1,
"location_index": 1
},
{
"id": 2,
"location_index": 2
},
{
"id": 3,
"location_index": 3
}
],
"matrix": [
[0, 1, 2147483647, 2147483647],
[2147483647, 0, 2147483647, 2147483647],
[2147483647, 2147483647, 0, 2147483647],
[2147483647, 2147483647, 2147483647, 0]
]
} we don't hit the same assertion but the local search goes on endlessly as overflows make it seem like we find endless improvements. Verbose output loops on:
|
What is the prefered solution outcome?
I guess a static extend of memory space for the variables won't do, since we would always at some point will hit a border, if we want to achieve scenario one. From the users perspective - at which point is it relevant for them to optimize their solution up to more then the 10th relevant digit? My suggestion: Parsing the input from the matrix and try count the sum of all entries with a |
@PattyDePuh 2nd option: we want to stop whenever huge values are likely to cause an overflow when computing costs. I think using As you suggest, we need to come up with a good upper bound on the overall cost when parsing the matrix. Summing all entries sounds like a very loose bound, we can probably find something simple with a smaller gap. |
I don't think, that there is an "easy" way, if we like to utilize the most out of the
The first one is the easiest to implement, but there is still some more room: if one entry is above the dynamic upper bound, then it does not necessarily mean, thats the worst possible route would ever exceed our To determine roughly the worst possible route, we could sum up the highest entry of every collumn of the input matrix. |
Plan to compute a generic upper bound that should be ok for any type of VRP. While parsing the matrix, we store the max value
Our upper bound is |
The above bound is probably a bit "loose" but should be fine though, and it's fast to compute. The bound value is around 4 or 5 times bigger than the cost of the heuristic solution for small problems on medium areas, and up to around 50 times for bigger problems on wider geographical scale. As an example, running on a random problem with 5000 points at (french) national scale provides a bound of AFAICT this should leave enough room to solve big problems while being confident we don't run into trouble with overflows. |
For the record, the initial reported assertion can be hit on current master using: {
"vehicles": [
{
"id": 0,
"start_index": 0,
"end_index": 0
}
],
"jobs": [
{
"id": 1,
"location_index": 1
},
{
"id": 2,
"location_index": 2
},
{
"id": 3,
"location_index": 3
}
],
"matrix": [
[0, 1, 2147483647, 2147483647],
[2147483647, 0, 2147483647, 2147483647],
[2147483647, 2147483647, 0, 2147483647],
[1, 1, 2147483647, 0]
]
} which aborts as expected with #68. |
On some problem vroom fail with:
The text was updated successfully, but these errors were encountered: