perf(planning): plan from the best-ranked obligation solution

With several obligation solutions, the planner ran the whole preference
chain on candidate solutions as previews: every solution after a
complete enumeration, or the eight best-ranked after a truncated window
search. It now orders all solutions by the existing pre-preference
ranking (active objectives, then tie-breaks, of each obligation-only
plan; equal ranks keep enumeration order) and runs the preference
stages once, on the first. If that run ends with earned leave available
only after its final merged time-off period, the stages restart on the
next solution, so a request that planned before never becomes a
conflict.

The loaded year drops from 43 to 5.5 seconds and typed obligations from
3.3 to 0.1 seconds, with byte-identical benchmark plans. Over the 5,000
seeded requests, 23 plans become worse (9 on a real objective) and 1
better; over 50 loaded-year-sized requests, 4 become worse on a real
objective. ADR 0010 records the decision; docs/benchmark/issue-302.md
records the comparison and the opt-in runner that reproduces it.

The frozen-engine check fails until the frozen engine is rebuilt from
this commit in the next one.

Part of #302.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nessarandClaude Opus 5.5 committed 2026-10-18 21:18:06 +02:00
1 parent aa6a0c6f1b
commit 8168137cd5
13 files changed
+579 -278

No files matched your search

@@ -360,7 +360,9 @@ describe('supporting placement economy and provenance', () => {
}),
expect.objectContaining({
date: '2024-05-10',
ruleIds: ['gain'],
// The best-ranked obligation solution placed this date for the producer's
// after-pattern before gain ran, so the date keeps no gain credit (ADR 0010).
ruleIds: force === 'obligation' ? [] : ['gain'],
supporting: true,
}),
]);