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

Class Trip

pyvrp/cpp/Trip.h:30–177  ·  view source on GitHub ↗

* Trip( * data: ProblemData, * visits: list[int], * vehicle_type: int, * start_depot: int | None = None, * end_depot: int | None = None, * ) * * A simple class that stores the trip plan and some related statistics. The * start and end depots default to the vehicle type's start and end depots if * not explicitly given. * * .. note:: * * A trip does not stand on

Source from the content-addressed store, hash-verified

28 * involving all trips, and determines route feasibility.
29 */
30class Trip
31{
32public:
33 using Client = size_t;
34 using Visits = std::vector<Client>;
35
36private:
37 Visits visits_;
38
39 Distance distance_ = 0; // Total travel distance on this trip
40 std::vector<Load> delivery_; // Total delivery amount served on this trip
41 std::vector<Load> pickup_; // Total pickup amount gathered on this trip
42 std::vector<Load> load_; // Load on this trip
43 std::vector<Load> excessLoad_; // Excess pickup or delivery demand
44 Duration travel_ = 0; // Total *travel* duration on this trip
45 Duration service_ = 0; // Total *service* duration on this trip
46 Duration release_ = 0; // Release time of this trip
47 Cost prizes_ = 0; // Total value of prizes on this trip
48
49 std::pair<Coordinate, Coordinate> centroid_; // Trip center
50 size_t vehicleType_; // Type of vehicle
51 size_t startDepot_; // assigned start location
52 size_t endDepot_; // assigned end location
53
54public:
55 [[nodiscard]] bool empty() const;
56
57 /**
58 * Returns the number of clients visited by this trip.
59 */
60 [[nodiscard]] size_t size() const;
61
62 [[nodiscard]] Client operator[](size_t idx) const;
63
64 [[nodiscard]] Visits::const_iterator begin() const;
65 [[nodiscard]] Visits::const_iterator end() const;
66
67 [[nodiscard]] Visits::const_reverse_iterator rbegin() const;
68 [[nodiscard]] Visits::const_reverse_iterator rend() const;
69
70 /**
71 * Trip visits, as a list of clients.
72 */
73 [[nodiscard]] Visits const &visits() const;
74
75 /**
76 * Total distance travelled on this trip.
77 */
78 [[nodiscard]] Distance distance() const;
79
80 /**
81 * Total client delivery load on this trip.
82 */
83 [[nodiscard]] std::vector<Load> const &delivery() const;
84
85 /**
86 * Total client pickup load on this trip.
87 */

Calls

no outgoing calls