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

Function test_from_data

tests/test_Model.py:285–302  ·  view source on GitHub ↗

Tests that initialising the model from a data instance results in a valid model representation of that data instance.

(small_cvrp)

Source from the content-addressed store, hash-verified

283
284
285def test_from_data(small_cvrp):
286 """
287 Tests that initialising the model from a data instance results in a valid
288 model representation of that data instance.
289 """
290 m = Model.from_data(small_cvrp)
291 m_data = m.data()
292
293 # We can first check if the overall problem dimension numbers agree.
294 assert_equal(m_data.num_clients, small_cvrp.num_clients)
295 assert_equal(m_data.num_vehicles, small_cvrp.num_vehicles)
296 assert_equal(
297 m_data.vehicle_type(0).capacity,
298 small_cvrp.vehicle_type(0).capacity,
299 )
300
301 assert_equal(m_data.distance_matrices(), small_cvrp.distance_matrices())
302 assert_equal(m_data.duration_matrices(), small_cvrp.duration_matrices())
303
304
305def test_from_data_and_solve(small_cvrp, ok_small):

Callers

nothing calls this directly

Calls 2

from_dataMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected