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

Function test_excess_load_calculation

tests/test_Solution.py:436–454  ·  view source on GitHub ↗

Tests the Solution's excess load calculation on a single-route case.

(ok_small)

Source from the content-addressed store, hash-verified

434
435
436def test_excess_load_calculation(ok_small):
437 """
438 Tests the Solution's excess load calculation on a single-route case.
439 """
440 sol = Solution(ok_small, [[4, 3, 1, 2]])
441 assert_(sol.has_excess_load())
442 assert_(not sol.has_time_warp())
443
444 # All clients are visited on the same route/by the same vehicle. The total
445 # delivery demand is 18, but the vehicle capacity is only 10.
446 assert_equal(ok_small.num_load_dimensions, 1)
447
448 needed = sum(client.delivery[0] for client in ok_small.clients())
449 assert_equal(needed, 18)
450
451 available = ok_small.vehicle_type(0).capacity[0]
452 assert_equal(available, 10)
453
454 assert_equal(sol.excess_load(), [needed - available])
455
456
457@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

SolutionClass · 0.90
clientsMethod · 0.80

Tested by

no test coverage detected