
Gift to Readers

Welcome!


In the fascinating world of code research, we can gain many unique insights. From the perspective of algorithm optimization, it is like carefully polishing a piece of art; each simplification of the code and improvement of the algorithm is akin to removing impurities, making it more efficient. This inspires us to continuously examine our ways of working in life and at work, seeking optimization opportunities to enhance efficiency. For instance, when dealing with complex data, skillfully using data structures and algorithms can transform originally chaotic information into an orderly format, reminding us to be adept at finding patterns and summarizing methods when facing complex problems.


Overview



1. Introduction
In the field of control, Linear Quadratic Regulator (LQR) and Reinforcement Learning (RL) are two highly influential methods. LQR, with its mature theoretical foundation, can efficiently solve optimal control strategies for linear systems based on given quadratic performance indices, achieving system stability and optimization. Reinforcement Learning simulates the learning patterns of organisms from interactions with the environment, where agents learn optimal behavior strategies through trial and error based on reward feedback to adapt to complex and changing environments. The combination of the two is expected to merge the precision and efficiency of LQR with the flexibility of Reinforcement Learning, opening new pathways for solving complex system control problems.


2. Combination Methods and Advantages
Initialization and Guidance: Use LQR to provide an initial strategy for Reinforcement Learning. For complex systems, learning strategies from scratch can be time-consuming; the optimal control law from LQR can serve as an initial strategy, allowing the agent to fine-tune in the environment and accelerate the learning process. For example, in robot path planning, LQR provides a basic stable path, and Reinforcement Learning optimizes it to avoid dynamic obstacles.
Constraints and Optimization: Combine LQR’s performance index to optimize the Reinforcement Learning objective. Reinforcement Learning aims to maximize rewards, sometimes neglecting control costs. Introducing LQR’s quadratic index can balance control energy consumption while optimizing rewards, achieving more balanced control. For instance, in drone flight control, it ensures the completion of flight tasks while saving energy.
Model Fusion: Construct a hybrid model architecture. Some state spaces are precisely controlled by LQR, while complex and uncertain parts are handled by Reinforcement Learning. For example, in industrial automation production lines, routine operations are maintained by LQR, while Reinforcement Learning intervenes to adjust during sudden failures or drastic changes in working conditions, enhancing overall system reliability.


3. Application Fields
Autonomous Driving: Longitudinal control of vehicles combines LQR to stabilize speed, while Reinforcement Learning addresses complex road conditions such as overtaking and obstacle avoidance, optimizing driving strategies to enhance safety and comfort.
Robot Control: For robotic joint movements, LQR ensures precision in basic actions, while Reinforcement Learning helps adapt to different tasks and grasp irregular objects, expanding the operational capabilities of robots.
Smart Grid: Frequency regulation in power grids is maintained by LQR for daily stability, while Reinforcement Learning flexibly allocates resources during peak electricity usage and fault impacts, ensuring supply reliability.


4. Challenges and Prospects
Although the combination of the two has broad prospects, challenges coexist. On one hand, the theoretical framework for their integration is not yet complete, requiring in-depth research on parameter coordination, model switching, and other mechanisms; on the other hand, the computational complexity is high, especially in large-scale systems, making it difficult to meet real-time requirements. In the future, with algorithm optimization and improvements in hardware computing power, the combination of LQR and Reinforcement Learning is expected to overcome these challenges, playing a key control role in more cutting-edge fields such as deep space exploration and biomedical applications, driving technological progress.



Running Results











Partial Code

clear all;close all;clc;
%% Initialization
global P u T Tfinal epsilon A B C R HH C1 C2
global zero_G pole_G gain_G ke kd kp wn ode_k noise
% sample time
T=0.05; Tfinal = 6;
N=Tfinal/T; % Length of the simulation in samples
epsilon = 0.00000001; % For the converge
R = 0.7;
HH = 10; % Period of update policy
%system matrix
zero_G = []; pole_G = [-5]; gain_G = 5; % Human's model (zero, pole, gain)
G_fh = zpk(zero_G,pole_G,gain_G); [num, den] = tfdata(G_fh, 'v');
ke = num(2); kp = den(2); kd = den(1); % Human's parameter
wn = 1; % Natural frequency
A = [0 1 0; % System matrix
-2*wn -wn^2 0;
% 0 0 0;
ke/kd 0 -kp/kd];
B = -[0; 1; 0]; % Input matrix
C = [1 0 0];
eig_A = eig(A)
%initial conditions
x0_set = [10,0,10,0]
x0=x0_set; % 3 vectors and J
P=[0 0 0;
0 0 0;
0 0 0]; % Positive definite and symmetric matrix P
Pold = eye(3); Psave = zeros(length(P),length(P),2); % For monitoring P matrix
uu=[]; % saving the control signal for plot
xx=[]; % saving the state for plot
KK=[]; % saving the optimal gain for plot
% Vectorization: Parameters returned by the least squares
WW=[P(1,1); 2*P(1,2); 2*P(1,3); P(2,2); 2*P(2,3); P(3,3)];
WWP=[WW; 0];
% Parameters for the batch least squares
j=0; Xpi=[];
E=real(eig(A-B*inv(R)*B'*P)); % saves the poles of the closed loop system
EE = [E];
upd=[]; % stores information relative to updates the parameters
k=1; ch=0; % Real time iteration, Interval iteration
qm = zeros(10,1);
qd = zeros(10,1); qd(1) = x0_set(1);
References
[1] Chen Ge, Zhang Junbo, Peng Ying, et al. A Method for Emergency Control Combining Chain Fault Adjustment Based on Spatial Pruning Reinforcement Learning [J/OL]. Power System Automation, 1-15 [2025-02-27]. http://kns.cnki.net/kcms/detail/32.1180.TP.20250223.1915.002.html.
[2] Sun Hui. Combining Student Learning Characteristics to Strengthen English Vocabulary Implementation—Taking Oxford Yilin Edition Sixth Grade Unit 7 as an Example [J]. English Magazine (High School Edition), 2025, (05): 67-69.
Some content in this article is sourced from the internet, and references will be noted or cited as references. If there are any inaccuracies, please feel free to contact us for removal.

Scan to Contact Us!