| 52 | } // namespace |
| 53 | |
| 54 | void RelocateWithDepot::evalDepotBefore(Cost fixedCost, |
| 55 | Route::Node *U, |
| 56 | Route::Node *V, |
| 57 | CostEvaluator const &costEvaluator) |
| 58 | { |
| 59 | auto const *uRoute = U->route(); |
| 60 | auto const *vRoute = V->route(); |
| 61 | auto const &vehType = data.vehicleType(vRoute->vehicleType()); |
| 62 | |
| 63 | if (uRoute != vRoute) |
| 64 | { |
| 65 | auto const uProposal = Route::Proposal(uRoute->before(U->idx() - 1), |
| 66 | uRoute->after(U->idx() + 1)); |
| 67 | |
| 68 | for (auto const depot : vehType.reloadDepots) |
| 69 | { |
| 70 | auto deltaCost = fixedCost; |
| 71 | costEvaluator.deltaCost( |
| 72 | deltaCost, |
| 73 | uProposal, |
| 74 | Route::Proposal(vRoute->before(V->idx()), |
| 75 | ReloadDepotSegment(data, depot), |
| 76 | uRoute->at(U->idx()), |
| 77 | vRoute->after(V->idx() + 1))); |
| 78 | |
| 79 | if (deltaCost < move_.cost) |
| 80 | move_ = {deltaCost, MoveType::DEPOT_U, depot}; |
| 81 | } |
| 82 | } |
| 83 | else // within same route |
| 84 | { |
| 85 | auto const *route = vRoute; |
| 86 | for (auto const depot : vehType.reloadDepots) |
| 87 | { |
| 88 | auto deltaCost = fixedCost; |
| 89 | if (U->idx() < V->idx()) |
| 90 | costEvaluator.deltaCost( |
| 91 | deltaCost, |
| 92 | Route::Proposal(route->before(U->idx() - 1), |
| 93 | route->between(U->idx() + 1, V->idx()), |
| 94 | ReloadDepotSegment(data, depot), |
| 95 | route->at(U->idx()), |
| 96 | route->after(V->idx() + 1))); |
| 97 | else |
| 98 | costEvaluator.deltaCost( |
| 99 | deltaCost, |
| 100 | Route::Proposal(route->before(V->idx()), |
| 101 | ReloadDepotSegment(data, depot), |
| 102 | route->at(U->idx()), |
| 103 | route->between(V->idx() + 1, U->idx() - 1), |
| 104 | route->after(U->idx() + 1))); |
| 105 | |
| 106 | if (deltaCost < move_.cost) |
| 107 | move_ = {deltaCost, MoveType::DEPOT_U, depot}; |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 |
nothing calls this directly
no test coverage detected