| 96 | } |
| 97 | |
| 98 | pyvrp::Cost pyvrp::search::inplaceCost(Route::Node *U, |
| 99 | Route::Node *V, |
| 100 | ProblemData const &data, |
| 101 | CostEvaluator const &costEvaluator) |
| 102 | { |
| 103 | if (U->route() || !V->route()) |
| 104 | return 0; |
| 105 | |
| 106 | auto const *route = V->route(); |
| 107 | ProblemData::Client const &uClient = data.location(U->client()); |
| 108 | ProblemData::Client const &vClient = data.location(V->client()); |
| 109 | |
| 110 | Cost deltaCost = vClient.prize - uClient.prize; |
| 111 | |
| 112 | costEvaluator.deltaCost<true>( |
| 113 | deltaCost, |
| 114 | Route::Proposal(route->before(V->idx() - 1), |
| 115 | ClientSegment(data, U->client()), |
| 116 | route->after(V->idx() + 1))); |
| 117 | |
| 118 | return deltaCost; |
| 119 | } |