* Route(data: ProblemData, visits: list[int] | list[Trip], vehicle_type: int) * * A simple class that stores the route plan and some statistics. Internally, * a route consists of one or more :class:`~pyvrp._pyvrp.Trip` objects. */
| 19 | * a route consists of one or more :class:`~pyvrp._pyvrp.Trip` objects. |
| 20 | */ |
| 21 | class Route |
| 22 | { |
| 23 | using Client = size_t; |
| 24 | using Depot = size_t; |
| 25 | using VehicleType = size_t; |
| 26 | using Trips = std::vector<Trip>; |
| 27 | using Visits = std::vector<Client>; |
| 28 | |
| 29 | // Validates the consistency of the constructed instance. |
| 30 | void validate(ProblemData const &data) const; |
| 31 | |
| 32 | // Creates the data returned by ``schedule()``. |
| 33 | void makeSchedule(ProblemData const &data); |
| 34 | |
| 35 | public: |
| 36 | /** |
| 37 | * Forward iterator through the clients visited by this route. |
| 38 | */ |
| 39 | class Iterator |
| 40 | { |
| 41 | Route const *route_ = nullptr; |
| 42 | size_t trip_ = 0; |
| 43 | size_t idx_ = 0; |
| 44 | |
| 45 | public: |
| 46 | using iterator_category = std::forward_iterator_tag; |
| 47 | using difference_type = std::ptrdiff_t; |
| 48 | using value_type = Client; |
| 49 | |
| 50 | Iterator(Route const &route, size_t idx); |
| 51 | |
| 52 | Iterator() = default; |
| 53 | Iterator(Iterator const &other) = default; |
| 54 | Iterator(Iterator &&other) = default; |
| 55 | |
| 56 | Iterator &operator=(Iterator const &other) = default; |
| 57 | Iterator &operator=(Iterator &&other) = default; |
| 58 | |
| 59 | bool operator==(Iterator const &other) const; |
| 60 | |
| 61 | Client operator*() const; |
| 62 | |
| 63 | Iterator operator++(int); |
| 64 | Iterator &operator++(); |
| 65 | }; |
| 66 | |
| 67 | /** |
| 68 | * Simple object that stores some data about a client or depot visit. |
| 69 | * |
| 70 | * Attributes |
| 71 | * ---------- |
| 72 | * location : int |
| 73 | * Index of the visited location (client or depot). |
| 74 | * trip : int |
| 75 | * Index of the trip visiting this location. |
| 76 | * start_service : int |
| 77 | * Time at which service begins. |
| 78 | * end_service : int |
no outgoing calls