Tests that the ``duration_matrix()`` and ``distance_matrix()`` methods correctly return the underlying data matrices.
()
| 407 | |
| 408 | |
| 409 | def test_matrix_access(): |
| 410 | """ |
| 411 | Tests that the ``duration_matrix()`` and ``distance_matrix()`` methods |
| 412 | correctly return the underlying data matrices. |
| 413 | """ |
| 414 | gen = default_rng(seed=42) |
| 415 | size = 6 |
| 416 | |
| 417 | dist_mat = gen.integers(500, size=(size, size)) |
| 418 | dur_mat = gen.integers(500, size=(size, size)) |
| 419 | np.fill_diagonal(dist_mat, 0) |
| 420 | np.fill_diagonal(dur_mat, 0) |
| 421 | |
| 422 | data = ProblemData( |
| 423 | clients=[Client(x=0, y=0, tw_late=10) for _ in range(size - 1)], |
| 424 | depots=[Depot(x=0, y=0)], |
| 425 | vehicle_types=[VehicleType(2)], |
| 426 | distance_matrices=[dist_mat], |
| 427 | duration_matrices=[dur_mat], |
| 428 | ) |
| 429 | |
| 430 | assert_equal(data.distance_matrix(profile=0), dist_mat) |
| 431 | assert_equal(data.duration_matrix(profile=0), dur_mat) |
| 432 | |
| 433 | |
| 434 | def test_matrices_are_not_writeable(): |
nothing calls this directly
no test coverage detected