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

Function test_multiple_depots

tests/test_read.py:238–278  ·  view source on GitHub ↗

Tests parsing a slightly modified version of the OkSmall instance, which now has two depots rather than one.

()

Source from the content-addressed store, hash-verified

236
237
238def test_multiple_depots():
239 """
240 Tests parsing a slightly modified version of the OkSmall instance, which
241 now has two depots rather than one.
242 """
243 data = read("data/OkSmallMultipleDepots.txt")
244
245 # Still five locations, but now with two depots and three clients.
246 assert_equal(data.num_locations, 5)
247 assert_equal(data.num_depots, 2)
248 assert_equal(data.num_clients, 3)
249 assert_equal(data.num_vehicle_types, 2) # two, each at a different depot
250 assert_equal(data.num_vehicles, 3)
251
252 # First vehicle type should have two vehicles at the first depot.
253 veh_type1 = data.vehicle_type(0)
254 assert_equal(veh_type1.profile, 0)
255 assert_equal(veh_type1.start_depot, 0)
256 assert_equal(veh_type1.end_depot, 0)
257 assert_equal(veh_type1.num_available, 2)
258 assert_equal(veh_type1.tw_early, 0)
259 assert_equal(veh_type1.tw_late, 45_000)
260
261 # Second vehicle type should have one vehicle at the second depot. The
262 # vehicle should have a tighter time window than that associated with the
263 # first vehicle type.
264 veh_type2 = data.vehicle_type(1)
265 assert_equal(veh_type2.profile, 0)
266 assert_equal(veh_type2.start_depot, 1)
267 assert_equal(veh_type2.end_depot, 1)
268 assert_equal(veh_type2.num_available, 1)
269 assert_equal(veh_type2.tw_early, 5_000)
270 assert_equal(veh_type2.tw_late, 20_000)
271
272 depot1, depot2 = data.depots()
273
274 # Test that the depot coordinates have been parsed correctly.
275 assert_equal(depot1.x, 2_334)
276 assert_equal(depot1.y, 726)
277 assert_equal(depot2.x, 226)
278 assert_equal(depot2.y, 1_297)
279
280
281def test_mdvrptw_instance():

Callers

nothing calls this directly

Calls 2

readFunction · 0.90
depotsMethod · 0.80

Tested by

no test coverage detected