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

Method apply

pyvrp/cpp/search/SwapTails.cpp:99–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99void SwapTails::apply(Route::Node *U, Route::Node *V) const
100{
101 stats_.numApplications++;
102 auto *nU = n(U);
103 auto *nV = n(V);
104
105 auto insertIdx = U->idx() + 1;
106 while (!nV->isEndDepot())
107 {
108 auto *node = nV;
109 nV = n(nV);
110 V->route()->remove(node->idx());
111 U->route()->insert(insertIdx++, node);
112 }
113
114 insertIdx = V->idx() + 1;
115 while (!nU->isEndDepot())
116 {
117 auto *node = nU;
118 nU = n(nU);
119 U->route()->remove(node->idx());
120 V->route()->insert(insertIdx++, node);
121 }
122}
123
124template <> bool pyvrp::search::supports<SwapTails>(ProblemData const &data)
125{

Callers

nothing calls this directly

Calls 6

nFunction · 0.85
idxMethod · 0.80
isEndDepotMethod · 0.80
removeMethod · 0.80
routeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected