| 9 | using pyvrp::search::SwapStar; |
| 10 | |
| 11 | void SwapStar::updateRemovalCosts(Route *R, CostEvaluator const &costEvaluator) |
| 12 | { |
| 13 | for (auto const *U : *R) |
| 14 | { |
| 15 | auto const idx = U->idx(); |
| 16 | auto const proposal |
| 17 | = Route::Proposal(R->before(idx - 1), R->after(idx + 1)); |
| 18 | |
| 19 | Cost deltaCost = 0; |
| 20 | costEvaluator.deltaCost<true, true>(deltaCost, proposal); |
| 21 | removalCosts(R->idx(), U->client()) = deltaCost; |
| 22 | } |
| 23 | |
| 24 | isCached(R->idx(), 0) = true; // removal costs are now updated |
| 25 | for (size_t idx = data.numDepots(); idx != data.numLocations(); ++idx) |
| 26 | isCached(R->idx(), idx) = false; // but insert costs not yet |
| 27 | } |
| 28 | |
| 29 | void SwapStar::updateInsertPoints(Route *R, |
| 30 | Route::Node *U, |