Skip to content

ENH: support SciPy-style callback(xk) during optimization - #697

Open
Pragati5-DEBUG wants to merge 1 commit into
optimagic-dev:mainfrom
Pragati5-DEBUG:feat/callback-xk
Open

ENH: support SciPy-style callback(xk) during optimization#697
Pragati5-DEBUG wants to merge 1 commit into
optimagic-dev:mainfrom
Pragati5-DEBUG:feat/callback-xk

Conversation

@Pragati5-DEBUG

Copy link
Copy Markdown
Contributor

Summary

  • Support SciPy-style callback(xk) in minimize / maximize
  • Pass it into InternalOptimizationProblem and call it on objective evaluations (works for all optimizers, not via SciPy's own callback)
  • callback(intermediate_result) left for a follow-up

Test plan

  • pytest tests/optimagic/optimization/test_scipy_aliases.py::test_callback_xk_is_called
  • Related optimization tests (96 passed)

Pass callback through to InternalOptimizationProblem and invoke it
on objective evaluations so it works for all optimizers.
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...imagic/optimization/create_optimization_problem.py 88.13% <100.00%> (-0.10%) ⬇️
...agic/optimization/internal_optimization_problem.py 92.99% <100.00%> (+0.13%) ⬆️
src/optimagic/optimization/optimize.py 92.10% <ø> (ø)

... and 2 files with indirect coverage changes

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

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