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

Method _clients

pyvrp/read.py:387–420  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

385 ]
386
387 def _clients(self) -> list[Client]:
388 groups = self.parser.mutually_exclusive_groups()
389 num_locs = self.parser.num_locations
390
391 idx2group: list[int | None] = [None for _ in range(num_locs)]
392 for group, members in enumerate(groups):
393 for client in members:
394 idx2group[client] = group
395
396 coords = self.parser.coords()
397 demands = self.parser.demands()
398 backhauls = self.parser.backhauls()
399 service_duration = self.parser.service_times()
400 time_windows = self.parser.time_windows()
401 release_times = self.parser.release_times()
402 prizes = self.parser.prizes() # we interpret a zero-prize client as
403 required = np.isclose(prizes, 0) # required in the benchmark instances
404
405 return [
406 Client(
407 x=coords[idx][0],
408 y=coords[idx][1],
409 delivery=np.atleast_1d(demands[idx]),
410 pickup=np.atleast_1d(backhauls[idx]),
411 service_duration=service_duration[idx],
412 tw_early=time_windows[idx][0],
413 tw_late=time_windows[idx][1],
414 release_time=release_times[idx],
415 prize=prizes[idx],
416 required=required[idx] and idx2group[idx] is None,
417 group=idx2group[idx],
418 )
419 for idx in range(self.parser.num_depots, num_locs)
420 ]
421
422 def _vehicle_types(self) -> list[VehicleType]:
423 num_vehicles = self.parser.num_vehicles

Callers 1

dataMethod · 0.95

Calls 9

ClientClass · 0.85
coordsMethod · 0.80
demandsMethod · 0.80
backhaulsMethod · 0.80
service_timesMethod · 0.80
time_windowsMethod · 0.80
release_timesMethod · 0.80
prizesMethod · 0.45

Tested by

no test coverage detected