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

Function test_shift_duration

tests/search/test_Route.py:546–561  ·  view source on GitHub ↗

Tests that the shift duration attribute of vehicle types is reflected in the route's time warp calculations.

(ok_small, shift_duration: int, expected: int)

Source from the content-addressed store, hash-verified

544 ],
545)
546def test_shift_duration(ok_small, shift_duration: int, expected: int):
547 """
548 Tests that the shift duration attribute of vehicle types is reflected
549 in the route's time warp calculations.
550 """
551 vehicle_type = VehicleType(3, capacity=[10], shift_duration=shift_duration)
552 data = ok_small.replace(vehicle_types=[vehicle_type])
553
554 route = Route(data, 0, 0)
555 for client in range(data.num_depots, data.num_locations):
556 route.append(Node(loc=client))
557
558 route.update()
559 assert_equal(route.duration(), 7_950)
560 assert_(route.has_time_warp())
561 assert_equal(route.time_warp(), expected)
562
563
564@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 7

updateMethod · 0.95
durationMethod · 0.95
VehicleTypeClass · 0.90
NodeClass · 0.85
replaceMethod · 0.80
appendMethod · 0.80
RouteClass · 0.50

Tested by

no test coverage detected