Infinite dimensional problem has been converted to a finite dimensional problem
But the nonlinear optimisation problem is still too large (\(N\times length(u) \times length(x)\) design variables)
It is a non-convex problem
It is a highly nonlinear problem
Mostly requires good initial guess to converge to the global minimum
Computationally expensive
Most importantly, it requires us to integrate the dynamics over the time interval. For sufficient accuracy, we need to use a high order integrator which is computationally expensive.
# This program defines a 3x3 matrix and calculates its exponential from [1, 10] times. It finally reports the# condition number of the matrix and the exponential of the matrix. This will show that the exponential of the# matrix is ill-conditioned.usingLinearAlgebraA = [100; 020; 003]println("Condition number of A: ", cond(A))# Prints the condition number of the exponential of Afor i in1:10println("Condition number of exp(A) at ", i, " times: ", cond(exp(A*i)))end
Condition number of A: 3.0
Condition number of exp(A) at 1 times: 7.38905609893065
Condition number of exp(A) at 2 times: 54.598150033144236
Condition number of exp(A) at 3 times: 403.4287934927351
Condition number of exp(A) at 4 times: 2980.9579870417283
Condition number of exp(A) at 5 times: 22026.465794806718
Condition number of exp(A) at 6 times: 162754.79141900392
Condition number of exp(A) at 7 times: 1.2026042841647768e6
Condition number of exp(A) at 8 times: 8.886110520507872e6
Condition number of exp(A) at 9 times: 6.565996913733051e7
Condition number of exp(A) at 10 times: 4.851651954097903e8
Direct Local Collocation
Direct Local Collocation
Aim is to reduce the number of function evaluations (\(\mathbf{f}(.)\)) required per iteration
\(\mathbf{x}\) needs to be smoother than \(\mathbf{u}\)
A particularly useful approximation is piecewise linear approximation for \(\mathbf{u}\) and a cubic spline approximation for \(\mathbf{x}\)
Chebyshev polynomials are particularly useful for global approximation
\[ T_n(x) = \cos(n \cos^{-1}(x)) \]
They are orthogonal over \([-1,1]\)
Code
# This program plots the first 5 Chebyshev polynomials of the first kindusingPlots# This function defines the chebyshev polynomial of the first kindfunctionchebyshev(n, x)if n ==0return1elseif n ==1return xelsereturn2*x*chebyshev(n-1, x) -chebyshev(n-2, x)endendx =-1:0.01:1plot(x, chebyshev.(0, x), label="T_0(x)", xlabel="x", ylabel="T_n(x)")plot!(x, chebyshev.(1, x), label="T_1(x)")plot!(x, chebyshev.(2, x), label="T_2(x)")plot!(x, chebyshev.(3, x), label="T_3(x)")plot!(x, chebyshev.(4, x), label="T_4(x)")
Chebyshev polynomials of the first kind
Global Polynomial Approximation
Pseudospectral Methods
So the dynamics \(\dot{x}(t) = f(x(t), u(t))\) can be approximated by calculating the residual