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

Function test_insert_required

tests/search/test_Solution.py:57–71  ·  view source on GitHub ↗

Tests that inserting clients can fail if inserting is too expensive and the insert is not required.

(ok_small)

Source from the content-addressed store, hash-verified

55
56
57def test_insert_required(ok_small):
58 """
59 Tests that inserting clients can fail if inserting is too expensive and
60 the insert is not required.
61 """
62 data = ok_small
63 search_space = SearchSpace(data, compute_neighbours(data))
64 cost_eval = CostEvaluator([0], 0, 0)
65
66 # Start with an empty solution and try to insert the first client without
67 # requiring an insert. Inserting should fail: it's not worth it, since the
68 # client has no prize. However, inserting should succeed when required.
69 sol = Solution(data)
70 assert_(not sol.insert(sol.nodes[1], search_space, cost_eval, False))
71 assert_(sol.insert(sol.nodes[1], search_space, cost_eval, True))

Callers

nothing calls this directly

Calls 5

insertMethod · 0.95
compute_neighboursFunction · 0.90
CostEvaluatorClass · 0.90
SearchSpaceClass · 0.85
SolutionClass · 0.50

Tested by

no test coverage detected