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

Method removeCost

pyvrp/cpp/search/primitives.cpp:73–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73pyvrp::Cost pyvrp::search::removeCost(Route::Node *U,
74 ProblemData const &data,
75 CostEvaluator const &costEvaluator)
76{
77 if (!U->route() || U->isStartDepot() || U->isEndDepot())
78 return 0;
79
80 auto *route = U->route();
81 Cost deltaCost = 0;
82
83 if (!U->isDepot())
84 {
85 ProblemData::Client const &client = data.location(U->client());
86 deltaCost
87 = client.prize
88 - Cost(route->numClients() == 1) * route->fixedVehicleCost();
89 }
90
91 costEvaluator.deltaCost<true>(deltaCost,
92 Route::Proposal(route->before(U->idx() - 1),
93 route->after(U->idx() + 1)));
94
95 return deltaCost;
96}
97
98pyvrp::Cost pyvrp::search::inplaceCost(Route::Node *U,
99 Route::Node *V,

Callers

nothing calls this directly

Calls 12

ProposalClass · 0.85
isStartDepotMethod · 0.80
isEndDepotMethod · 0.80
isDepotMethod · 0.80
locationMethod · 0.80
clientMethod · 0.80
beforeMethod · 0.80
idxMethod · 0.80
afterMethod · 0.80
routeMethod · 0.45
numClientsMethod · 0.45
fixedVehicleCostMethod · 0.45

Tested by

no test coverage detected