Mass-spring system: sum-of-logs function

mass-spring pic 

Mass-spring system with N masses on a line.


Here, we show the Matlab code and the computational results obtained using lqrsp.m. In this example, we use the sum-of-logs function to promote sparsity. We set rho = 100 and select 50 logarithmically-spaced points for gamma in [10^{-4}, , 10^{-1}].

Matlab code

% State-space representation of the mass-spring system with N = 50 masses
N = 50;
I = eye(N,N);
Z = zeros(N,N);
T = toeplitz([2 -1 zeros(1,N-2)]);
A = [Z I; -T Z];
B1 = [Z; I];
B2 = [Z; I];
Q = eye(2*N);
R = 10*I;

% Compute the optimal sparse feedback gains
options = struct('method','slog','gamval',logspace(-4,-1,50),...
        'rho',100,'maxiter',100,'blksize',[1 1]);
tic
solpath = lqrsp(A,B1,B2,Q,R,options);
toc

Computational results

Download Matlab code mass_spring_slog.m to reproduce these figures.

Sparsity patterns

The number of nonzero elements in F decreases with gamma.

mass_spring_slog_nnz_F 

The number of nonzero elements in the feedback gain F as a function of gamma.
For a system with N = 50 masses, there are total of 5000 elements in F.


The number of nonzero sub-diagonals in both position and velocity feedback gains F = [F_p ; ; F_v] decreases with gamma. For large values of gamma both F_p and F_v become diagonal matrices.

mass_spring_slog_F_1 

Sparsity pattern of the feedback gain matrix F = [F_p ; ; F_v] for gamma = 10^{-4}.

mass_spring_slog_F_2 

Sparsity pattern of the feedback gain matrix F = [F_p ; ; F_v] for gamma = 0.0244.

mass_spring_slog_F_3 

Sparsity pattern of the feedback gain matrix F = [F_p ; ; F_v] for gamma = 0.1000.

Performance of sparse feedback gains

In the absence of sparsity constraints, i.e., at gamma = 0, the optimal {cal H}_2 controller

     F (0)     , := ,          F_c      , = ,      R^{-1} B_2^T P


is obtained from the positive definite solution of the algebraic Riccati equation

         A^T P         ~ + ~         P , A         ~ - ~          P , B_2 , R^{-1} B_2^T P         ~ + ~         Q         ~ = ~         0.


As gamma increases, the feedback gain F becomes sparser and the quadratic performance deteriorates.

mass_spring_slog_nnz_F_pct 

Sparsity level:

 displaystyle{frac{ {rm bf{card}} , (F) }{ {rm bf{card}} , (F_{c}) }} times 100 %

mass_spring_slog_H2 

Performance loss:

 displaystyle{frac{J(F) ,-, J(F_c)}{J(F_c)}} times 100 %


The above results demonstrate that the optimal sparse feedback gain, with 2% of nonzero elements relative to the centralized feedback gain F_c, introduces performance loss of only 8% compared to F_c.

Sparsity vs. performance
     begin{array}{cccc}     gamma     &     0.0060     &     0.043     &     0.10     [0.1cm]     displaystyle{frac{ {rm bf{slog}} , (F) }{ {rm bf{slog}} , (F_{c}) }}     &     9.64 %     &     4.08 %     &     {bf 1.96} %      [0.35cm]     displaystyle{ frac{J(F) ,-, J(F_c)}{J(F_c)} }     &     0.72 %     &     3.94 %      &     {bf 7.80} %            end{array}

Diagonals of sparse feedback gains

The elements on the main diagonals of the optimal sparse feedback gains become larger as the number of the sub-diagonals of F drops. Thus, in order to compensate for communication with smaller number of neighboring masses, each mass places more emphasis on its own position and velocity when forming control action.

mass_spring_slog_Fp_diag 

Diagonals of the optimal sparse F_p for different values of gamma: gamma = 10^{-4}~(circ), 0.0244~(+), 0.1000~(*).
Blue circles are almost on the top of the main diagonal of the optimal centralized F_p.

mass_spring_slog_Fv_diag 

Diagonals of the optimal sparse F_v for different values of gamma: gamma = 10^{-4}~(circ), 0.0244~(+), 0.1000~(*).
Blue circles are almost on the top of the main diagonal of the optimal centralized F_v.

Also see computational results obtained using other sparsity-promoting functions.

Back to mass-spring system example