8000 QP warm-start in first NLP solver iteration by FreyJo · Pull Request #1428 · acados/acados · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert

QP warm-start in first NLP solver iteration #1428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 4, 2025

Conversation

FreyJo
Copy link
Member
@FreyJo FreyJo commented Feb 4, 2025

Implement option nlp_solver_warm_start_first_qp_from_nlp, if True first QP will be initialized using values from NLP iterate, otherwise from previous QP solution, only relevant if nlp_solver_warm_start_first_qp is True. Default: False.

The new initialization (with nlp_solver_warm_start_first_qp = True) is likely beneficial.
We might change the default behavior after more testing.

Fixed option warm_start_first_qp for SQP-RTI.

@FreyJo FreyJo force-pushed the initialize_first_qp branch from feb3675 to 72876fb Compare February 4, 2025 15:24
@FreyJo FreyJo changed the title Fix QP warm-start in first SQP iteration QP warm-start in first NLP solver iteration Feb 4, 2025
@giaf
Copy link
Collaborator
giaf commented Feb 4, 2025

Looks good!

@FreyJo FreyJo merged commit e87fb0e into acados:main Feb 4, 2025
14 checks passed
@FreyJo FreyJo deleted the initialize_first_qp branch February 4, 2025 16:25
FreyJo added a commit that referenced this pull request Feb 11, 2025
… more (#1432)

### Added `setup_qp_matrices_and_factorize()`:
```
This function sets up the QP and factorizes Hessian matrix.

The current NLP iterate is used to setup the QP iterate, which includes t-slacks.
The t and lambda values are clipped according to `solution_sens_qp_t_lam_min` to avoid ill-conditioning.
Then the Hessian matrix is factorized.

If a two-solver approach is used to obtain solution sensitivities from acados, this function should be called before calling `eval_solution_sensitivity`, or `eval_adjoint_solution_sensitivity()`.

This is only implemented for HPIPM QP solver without condensing.
```

### Key differences of using `setup_qp_matrices_and_factorize()` vs.
`solve()` in the two-solver approach:
- The QP solver does not need to perform multiple IP iterations to
converge and only a single Riccati factorization is performed at the
current iterate.
- In the chain example this reduces the "Median time to factorize exact
Hessian QP:" 450.000 ms to 117.000 ms -> roughly 4x faster 🚀
- In the `solve()`-approach, the Riccati factorization at the second
last QP iterate is used, as the system i
6D83
s not factorized at the final QP
iterate. However, for the final iterate the system of equations becomes
typically ill-conditioned, which is why the final iterate is modified,
by clipping the inequality multipliers and t slacks, see option
`solution_sens_qp_t_lam_min`.
- Less options that have to be set. The options that were needed to use
the `solve` approach are now commented:
```
        # Old settings needed, when calling solve() instead of setup_qp_matrices_and_factorize()
        # ocp.solver_options.globalization_fixed_step_length = 0.0 # to not perfrom an SQP step update
        # ocp.solver_options.nlp_solver_max_iter = 1
        # ocp.solver_options.qp_solver_iter_max = 200
        # ocp.solver_options.tol = 1e-10  # to "force" a QP solve
```

### How it works
The option `update_fact_exit` was added in HPIPM. This option being
active, plus the warm start, plus limiting the QP solver iterations to
0, results in the correct behavior.

### Other things that changed in this PR
- fixed warm-starting QP from NLP iterate, was not correctly implemented
in #1428, as the QP iterate needs to be condensed and eliminated degrees
of freedom need to be taken into account. Only for N==N2 condensing
right now, to be extended #1433
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.

2 participants
0