# Altro.jl API

This page provides the docstrings for the most common methods that the user may work with.

## Solvers

### Types

Altro.ALTROSolverType
ALTROSolver

Augmented Lagrangian Trajectory Optimizer (ALTRO) is a solver developed by the Robotic Exploration Lab at Stanford University. The solver is special-cased to solve Markov Decision Processes by leveraging the internal problem structure.

ALTRO consists of two "phases":

1. AL-iLQR: iLQR is used with an Augmented Lagrangian framework to solve the problem quickly to rough constraint satisfaction
2. Projected Newton: A collocation-flavored active-set solver projects the solution from AL-iLQR onto the feasible subspace to achieve machine-precision constraint satisfaction.

Constructor

ALTROSolver(prob::Problem, opts::SolverOptions; [infeasible, R_inf, kwarg_opts...])

The infeasible keyword is a boolean flag that specifies whether the solver should augment the controls to make it artificially fully actuated, allowing state initialization. The R_inf is the weight on these augmented controls. Any solver options can be passed as additional keyword arguments and will be set in the solver.

Getters

• get_model
• get_objective
• get_constraints
• Altro.get_ilqr
• TO.get_initial_state

Other methods

• Base.size: returns (n,m,N)
• TO.is_constrained
Altro.ALSolverType
struct ALSolver <: ConstrainedSolver{T}

Augmented Lagrangian (AL) is a standard tool for constrained optimization. For a trajectory optimization problem of the form:

\begin{aligned} \min_{x_{0:N},u_{0:N-1}} \quad & \ell_f(x_N) + \sum_{k=0}^{N-1} \ell_k(x_k, u_k, dt) \\ \textrm{s.t.} \quad & x_{k+1} = f(x_k, u_k), \\ & g_k(x_k,u_k) \leq 0, \\ & h_k(x_k,u_k) = 0. \end{aligned}

AL methods form the following augmented Lagrangian function:

\begin{aligned} \ell_f(x_N) + &λ_N^T c_N(x_N) + c_N(x_N)^T I_{\mu_N} c_N(x_N) \\ & + \sum_{k=0}^{N-1} \ell_k(x_k,u_k,dt) + λ_k^T c_k(x_k,u_k) + c_k(x_k,u_k)^T I_{\mu_k} c_k(x_k,u_k) \end{aligned}

This function is then minimized with respect to the primal variables using any unconstrained minimization solver (e.g. iLQR). After a local minima is found, the AL method updates the Lagrange multipliers λ and the penalty terms μ and repeats the unconstrained minimization. AL methods have superlinear convergence as long as the penalty term μ is updated each iteration.

Altro.iLQRSolverType
iLQRSolver

A fast solver for unconstrained trajectory optimization that uses a Riccati recursion to solve for a local feedback controller around the current trajectory, and then simulates the system forward using the derived feedback control law.

Constructor

Altro.iLQRSolver(prob, opts; kwarg_opts...)

With the following keyword arguments:

• use_static Pass Val(true) to use StaticArrays as the internal storage for the trajectories.

This will, by default, then use RobotDynamics.StaticReturn() methods for the dynamics.

All other keyword arguments are interpreted as solver options passed to set_options!.

Altro.ProjectedNewtonSolverType
ProjectedNewtonSolver

Projected Newton Solver Direct method developed by the REx Lab at Stanford University Achieves machine-level constraint satisfaction by projecting onto the feasible subspace. It can also take a full Newton step by solving the KKT system. This solver is to be used exlusively for solutions that are close to the optimal solution. It is intended to be used as a "solution polishing" method for augmented Lagrangian methods.

### Methods

Altro.backwardpass!Function
backwardpass!(::iLQRSolver)

Compute the backwardpass of iLQR, which forms a local quadratic approximation of the cost-to-go and constructs a local affine control policy about the current trajectory using time-varying LQR. The expansions of the objective function and dynamics should already be computed before calling this function.

Altro.forwardpass!Function
forwardpass!(solver, J_prev)

The "line search" of the iLQR algorithm. The system is simulated forward using the local affine feedback control policy computed by the backward pass, scaling the feedforward terms until satisfactory progress is made.

Returns the new cost after finding a line search step size that makes sufficient progress. The new trajectories are stored in solver.Z̄, and are copied in the main solve step.