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

Function test_vrpspd_instance

tests/test_read.py:319–350  ·  view source on GitHub ↗

Tests that reading an VRPSPD instance happens correctly, particularly the linehaul and backhaul data.

()

Source from the content-addressed store, hash-verified

317
318
319def test_vrpspd_instance():
320 """
321 Tests that reading an VRPSPD instance happens correctly, particularly the
322 linehaul and backhaul data.
323 """
324 data = read("data/SmallVRPSPD.vrp", round_func="round")
325
326 assert_equal(data.num_load_dimensions, 1)
327 assert_equal(data.num_locations, 5)
328 assert_equal(data.num_depots, 1)
329 assert_equal(data.num_clients, 4)
330
331 assert_equal(data.num_vehicles, 4)
332 assert_equal(data.num_vehicle_types, 1)
333
334 vehicle_type = data.vehicle_type(0)
335 assert_equal(vehicle_type.num_available, 4)
336 assert_equal(vehicle_type.capacity, [200])
337
338 # The first client is a linehaul client (only delivery, no pickup), and
339 # the second client is a backhaul client (only pickup, no delivery). All
340 # other clients have both delivery and pickup.
341 deliveries = [1, 0, 16, 18]
342 pickups = [0, 3, 10, 40]
343
344 for idx, client in enumerate(data.clients()):
345 assert_equal(client.delivery[0], deliveries[idx])
346 assert_equal(client.pickup[0], pickups[idx])
347
348 # Test that distance/duration are not set to a large value, as in VRPB.
349 assert_equal(np.max(data.distance_matrix(profile=0)), 39)
350 assert_equal(np.max(data.duration_matrix(profile=0)), 39)
351
352
353def test_vrpb_instance():

Callers

nothing calls this directly

Calls 3

readFunction · 0.90
clientsMethod · 0.80
maxMethod · 0.45

Tested by

no test coverage detected