Proper entity filter rather than score constraints.
More effective data structure.
CRITICAL FIX: off-by-one error caused problems to never be feasible.
Benchmark the new code.