MCPcopy Index your code
hub / github.com/PyVRP/PyVRP / Profile

Class Profile

pyvrp/Model.py:64–97  ·  view source on GitHub ↗

Stores a routing profile. A routing profile is a collection of edges with distance and duration attributes that together define a complete distance and duration matrix. These can be used to model, for example, the road uses of different types of vehicles, like trucks, cars, or

Source from the content-addressed store, hash-verified

62
63
64class Profile:
65 """
66 Stores a routing profile.
67
68 A routing profile is a collection of edges with distance and duration
69 attributes that together define a complete distance and duration matrix.
70 These can be used to model, for example, the road uses of different types
71 of vehicles, like trucks, cars, or bicyclists. Each
72 :class:`~pyvrp._pyvrp.VehicleType` is associated with a routing profile.
73 """
74
75 edges: list[Edge]
76 name: str
77
78 def __init__(self, *, name: str = ""):
79 self.edges = []
80 self.name = name
81
82 def add_edge(
83 self,
84 frm: Client | Depot,
85 to: Client | Depot,
86 distance: int,
87 duration: int = 0,
88 ) -> Edge:
89 """
90 Adds a new edge to this routing profile.
91 """
92 edge = Edge(frm, to, distance, duration)
93 self.edges.append(edge)
94 return edge
95
96 def __str__(self) -> str:
97 return self.name
98
99
100class Model:

Callers 4

from_dataMethod · 0.85
add_profileMethod · 0.85

Calls

no outgoing calls