Commit Graph

10 Commits

Author SHA1 Message Date
Copybara-Service ffe1eadd7e Merge pull request #3294 from kevinzakka:mujoco-minimize-x-scale
PiperOrigin-RevId: 923519000
Change-Id: I4a8fa1f031428cf41d194d17ea4c41975f93f745
2026-05-29 11:34:36 -07:00
Kevin Zakka aa4a43da17 Address reviewer feedback: default x_scale=None, drop TRF qualifier. 2026-05-27 12:55:14 -07:00
Kevin Zakka c12dc23852 Add x_scale to mujoco.minimize.least_squares.
Per-parameter scaling via change of variables z = x / D. Supports
'jac' (adaptive D_i = 1/||J(:,i)|| per iteration, matches scipy's TRF),
explicit array, or a positive scalar. Default 1.0 is a no-op.
2026-05-26 17:06:09 -07:00
Yuval Tassa 5031f88158 In minimize.least_squares, compute values at the solution at full verbosity.
PiperOrigin-RevId: 745301888
Change-Id: Ibd8e35e405bb2cebc7ac59a6dfc77118a6e6ba9f
2025-04-08 14:55:53 -07:00
Yuval Tassa 55e3ca3acf Improvements to minimize.least_squares.
All changes make functionality more similar to SciPy least squares:
- Use adaptive findiff epsilon.
- Make termination on step size relative to norm(x).
- Add termination on gradient norm.
- Make default tolerances like SciPy's.

PiperOrigin-RevId: 745221614
Change-Id: Iee93256651fca8154c97fa3bdaa9c67ede28e573
2025-04-08 11:23:24 -07:00
Baruch Tabanpour f3b3024291 Add pyink and isort config. Reformat.
PiperOrigin-RevId: 704533915
Change-Id: I37e9fd51261bd166b725c7460fc65d02fed2b391
2024-12-09 21:10:50 -08:00
Yuval Tassa 8d896529f0 Replace .copy() with list() in minimize.py
PiperOrigin-RevId: 631413376
Change-Id: I06dd3e3897078b57b0a0668b2182fa62dcd4a74e
2024-05-07 07:16:30 -07:00
Yuval Tassa 34e537e557 Updates to minimize.least_squares. Fixes #1585
- Residual callable is vectorized for easy multithreading by the user. Internally all vectors are now explicitly column vectors.
- Removed central findiff option, it wasn't applicable at the bounds anyway and just complicated the code.
- Added optional user-provided norm function for non-quadratic (robust) norms.
- Added an iter_callback callable for user convenience.
- Added option to internally check user-provided Jacobian and norm against finite differences.
- Updated the notebook accordingly.

PiperOrigin-RevId: 631205889
Change-Id: I3b9f8893756e329640de464e6f2e26a39e7dbd9e
2024-05-06 15:36:01 -07:00
Yuval Tassa 03a8fa9ca9 Improvements to minimize.least_squares:
- Added central differencing option.
- Changed `mu` semantics from log10 to actual values.
- `mu` control is now more aggressive, saves a few iterations.
- Use Armijo sufficient reduction criterion.
- Added some checks for float64 and NaNs.
- Added log of final result to trace.
- Removed unhelpful QP timing.

PiperOrigin-RevId: 610096950
Change-Id: Idf1a7c3155ce8e82fc2d5fe0f2da2f16636ff63d
2024-02-24 20:42:45 -08:00
Yuval Tassa b56d4bf8a5 Add mujoco.minimize module.
PiperOrigin-RevId: 608443678
Change-Id: Ib5dc78fe4523488b6c4e824f226591cf6a8a6216
2024-02-19 18:58:42 -08:00