Repository navigation
fix(engine): a quadratic row keeps its own pair when a row before it has no term - #2028
Conversation
… no term A strict xfail against the build as it stands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013DSGmeGQfUxE4gyNQy94qG
…has no term A block that dropped a row with no term renumbered its rows and its matrix share but not its quadratic share, so a later row took an earlier row's pair and lost its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013DSGmeGQfUxE4gyNQy94qG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013DSGmeGQfUxE4gyNQy94qG
Merging this PR will degrade performance by 12.86%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_emit[network-s-specsolve-in-memory-lp] |
28.2 MB | 34.5 MB | -18.2% |
| ❌ | test_emit[network-s-specsolve-lp] |
28.2 MB | 34.5 MB | -18.2% |
| ❌ | test_emit[network-s-specsolve-highs] |
19.5 MB | 21.8 MB | -10.7% |
| ❌ | test_emit[network-s-specsolve-in-memory-highs] |
19.5 MB | 21.8 MB | -10.69% |
| ❌ | test_window[network-s-specsolve-highs-cold] |
19.6 MB | 21.9 MB | -10.65% |
| ❌ | test_window[network-s-specsolve-highs-coefficient] |
19.6 MB | 21.9 MB | -10.54% |
| ❌ | test_window[network-s-specsolve-highs-shape] |
19.5 MB | 21.8 MB | -10.54% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/quadratic-rows-renumbered (9fb6084) with main (b646d61)2
Footnotes
-
307 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
main(af1dac7) during the generation of this report, so b646d61 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Note
The following content was generated by AI.
A quadratic constraint whose block drops a row with no term now keeps each quadratic pair on its own row. Before, a later row took an earlier row's pair and lost its own, and the wrong model solved silently.
Cause, test, gates, what was not done
Cause.
_drop_termless_rowsrenumberedrowsand the matrix share, but not the quadratic share._blockthen filtered the quadratic share against the renumbered rows. So an entry kept its old row number and landed on the wrong row, or was dropped.Test, written first as a strict xfail and watched to fail on
af1dac7:test_a_quadratic_row_keeps_its_own_pair_when_a_row_before_it_is_not_built.k * p * p <= 10overg=[a,b,c]withkonly atb, c. Onmain,qmatrixis[(1, 1, 1, 1.0)]where[(0, 1, 1, 1.0), (1, 2, 2, 4.0)]is correct. The test also solves with Gurobi against the optimum worked out by hand.Fix.
_drop_termless_rowstakes the quadratic share and renumbers it with the same map. The filter in_blockgoes, because every row the quadratic share holds is inkept.replace_strictraises if that ever stops being true.Gates, in a uv venv on polars 2.0.0 (no pixi in this container):
ruff check .andruff format --check .at 0.16.9,pyrefly checkonsrc/at 1.3.1 (0 errors),pytest -n auto tests: 5449 passed, 657 skipped, 4 xfailed, and 2 failed. The 2 failures are the[xpress]cases, which fail onmaintoo because the xpress package is not installed here.docs-testwas not run.Not done.
_drop_termless_rowshas a second caller in_build_constraint, for a constraint with no linear and no quadratic term. That caller now passesNonefor the quadratic share. No test reaches that branch: the suite stays green with it replaced by araise. The loader refuses a constraint with no variable, so the branch looks unreachable. perf(engine): a model with many variables and constraints builds about 15% faster #2022 removes it.main, the resolution keeps its version and adds this renumbering; fix(engine): a quadratic row keeps its own pair when a row before it has no term #2027 already has it there.🤖 Generated with Claude Code
https://claude.ai/code/session_013DSGmeGQfUxE4gyNQy94qG