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

Method insertCost

pyvrp/cpp/search/primitives.cpp:50–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48} // namespace
49
50pyvrp::Cost pyvrp::search::insertCost(Route::Node *U,
51 Route::Node *V,
52 ProblemData const &data,
53 CostEvaluator const &costEvaluator)
54{
55 if (!V->route() || U->isDepot())
56 return 0;
57
58 auto *route = V->route();
59 ProblemData::Client const &client = data.location(U->client());
60
61 Cost deltaCost
62 = Cost(route->empty()) * route->fixedVehicleCost() - client.prize;
63
64 costEvaluator.deltaCost<true>(
65 deltaCost,
66 Route::Proposal(route->before(V->idx()),
67 ClientSegment(data, U->client()),
68 route->after(V->idx() + 1)));
69
70 return deltaCost;
71}
72
73pyvrp::Cost pyvrp::search::removeCost(Route::Node *U,
74 ProblemData const &data,

Callers

nothing calls this directly

Calls 11

ProposalClass · 0.85
ClientSegmentClass · 0.85
isDepotMethod · 0.80
locationMethod · 0.80
clientMethod · 0.80
beforeMethod · 0.80
idxMethod · 0.80
afterMethod · 0.80
routeMethod · 0.45
emptyMethod · 0.45
fixedVehicleCostMethod · 0.45

Tested by

no test coverage detected