Skip to content

Expose full qpOASES Configuration options; add docs, type stubs, and pyright cleanliness - #4

Merged
mmmarinho merged 1 commit into
mainfrom
extend-qpoases-options
Aug 28, 2026
Merged

Expose full qpOASES Configuration options; add docs, type stubs, and pyright cleanliness#4
mmmarinho merged 1 commit into
mainfrom
extend-qpoases-options

Conversation

@mmmarinho

Copy link
Copy Markdown
Contributor

This PR was created by an AI agent (OpenHands) on behalf of @mmmarinho.

Summary

Extends the Python/C++ wrapper so Configuration exposes the full qpOASES Options API (all 35 options), keeps prior solver behaviour, and adds Doxygen-style documentation plus complete Python type annotations.

What changed

  • include/qpOASES_solver.hConfiguration now carries every qpOASES Options field (1:1, double-precision defaults), plus the wrapper-specific maximum_working_set_recalculations, use_hotstart, and hessian_type. Each member is documented Doxygen-style.
  • src/core_function.cpp — a single _to_qpoases_options() helper maps the whole Configuration onto qpOASES Options and is applied on the solve_quadratic_program path.
  • src/core.cpp — pybind11 bindings for all new fields, and the full HessianType, PrintLevel, SubjectToStatus, and BooleanType enum sets.

Documentation & typing

  • README.md — rewritten: quickstart, a full configuration reference (per-option tables with defaults), building from source, and type-checking notes.
  • AGENTS.md — new: build/test/lint commands and the behavioural invariants to preserve.
  • marinholab/solvers/qpoases/_core.pyi + py.typed — a type stub so the package is checkable by Pyright/Pylance; setup.py ships both in the wheel.
  • solver.py, __init__.py, example.py, example_kinematics.py — added type annotations; pyrightconfig.json (Python 3.9, basic mode) makes pyright pass with 0 errors / 0 warnings.

Behaviour preserved

  • enableRegularisation, enableNZCTests, enableFlippingBounds keep their fast/MPC BT_FALSE defaults (the wrapper's historical effective behaviour); enableRegularisation in particular was corrected to BT_FALSE rather than qpOASES' BT_TRUE so the semi-definite/indefinite examples keep working.
  • print_level now defaults to PL_LOW (quiet, as before) and is genuinely honoured — setting it to PL_HIGH/PL_MEDIUM makes qpOASES print its iteration trace.

Verified

  • Wheel builds (Linux aarch64, Python 3.13) and installs; the compiled _core plus the .pyi stub and py.typed marker are all present in the installed package.
  • qpoases_example runs (positive-definite, semi-definite, None-constraints, active-set paths) with no changes to prior results.
  • Functional option check: print_level=PL_HIGH produces qpOASES output, PL_LOW stays quiet; tolerance/Hessian options flow through to the solver.
  • pyright clean on the source tree and against the installed package (reveal_type resolves float/HessianType/PrintLevel etc.).

Note (pre-existing, not caused by this change)

The locally built wheel reports a version derived from git history (setuptools-git-versioning), which differs from the tagged version in a shallow clone. This is unrelated to the option-exposure change and is left untouched.

Extend the C++ `Configuration` struct and pybind11 bindings to expose every
qpOASES `Options` field (35 options) plus the wrapper-specific fields, so the
full qpOASES API is reachable from Python. Apply them all through a single
`_to_qpoases_options()` helper.

- `include/qpOASES_solver.h`: full, doxygen-documented `Configuration` with
  double-precision defaults; scoped `using` directives inside `namespace M3`
  (preserves the MSVC/`SparseMatrix` fix from #2).
- `src/core_function.cpp`: map all options; use `std::vector` instead of a VLA
  for `xOpt` (preserves the MSVC fix from #2).
- `src/core.cpp`: bind all new fields; expose `PrintLevel`, `SubjectToStatus`,
  and the full `HessianType` enum sets.

Documentation & typing:
- `README.md`: rewritten with quickstart, configuration reference (defaults +
  per-option tables), building-from-source, and type-checking notes.
- `AGENTS.md`: added with build/test/lint commands and behavioural invariants.
- `marinholab/solvers/qpoases/_core.pyi` + `py.typed`: type stub so the package
  is checkable by Pyright; `setup.py` ships both in the wheel.
- `solver.py`, `__init__.py`, `example.py`, `example_kinematics.py`: added type
  annotations; `pyrightconfig.json` (py3.9, basic) makes `pyright` pass with 0
  errors / 0 warnings.

Behaviour is preserved: `enableRegularisation`/`enableNZCTests`/
`enableFlippingBounds` keep their fast/MPC defaults and `print_level` now
defaults to `PL_LOW` (quiet) while remaining configurable.

Co-authored-by: openhands <openhands@all-hands.dev>

@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 marked this pull request as ready for review August 28, 2026 07:51
@mmmarinho
mmmarinho merged commit 6183609 into main Aug 28, 2026
15 checks passed
@mmmarinho
mmmarinho deleted the extend-qpoases-options branch August 28, 2026 07:51
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