A Julia package for solving optimal control problems efficiently.
Based on: Operator Splitting for Optimal Control by Brendan O'Donoghue, George Stathopoulos and Stephen Boyd.
Freely inspired by the existing C implementation of the same algorithm.
Where the
data = all_data(A, B, c, Q, S, R, q, r, x_init;
rho=50.0,
alpha=1.8,
eps_abs=1e-3,
eps_rel=1e-3,
reg=1e-6,
)See src/types.jl for guidelines on variable types.
The proximal operator must have the signature:
prox!(x_tilde, u_tilde, v, w, rho)and update x_tilde and u_tilde in place.
Before solving, one must build a cache from the problem data.
cache = setup_cache(data)Repeated calls to the solver with the same cache will reuse the internal problem state, thus resulting in a "warm start" of the resolution, yielding a noticeable performance increase.
You can reuse the same cache while these stay fixed:
A,B,Q,S,Rrho,reg
Equivalently, you can freely change these variables without rebuilding the cache:
q,r,c,x_init
x, u, tt = solve(cache, prox!; max_iters=3000)The tt output is a Timings struct which contains the timing logs of the solver run.
# Compact output
println(tt)
# Detailed output
display(tt)Runnable examples (from Operator Splitting for Optimal Control) live in examples/.
You can run them by specifying the problem size (small, medium, large).