Commit 1f61869
committed
Backport: Fix issue google#4133 - Correct negative transit handling in FinalizeAllowedVehicles (v9.12)
Backports the fix from PR google#4868 to v9.12 branch.
The FinalizeAllowedVehicles() optimization incorrectly excluded vehicles
from nodes with negative unary transits. The bug checked abs(transit)
against capacity alone, but negative transits are feasible when
abs(transit) <= capacity + slack_max (vehicle can absorb the negative
transit via both capacity headroom and dimension slack).
This caused heterogeneous VRP problems with reload/load-tracking
dimensions to incorrectly exclude smaller vehicles, forcing suboptimal
solutions with dropped stops.
The fix properly bounds negative transits by combining capacity and
slack_max, while positive transits continue to check capacity alone.
Changes:
- Pre-processing now tracks max positive transit, min (negative) transit,
and slack_max separately instead of using abs() on all transits
- Capacity optimization check considers both positive and negative bounds
- Per-node feasibility check uses proper bounds: transit <= capacity &&
transit >= min_allowed_transit
Tested with regression script from issue google#4133.
Fixes google#4133
Backport-of: google#48681 parent b8e881f commit 1f61869
1 file changed
+31
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1402 | 1402 | | |
1403 | 1403 | | |
1404 | 1404 | | |
1405 | | - | |
1406 | | - | |
1407 | | - | |
1408 | | - | |
1409 | | - | |
1410 | | - | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
1411 | 1417 | | |
1412 | 1418 | | |
1413 | 1419 | | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
1417 | 1427 | | |
1418 | 1428 | | |
1419 | 1429 | | |
| |||
1428 | 1438 | | |
1429 | 1439 | | |
1430 | 1440 | | |
1431 | | - | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1432 | 1448 | | |
1433 | 1449 | | |
1434 | 1450 | | |
| |||
1437 | 1453 | | |
1438 | 1454 | | |
1439 | 1455 | | |
1440 | | - | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
1441 | 1461 | | |
1442 | 1462 | | |
1443 | 1463 | | |
| |||
0 commit comments