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

Function test_read_hfvrp_solution

tests/test_read.py:652–668  ·  view source on GitHub ↗

Tests that reading a HFVRP solution results in the correct routes and objective value.

()

Source from the content-addressed store, hash-verified

650
651
652def test_read_hfvrp_solution():
653 """
654 Tests that reading a HFVRP solution results in the correct routes and
655 objective value.
656 """
657 data = read("data/X115-HVRP.vrp", "exact")
658 sol = read_solution("data/X115-HVRP.sol", data)
659 routes = sol.routes()
660
661 assert_equal(routes[1].visits(), [59, 35, 99, 49, 79, 47, 109, 18])
662 assert_equal(routes[-1].visits(), [5, 6, 3, 93, 42, 9])
663
664 assert_equal(routes[1].vehicle_type(), 0)
665 assert_equal(routes[-1].vehicle_type(), 2)
666
667 cost_eval = CostEvaluator([0], 0, 0)
668 assert_equal(cost_eval.cost(sol), 1941256006)

Callers

nothing calls this directly

Calls 5

costMethod · 0.95
readFunction · 0.90
read_solutionFunction · 0.90
CostEvaluatorClass · 0.90
visitsMethod · 0.80

Tested by

no test coverage detected