Skip to content

Fix problem types and scaled noise-free criterion in benchmarks - #723

Open
janosg wants to merge 3 commits into
mainfrom
fix-benchmark-problem-types
Open

janosg wants to merge 3 commits into
mainfrom
fix-benchmark-problem-types

Conversation

@janosg

@janosg janosg commented Oct 25, 2026

Copy link
Copy Markdown
Member

Problem

  1. 22 Cartis-Roberts problems (arglale, arglble, bratu_2d, bratu_2d_t, bratu_3d, drcavty1–3, eigena, eigenb, the six flosp2*, hydcar6, hydcar20, qr3d, qr3dbd, yatpsq_1, yatpsq_2) and the More-Wild kowalik_osborne problem define their criterion with functools.partial but without mark.least_squares. (kowalik_osborne used mark.least_squares(partial)(...), which marks partial itself.) get_benchmark_problems therefore treats them as scalar problems, minimize raises InvalidFunctionError ("Scalar objective values need to be scalars"), and run_benchmark with error_handling="continue" silently counts them as failures. Four of them are in the estimagic set.
  2. With scaling=True, noise_free_fun is the unscaled criterion while inputs["params"] are scaled. run_benchmark therefore computes wrong start values for failed runs and wrong criterion histories for noisy problems (e.g. 9972 instead of 24.2 at the start of rosenbrock_good_start).

Changes

  • Wrap the partials in mark.least_squares.
  • Build noise_free_fun like the criterion, with the same scaling but without noise.
  • Tests: every More-Wild and Cartis-Roberts criterion is marked as least squares; noise_free_fun reproduces the start criterion at the scaled params; minimizing a partialled problem works; run_benchmark with noise and scaling starts at the correct value.

🤖 Generated with Claude Code

janosg and others added 3 commits October 25, 2026 10:30
22 Cartis-Roberts problems and the More-Wild kowalik_osborne problem wrapped
their least-squares criterion in functools.partial without the
mark.least_squares decorator (kowalik_osborne marked partial itself), so
minimize rejected them as scalar functions returning arrays and run_benchmark
silently counted them as failures.

get_benchmark_problems returned the unscaled criterion as noise_free_fun while
the start params were scaled, so run_benchmark computed wrong start values for
failed runs and wrong criterion histories for noisy problems with scaling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...c/optimagic/benchmarking/get_benchmark_problems.py 93.95% <100.00%> (+0.04%) ⬆️
src/optimagic/benchmarking/more_wild.py 100.00% <ø> (ø)
...ests/optimagic/benchmarking/test_cartis_roberts.py 100.00% <100.00%> (ø)
...imagic/benchmarking/test_get_benchmark_problems.py 100.00% <100.00%> (ø)
tests/optimagic/benchmarking/test_more_wild.py 100.00% <100.00%> (ø)
tests/optimagic/benchmarking/test_run_benchmark.py 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant