Skip to content

Expose all OSQP settings in marinholab::solvers::osqp (C++ & Python) - #1

Merged
mmmarinho merged 1 commit into
mainfrom
feat/expose-all-osqp-settings
Sep 4, 2026
Merged

Expose all OSQP settings in marinholab::solvers::osqp (C++ & Python)#1
mmmarinho merged 1 commit into
mainfrom
feat/expose-all-osqp-settings

Conversation

@mmmarinho

Copy link
Copy Markdown
Contributor

Summary

Mirrors the marinholab-solvers-qpoases wrapper structure for the OSQP wrapper, exposing all OSQP configuration parameters in both C++ and Python.

Note

This PR was created by an AI agent (OpenHands) on behalf of the repository maintainer.

What changed

C++ API — new namespace & full settings

  • Moved the C++ API into marinholab::solvers::osqp under include/marinholab/solvers/osqp.h (previously namespace M3 in include/OSQP_solver.h, now removed).
  • Configuration now exposes all 31 OSQPSettings fields (native snake_case, defaults from osqp_set_default_settings()) plus the wrapper-specific use_hotstart option.
  • src/core_function.cpp maps the full Configuration into OSQP settings via _to_osqp_settings().

Python bindings

  • src/core.cpp exposes every config field plus the three OSQP enums (LinsysSolverType, PreconditionerType, Status).
  • Added _core.pyi type stub, py.typed marker, pyrightconfig.json, and package_data in setup.py so the stub ships in the wheel.
  • Fully type-annotated the wrapper (pyright-clean).

Build system (matches the qpoases convention)

  • CMake builds a marinholab_osqp static lib + _core pybind11 module.
  • Added an optional standalone C++ example behind BUILD_EXAMPLES=ON (example/example.cpp, target example_osqp).

Docs

  • Expanded README.md (C++ API usage, all configuration tables, C++ example, pyright section).
  • Added AGENTS.md with project conventions.

Verification

  • ✅ CMake build (aarch64, Python 3.13)
  • pyright — 0 errors / 0 warnings
  • doxygen — 0 warnings (C++ code is doxygen-compliant)
  • ✅ Python example (python -m marinholab.solvers.osqp.example) and C++ example (example_osqp) both run and produce the expected solution x ≈ [0.2, 1.0].

Notes

  • Config field names now use OSQP's native spelling (e.g. max_iter, eps_abs, eps_rel, eps_prim_inf, eps_dual_inf). This is breaking for any existing Python callers that used the previous names (maximum_iterations, eps_absolute, eps_relative, …) — they've been updated in the examples/evaluation script.

Mirror the marinholab-solvers-qpoases wrapper structure for the OSQP
wrapper:

- Move the C++ API into namespace marinholab::solvers::osqp under
  include/marinholab/solvers/osqp.h (was M3 / include/OSQP_solver.h).
- Expose every OSQPSettings field in Configuration (all 31, native
  snake_case, defaults from osqp_set_default_settings()) plus the
  wrapper-specific use_hotstart option; also expose the OSQP enums
  (LinsysSolverType, PreconditionerType, Status) to Python.
- CMake: build a marinholab_osqp static lib + _core pybind11 module,
  and an optional standalone C++ example behind BUILD_EXAMPLES=ON
  (example/example.cpp, target example_osqp).
- Python: add a _core.pyi type stub, py.typed, pyrightconfig.json and
  package_data so the stub ships in the wheel; fully type-annotate the
  wrapper (pyright clean, 0/0).
- Docs: expand README (C++ API, all config tables, C++ example,
  pyright section) and add AGENTS.md.

Verified: CMake build, pyright (0 errors / 0 warnings), doxygen
(0 warnings), and the Python + C++ examples all run.

Co-authored-by: openhands <openhands@all-hands.dev>
@mmmarinho mmmarinho added the enhancement New feature or request label Sep 4, 2026

@mmmarinho mmmarinho left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mmmarinho
mmmarinho merged commit 9c91056 into main Sep 4, 2026
11 checks passed
@mmmarinho
mmmarinho deleted the feat/expose-all-osqp-settings branch September 4, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant