* Simple wrapper class that implements the required evaluation interface for * a single client that might not currently be in the solution. */
| 9 | * a single client that might not currently be in the solution. |
| 10 | */ |
| 11 | class ClientSegment |
| 12 | { |
| 13 | pyvrp::ProblemData const &data; |
| 14 | size_t client; |
| 15 | |
| 16 | public: |
| 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 | |
| 50 | pyvrp::Cost pyvrp::search::insertCost(Route::Node *U, |
no outgoing calls
no test coverage detected