Ties On The Hull

You binary search λ\lambda and the relaxed solver keeps reporting counts on one side of your target kk, never landing on kk itself. What happened, and what is the standard repair?

A

A search range that is too narrow. Several counts are simultaneously optimal at that λ\lambda, so the search stops short of the slope that isolates kk. Widen the range to [−1018,1018][-10^{18}, 10^{18}], and the reported counts then bracket kk so the answer can still be read off.

B

Collinear points. Several counts are simultaneously optimal at that λ\lambda, so the solver's internal tie-breaking picks which one it reports. Force it to always report the largest achievable count (or always the smallest), and the reported counts then bracket kk so the answer can still be read off.

C

A non-convex objective. Several counts are simultaneously suboptimal at that λ\lambda, so no slope ever selects the exact count you want. Abandon the trick and write the O(nk)O(nk) table directly, since no tie-breaking rule can recover a count that is not on the hull.

D

A sign error on the penalty. Several counts are simultaneously optimal at that λ\lambda, so the solver reports them from the wrong side of kk. Negate λ\lambda and re-run the search, and the reported counts then bracket kk so the answer can still be read off.