MCPcopy Create free account
hub / github.com/PyVRP/PyVRP / updateRemovalCosts

Method updateRemovalCosts

pyvrp/cpp/search/SwapStar.cpp:11–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9using pyvrp::search::SwapStar;
10
11void 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
29void SwapStar::updateInsertPoints(Route *R,
30 Route::Node *U,

Callers

nothing calls this directly

Calls 7

ProposalClass · 0.85
idxMethod · 0.80
beforeMethod · 0.80
afterMethod · 0.80
clientMethod · 0.80
numLocationsMethod · 0.80
numDepotsMethod · 0.45

Tested by

no test coverage detected