mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-01 11:11:37 -05:00
DeadlineNestingEngine wraps any engine with a wall-clock limit (any positive time up to the cancellation timer's ~49.7 days). An engine that finishes in time keeps its result, as does a result it returns after the limit. When the limit cancels it, the best whole-job plan it reported (PlanImproved, ranked like Default ranks candidates, a tie going to the later plan) is returned if it passes the layout check; with none the solve fails with TimeoutException. The caller's own cancellation is never turned into a result. Engine plate commits are dropped and the returned result's commits reported once it is known; plans are forwarded only when they beat every plan shown so far. Default now runs Rectangles, then Irregular, then Circles, so a search stopped early already holds a valid plan. Ties still break by candidate order (Irregular, Rectangles, Circles), so for these three the choice is unchanged, and when every candidate throws, the first in that order is still the one rethrown. A test seam takes a run order. Desktop, Console and MCP do not apply a limit yet; Console can solve a job twice (cutout trial and plain), which needs one shared deadline. Mutations killed (10/10): no fallback at the limit, invalid plan accepted, caller cancellation becomes a result, engine commits forwarded, a worse later plan replaces the best, a tie keeps the earlier plan, no upper limit bound, failure rethrown in run order, built-in run order unchanged, run order ignored.