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

Class ClientSegment

pyvrp/cpp/search/primitives.cpp:11–47  ·  view source on GitHub ↗

* Simple wrapper class that implements the required evaluation interface for * a single client that might not currently be in the solution. */

Source from the content-addressed store, hash-verified

9 * a single client that might not currently be in the solution.
10 */
11class ClientSegment
12{
13 pyvrp::ProblemData const &data;
14 size_t client;
15
16public:
17 ClientSegment(pyvrp::ProblemData const &data, size_t client)
18 : data(data), client(client)
19 {
20 assert(client >= data.numDepots()); // must be an actual client
21 }
22
23 pyvrp::search::Route const *route() const { return nullptr; }
24
25 size_t first() const { return client; }
26 size_t last() const { return client; }
27 size_t size() const { return 1; }
28
29 bool startsAtReloadDepot() const { return false; }
30 bool endsAtReloadDepot() const { return false; }
31
32 pyvrp::Distance distance([[maybe_unused]] size_t profile) const
33 {
34 return 0;
35 }
36
37 pyvrp::DurationSegment duration([[maybe_unused]] size_t profile) const
38 {
39 pyvrp::ProblemData::Client const &clientData = data.location(client);
40 return {clientData};
41 }
42
43 pyvrp::LoadSegment load(size_t dimension) const
44 {
45 return {data.location(client), dimension};
46 }
47};
48} // namespace
49
50pyvrp::Cost pyvrp::search::insertCost(Route::Node *U,

Callers 2

insertCostMethod · 0.85
inplaceCostMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected