Differentiable iLQR (parallel)#

Module solves the differential iterative linear quadratic regulator (DiLQR) problem with the parallel (associative-scan) iLQR solver.

diffilqrax.parallel_dilqr.pdilqr(parallel_model, params, Us_init, exact_hessian=True, adjoint='parallel', **kwargs)[source]#

Solves the differential iLQR problem with diffilqrax.parallel_ilqr.pilqr_solver(). Parallel counterpart of diffilqrax.diff_ilqr.dilqr().

Parameters:
  • parallel_model (ParallelSystem | System) – The system model.

  • params (iLQRParams) – The iLQR parameters.

  • Us_init (Array) – The initial control sequence.

  • exact_hessian (bool) – If True (default), the implicit gradients use the Hessian of the Lagrangian and match direct differentiation; if False, only the cost Hessians (Gauss-Newton). See dilqr().

  • adjoint (str) – Solver of the adjoint LQR problem in the reverse pass: “parallel” (associative scan, default) or “sequential” (Riccati recursion). See diffilqrax.parallel_dlqr.pdllqr().

  • **kwargs – Additional keyword arguments for diffilqrax.parallel_ilqr.pilqr_solver(), e.g. rollout.

Returns:

The optimized state-control trajectory [(T+1)x(n+m)].

Return type:

Array

Notes

The gradients are implicit: they are exact only if the solver has converged (see kkt_tol and max_iter of pilqr_solver()). Us_init receives no gradient and the solver is never differentiated, so it can run as a lax.while_loop (loop="while", the default).

diffilqrax.parallel_dilqr.implicit_pdilqr(parallel_model, params, solution, exact_hessian=True, adjoint='parallel')[source]#

The differentiable part of pdilqr(): the optimal trajectory, with implicit gradients wrt params.

Parameters:
Returns:

The optimized state-control trajectory [(T+1)x(n+m)].

Return type:

Array

diffilqrax.parallel_dilqr.parallel_dilqr(parallel_model, params, Us_init, exact_hessian=True, adjoint='parallel', **kwargs)#

Solves the differential iLQR problem with diffilqrax.parallel_ilqr.pilqr_solver(). Parallel counterpart of diffilqrax.diff_ilqr.dilqr().

Parameters:
  • parallel_model (ParallelSystem | System) – The system model.

  • params (iLQRParams) – The iLQR parameters.

  • Us_init (Array) – The initial control sequence.

  • exact_hessian (bool) – If True (default), the implicit gradients use the Hessian of the Lagrangian and match direct differentiation; if False, only the cost Hessians (Gauss-Newton). See dilqr().

  • adjoint (str) – Solver of the adjoint LQR problem in the reverse pass: “parallel” (associative scan, default) or “sequential” (Riccati recursion). See diffilqrax.parallel_dlqr.pdllqr().

  • **kwargs – Additional keyword arguments for diffilqrax.parallel_ilqr.pilqr_solver(), e.g. rollout.

Returns:

The optimized state-control trajectory [(T+1)x(n+m)].

Return type:

Array

Notes

The gradients are implicit: they are exact only if the solver has converged (see kkt_tol and max_iter of pilqr_solver()). Us_init receives no gradient and the solver is never differentiated, so it can run as a lax.while_loop (loop="while", the default).