Select a route under hard constraints
Each route has a unique name, quality estimate in [0,1], nonnegative local-credit cost, and nonnegative latency estimate. Validate all routes and limits as finite numbers, rejecting booleans. Filter by quality floor, available budget, and latency ceiling. Maximize success_value * quality - cost; break ties by lower cost then lexicographic name. Return a name or None when infeasible. These are invented task-level estimates, not actual vendor prices or performance.
Your task
- Complete the starter function using the contract above.
- Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
- Run tests to record your result, then compare with the explained reference solution.
Examples
EXAMPLE 1
InputSwift q=.82,c=2; Careful q=.94,c=6; floor=.9,budget=8
Outputcareful
EXAMPLE 2
InputThe same routes with floor=.9,budget=5
OutputNone
Implement the function, then run the tests.
Ctrl / ⌘ + Enter to test · Shift + Tab leaves editor