Optimization of the model predictive control meta-parameters through reinforcement learning
수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
기본 정보
- 저자
- DOI
- 10.1016/j.engappai.2023.106211
- 저널
- Engineering Applications of Artificial Intelligence
- 발행년도
- 2023
- 발행기관
- Elsevier BV
- 피인용수
- 13
- 라이선스
- cc-by
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.1016/j.engappai.2023.106211
- 토픽
- Fuel Cells and Related Materials
- OpenAlex ID
- W3213234866
평가 내용
- 관련도
- 사업분야
- 수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '수소연료전지 > 연료전지용 수분제어장치(가습기)' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
본문 81,446자
본문 펼치기
섹션 본문 98문단 · 46,179자
(제목 없음)
1Model predictive control (MPC) is increasingly being considered for control of fast systems and embedded applications.However, the MPC has some significant challenges for such systems.Its high computational complexity results in high power consumption from the control algorithm, which could account for a significant share of the energy resources in battery-powered embedded systems.The MPC parameters must be tuned, which is largely a trial-and-error process that affects the control performance, the robustness and the computational complexity of the controller to a high degree.In this paper we propose a novel framework in which any parameter of the control algorithm can be jointly tuned using reinforcement learning (RL), with the goal of simultaneously optimizing the control performance and the power usage of the control algorithm.We propose the novel idea of optimizing the meta-parameters of MPC with RL, i.e. parameters affecting the structure of the MPC problem as opposed to the solution to a given problem.Our control algorithm is based on an event-triggered MPC where we learn when the MPC should be re-computed, and a dual mode MPC and linear state feedback control law applied in between MPC computations.We formulate a novel mixturedistribution policy, and show that with joint optimization we achieve improvements that do not present themselves when optimizing the same parameters in isolation.We demonstrate our framework on the inverted pendulum control task, reducing the total computation time of the control system by 36% while also improving the control performance by 18.4% over the bestperforming MPC baseline.
I. INTRODUCTION
2Model predictive control (MPC) is a powerful optimizing control technique, capable of controlling a wide range of systems with high control proficiency while respecting system constraints.Nonlinear MPC can even handle nonlinear dynamics and constraints, and while not as simple as its linear counterpart, is increasingly being considered for embedded systems applications with fast dynamics [1,2,3].However, one of the main drawbacks of the MPC is its high computational complexity, which makes it ill-suited for applications with lowpowered hardware or battery energy restrictions, necessitating some form of compromise in its implementation [4,5].
3The high computational complexity of the MPC comes as a result of its online operation consisting of solving a numerical optimal control problem (OCP) at every time step, executing the first control input of the computed optimal solution, and then solving the OCP again at the subsequent time step.Several adjustments to this basic paradigm has been suggested in order to reduce the computational complexity, e.g.early termination (suboptimal) MPC [6], semi-explicit MPC [7], and explicit MPC [8].
4A further challenge of the MPC method is the need to tune its parameters to the task at hand, greatly affecting the control proficiency, robustness and computational complexity of the controller.The main tunable parameter in these regards is the prediction horizon, which essentially controls how far into the future the MPC evaluates the optimality of its solution.Further, the performance sensitivity to the prediction horizon varies over the state space, and this observation motivated the adaptive-horizon MPC technique, in which the prediction horizon is varied according to some criteria.There exists several suggestions in the literature on how to design these criteria, e.g.terminal conditions [9,10], as decision variables of the OCP [11], and learning approaches [12,13].Other parameters of the MPC scheme are also subject to tuning, e.g.discretization step size, objective functions, optimality tolerances and constraints.How to tune all these parameters for the MPC scheme is a non-trivial question.
5Learning can be an important tool in assisting the tuning process of the MPC scheme.In this paper we propose the novel idea of tuning the meta-parameters of the MPC scheme using reinforcement learning (RL).By meta-parameters we mean parameters that affect the structure of the OCP (including its initial conditions, i.e. when it is computed), rather than parameters that affect the solution to a given OCP, the tuning of which has previously been demonstrated in the literature [14,15].This work extends our previous works [16], in which we propose to learn when it is necessary to recompute the MPC solution, and [13], in which we suggest to learn the optimal prediction horizon of the MPC scheme as a function of the state.Here, we propose a unified framework in which these meta-parameters, as well as any other parameters of the control algorithm, are jointly optimized to simultaneously maximize the control performance and reduce the computational complexity in a configurable manner.The control algorithm we propose consists of a recomputation policy that decides when the MPC solution should be computed, a statefeedback controller (i.e. the linear quadratic regulator (LQR)) that is applied on the predicted state trajectory produced by the MPC in between MPC computations, and an RL algorithm that incorporates the parameters of these controllers and optimizes them according to the specified objective.Although we can enforce input constraints, there is no mechanism to ensure that the state constraints hold in our control algorithm, and the constraint satisfaction properties will be determined by the behaviour identified as optimal through RL.While we demonstrated in the aforementioned works the effectiveness of learning these meta-parameters in isolation, it is clear that the questions of when and how (wrt.its tunable parameters) to compute the control algorithm are related, and treating them separately fails to consider the interactions and indirect effects at play.
6The contributions of this paper can be summarized as: 1) We propose the novel idea of optimizing the metaparameters of the MPC scheme using RL. 2) We develop a novel MPC formulation in which the performance and computational power usage are jointly optimized in a configurable, automated manner, which could open up new applications for MPC. 3) To realize the proposed algorithm, we employ novel use of mixture distributions for RL.The rest of the paper is organized as follows.Section II introduces the problem formulation and the necessary theoretical background for our method.Section III then describes our method in detail, before we in Section IV demonstrate our method on a numerical example with the inverted pendulum.
II. PRELIMINARIES AND PROBLEM FORMULATION
7We consider control problems on the form:
8where x is the state vector, u is the control input vector, the function f defines the (discrete-time) system dynamics and C defines the cost objective to be minimized.The system runs in an episodic fashion, beginning in some initial state x 0 and terminating after some predetermined time T has passed.For any statement that holds regardless of the time, we omit the time subscript.To denote a contiguous sequence of points we use the subscript x t:t+n , i.e. the sequence of states from time t to time t + n.We denote the time dimension of variables internal to any controller scheme with a subscript k.Finally, matrices are denoted with bold uppercase letters, e.g. A.
A. Control Algorithm 1) Model Predictive Control
9In this paper we consider adaptive-horizon nonlinear statefeedback discrete-time MPC [17,18].The MPC receives as arguments the current state of the plant, xt , exogenous input variables (e.g.reference signals), pt , as well as the prediction horizon, N t , for the OCP.We label the MPC control law (for a given horizon selected by the horizon policy π N θ N , more on this in Section III-B3) as:
10where the first return value is the optimal input sequence, the second return value is the predicted optimal state trajectory, and θ M are the tunable parameters of the MPC scheme.The OCP is formulated as:
11Here, θ M is the stage cost consisting of a task-specific objective and the input change term ∆u k D θ M ∆u k where D θ M is the input-change weight matrix and ∆u k = u k −u k−1 , m θ M is the terminal cost, ρ ∈ (0, 1] is the discount factor, fθ M is the MPC dynamics model, and h θ M is the constraint vector.The stage cost evaluates the computed solution locally up to N t − 1 steps, the terminal cost m θ M (x Nt ) should therefore provide global information about the desirability of the terminal state of the computed trajectory, which helps the MPC avoid sub-optimal performance.Therefore, the more accurate the terminal cost is wrt. to the total cost of the infinite horizon solution, the shorter horizons can be used in the MPC scheme while still delivering good control performance [19,20].We therefore propose to learn the value function of the MPC, which measures the total cost accrued over an infinite horizon, and use it as the terminal cost.For brevity, we refer the reader to [13,19,20] for more information on this topic.Note that while we assume state-feedback for simplicity, the formulation could easily be extended with an estimator such as the moving horizon estimator which can be tuned in unison with the MPC [21].
12We further employ a modification to the MPC framework called event-triggered MPC, in which the OCP is not recomputed at every time step, but rather a recomputation policy π c θ c decides at every time step whether the OCP should be recomputed.Thus, not only the first input of the MPC input sequence u M t is applied to the plant, but rather a variable number of inputs u M t:t+n , n < N t are applied sequentially at the corresponding time instance until the recomputation policy triggers the recomputation of the OCP at time step t + n.We will detail this recomputation policy in Section III-B1.
2) Note on Feasibility
13There is no explicit mechanism in our method that ensures the recursive feasibility of the MPC scheme, or the stability of the control algorithm.However, the control algorithm and tuning framework we present is agnostic wrt. to the implementation of the underlying controllers.As such, one could modify the MPC scheme by adding e.g.assumptions on the form and magnitude of the disturbances, add terminal constraints, or entirely replace the MPC scheme with more complex formulations, e.g.robust MPC [22] or tube MPC [23].
14The prediction horizon is one of the most important tunable parameters to achieve stable control with the MPC scheme [24,25].Learning approaches can therefore be an important tool in identifying prediction horizons that yields a stable control system.As discussed in Section III-E, RL is an optimization procedure that seeks optimality wrt.its reward function, therefore, if it produces non-stabilizing solutions this would suggest that the learning problem itself is ill-posed.
153) The Linear Quadratic Regulator
16The LQR [26] is a state-feedback controller that arises as the optimal solution to unconstrained control problems where the dynamics are linear, and the cost is quadratic.The role of the LQR in our control algorithm is to act as the linear feedback correction of the MPC, that can be applied to compensate for errors in the open loop predicted state trajectory between MPC recomputations.To accomplish this, we employ a timevarying LQR where the A t and B t matrices are obtained from the MPC scheme as the linearization of the MPC model each time it is computed:
17After the horizon end (i.e. when t > i + N i where i is the time of last MPC computation), we set the LQR dynamics matrices as the time-invariant matrices corresponding to the steady state (equilibrium) of the system x s t , u s t (8).The specific linearization procedure depends on the implementation of the dynamics model in the MPC, i.e. discrete vs continuous model and the accompanying discretization schemes.The Q and R cost-weighting matrices are initialized from the MPC objective as follows, and then tuned further as described in Section III.
18In this paper we focus on the discrete-time formulation of the LQR.The LQR control law (12) consists of a statefeedback gain matrix K that is derived from the dynamics matrices A and B, the cost-weighting matrices Q, R and N, and the solution S to the discrete-time Riccati-equation (10):
19We consider in this paper the vector θ L containing all the elements of the matrices Q, R, N as parameters of the LQR controller that can be optimized.The finite horizon LQR control problem is stated as:
20where N i is the optimization horizon.We also consider the infinite horizon problem, i.e.N i = ∞, in which the matrices are constant wrt.time and the discrete-time algebraic Riccati equation (DARE) is solved at its stationary point, yielding the solution S ∞ and consequent K ∞ .
B. Reinforcement Learning
21The system to be optimized in the RL framework [27] is formulated as a Markov decision process (MDP).The MDP is defined by a state space s ∈ S, a set of actions a ∈ A, a transition probability matrix T that governs the evolution of states as a function of time and actions, i.e. s t+1 = T (s t , a t ), a reward function R(s, a) that describes the desirability of the states of the system, and finally, the discount factor γ ∈ [0, 1) (note the different limits from ρ) that describes the relative importance of immediate and future rewards.Note that rewards, R, are interchangeable with costs, C, through the substitution R = −C and changing maximization of the objective to minimization.We will use rewards when discussing RL as this is customary in RL.
22The objective in RL is to develop a policy π θ , i.e. a function that maps from states to actions (here parameterized by θ) that maximizes the expected discounted sum of rewards.In this paper we use the policy gradient algorithm proximal policy optimization (PPO) [28].For brevity, we refer the reader to the original paper [28] for details on how PPO updates the parameters to be optimized.In general, policy gradient algorithms updates a parameterized stochastic policy directly in the parameter space, by sampling actions from the policy's action distribution and observing the outcomes in terms of states and rewards.Parameters are adjusted to increase the likelihood of actions leading to high rewards using gradient ascent with gradients from the policy gradient theorem [27]:
23where
III. METHOD A. A State Space with the Markov Property
24For RL theory to hold for the control system we wish to optimize, the state space needs to have the Markov property, i.e. future states should not depend upon past states given the current state.This section outlines such a Markovian state.
25Consider the input sequence u M i:i+Ni−1 and the predicted state trajectory xi+1:i+Ni computed by the MPC at time i.As discussed in Section II-A1, a variable number n ∈ {0, 1, . . ., N i − 1} of these inputs are applied to the plant.Since n is not known a priori, the state vector x is not a sufficient state representation to yield the Markov property for the control system consisting of the recomputation policy, the horizon policy, and the MPC and LQR control laws.We define an augmented state s in (19) that contains the current plant state and exogenous variables, labeled xt and pt , the state of the system, exogenous variables, and prediction horizon used when the last MPC computation took place, labeled xi , pi , and N i , as well as the number of time steps since the MPC computation, t − i:
26where xt has evolved from xi according to the real system dynamics.When the MPC problem is recomputed, the deterministic transition i ← t, xi ← xt , pi ← pt , N i ← N t takes place.The MPC and MPC plus LQR control laws deployed on the plant is then ( 20) and ( 21), respectively, while the total control system is defined as (22), where the proj h θ M operator projects the control input onto the constraint vector h θ M (6):
27and where x s t is the steady state equilibrium of the system at time t, which is time-variant in the case of time-varying references.
28Assumption 1.The time-varying exogenous input variables pt are generated by a Markovian process.
29Proposition 1.The state s has the Markov property, i.e.P (s t+1 |s t ) = P (s t+1 |s 0:t ) Proof.First, note that by definition from (1) x is Markovian given u:
30However, the control law π CS θ M,L (22) that determines u t consists of π M θ M (20) -which depends on the state and exogenous variables xi , pi and the prediction horizon N i at the last MPC computation -and π M,L θ ML (21), which depends on the current state x t and the (t − i) th element of the MPC's predicted state trajectory, and x s t which depends on pt .Therefore, with s as defined in (19) we have:
31Finally, note that the MPC input sequence u M i+1:i+Ni−1 and the predicted state trajectory xi:i+Ni follows from π M θ M and its arguments (which are all known), and as such does not need to be contained in s for s to be Markovian:
B. Policies
32We use the notation π θ (s) to label a deterministic function of the state s that is parameterized by θ, and π θ (•|s) to label the stochastic version of the same function.The notation • signifies that the value is drawn from the policy's probability distribution.The implementation of the PPO algorithm requires the log probability of the policies, and as such we will list the probability distributions, denoted P , and corresponding log probabilities, denoted log P , for the policies we optimize.For brevity, we omit listing input-independent conditional variables as arguments (e.g.covariance) of the distributions.
331
) The Recomputation Policy
34The recomputation policy π c θ c decides on each step whether the MPC problem should be recomputed, or if the previously computed solution is still acceptable.In other words, it is a binary variable that chooses among the two different options: recompute or not.As such, we model it as a Bernoullidistributed random variable, where the policy outputs the logit of the probability that the OCP should be recomputed (27), from which we can deduce the probability of not recomputing.We label the output of the of the recomputation policy c ∈ {0, 1}.The Bernoulli distribution has the probability mass function (PMF) (28).
35The log probability can be expressed as follows:
36Finally, the policy gradient of the recomputation policy is:
372) The Horizon Policy The MPC prediction horizon N is a positive integer, which we model with the GP-2 variant of the generalized Poisson distribution (GPD) [29].Other models we considered but decided against includes categorical classification models, as they do not consider the ordinal information of the horizon variable, and the standard Poisson distribution, which we found to be too inflexible due to its mean and variance being equal.The horizon model outputs the rate parameter of the GPD, µ, as a function of s, while the dispersion parameter α is learned as an input-independent variable.
38In this model, α is restricted according to 1 + αµ > 0 and 1 + αN > 0. To address these constraints, we introduce two hyperparameters N min and N max that correspond to the minimum and maximum horizons that the MPC should operate with.To constrain the rate parameter µ we apply the hyperbolic tangent function, denoted tanh ∈ [−1, 1], and then linearly scale it to the limits defined by N min and N max .Finally, the learned α parameter is clipped according to restrictions outlined above:
39The log probability of the GPD and the policy gradient of the horizon policy is defined as follows:
40There are several techniques to sample from this distribution [30].We favor the normal approximation sampling technique for its low run-time complexity: With a sufficiently high rate parameter (i.e.µ 10), the GPD is approximately normally distributed with mean and variance as given in (34):
41When optimizing the horizon policy in isolation (that is, not together with the rest of the control system) we find that faster convergence and more stable solutions are obtained by learning on an augmented MDP where every action selected by the policy is repeated d > 1 times.Hence the policy only senses every d'th state, and the rewards it receives are the cumulative reward over every step of the control system in the d steps.This technique is known as "frame-skip" in RL and is an effective method to enhance learning for problems with discrete actions, see e.g.learning to play atari-games [31], but also for continuous control [32].While the exact mechanisms behind the improvements stemming from frame-skipping is not fully understood, it is clear that in certain problems it increases the signal-to-noise ratio of every data sample, which simplifies the credit assignment problem.When using d > 1 during exploration, we use d = 1 during exploitation (evaluation) as this increases performance.We find that the horizon policy is not sensitive to the exact value of d, and all values in d ∈ [2, T ] generally accelerates learning.Finally, note that when optimizing the horizon policy and the recomputation policy together, the latter electing to not recompute the MPC will naturally enforce a form of frame-skipping.
423
) The Controller Policies
43To ensure sufficient exploration we formulate a stochastic version of the MPC, and the MPC plus LQR control laws (denoted
44, modeling them as Gaussian random variables (40).The mean is then the output of the control laws, and the covariance of each controller is a learned input-independent variable of the RL algorithm.To be concise, we use * in place of the superscript for the control laws as in (40).We will first develop these policies for the MPC scheme with a given horizon N , where the output is made stochastic as follows:
45Note that the argument N to the policies is redundant (and thus these policies are equivalent to those in Section III-A), as N i in s will always reflect the latest N that is decided by the horizon policy ahead of control law calculation.We use this argument here to clarify the derivations.The log probability of the distribution and the policy gradient is:
46Then, note that the adaptive-horizon MPC control law is a distribution of the MPC schemes over the range of prediction horizons, with weights P N assigned by the horizon policy.We first query the horizon policy for which prediction horizon to employ, and then the solution to the MPC problem (3) is computed with the selected horizon:
47where the superscript N indicates that this is the adaptivehorizon MPC policy.Using the indicator function:
48we can formulate the probability distributions and log distributions for the stochastic adaptive-horizon control policies:
49where the log operator can be applied inside the summation over the prediction horizons in (48), because we know the value Ñ of the horizon variable N that is sampled in advance of the calculation of the control laws [33].
4) The Complete Policy
50We collect all the parameters of the meta-parameterdeciding recomputation and horizon policies described above, and the parameters of the controllers into a single parameter vector θ = θ c , θ N , α, θ M , θ L , Σ M , Σ ML , and define the complete policy π θ , whose input is the state s and output is the action a = c, N, u M , u ML Section III-B1 presents the recomputation problem of the MPC and the policy that decides when to compute it.We now view the recomputation policy π c θ c as selecting the active controller between the two control laws.It is then clear that π θ is a mixture distribution between the Gaussian control policies where the weights of the mixture are assigned by the Bernoulli recomputation policy π θ c .We label the probability distribution of the complete policy π θ as P a and define it and the log probability as follows:
51= 1 c=0 log P c (0|s) + log P N ( Ñi |s) + log P u (ũ ML |s, Ñi )
52where we again used the fact that we know the values of the sampled variables c, Ñ to take the logarithm of the sums in (51) and (52), and Ñ represents the output of the horizon policy at the current step t in the case the recomputation policy signals to recompute the MPC.While ( 52) is all that is strictly needed to use the PPO algorithm, we derive the policy gradient as well to highlight the connection to the LQR gradient presented in Section III-C, as well as for future applications of this control framework with other RL algorithms.
53With this policy one can optimize any parameter of the MPC and LQR controllers jointly, by providing the gradient of these controllers wrt. the parameters.In the RL context, we show how one can obtain these gradients for the LQR controller in Section III-C.For the gradient of the MPC see e.g.[14,34].
C. Optimizing LQR with Reinforcement Learning 1) The Time-Invariant Case
54To apply the policy-gradient theorem to tune the LQR, we need to compute the gradients of the K-matrix wrt. to the Q, R and N matrices.As equations (10) and (11) show, the feedback matrix K is only implicitly defined in terms of the these matrices, and so direct differentiation of equations ( 10) and ( 11) is not possible.Since we obtain the system matrices A and B directly from the MPC scheme and they have a clear purpose in making the MPC and LQR objectives compatible, we assume that they are fixed wrt.
55Assumption 2. The weighting matrices {Q, R, N} values are such that the DARE has a solution S ∞ .Proposition 2. We flatten the matrices S, K, Q, R and N into vectors, and organize them as follows: y = {S, K} and z = {Q, R, N}, such that the DARE and K-matrix equations can be written on the vector form F (y, z) = 0.The gradient of K wrt. the weighting matrices Q, R, N can then be found as:
56Proof.We rewrite ( 10)-( 11) on the general vector form F (y, z) = 0 where y = {S, K} and z = {Q, R, N}.
57We then apply the implicit function theorem (IFT) which states that:
58These gradients are easily obtained with automatic differentiation software.
59Assumption 2 holds if Q − NR −1 N 0 and R > 0, and further it is required that the symplectic pencil of the problem has eigenvalues sufficiently far from the unit circle, which is satisfied if the pair (A, B) is stabilizable and the pair (A, Q) is detectable [35].These conditions can be ensured by estimating the gradients as described above, and then solving a semidefinite program (SDP) using the estimated gradients subject to these constraints.However, for simplicity and to avoid constrained optimization, we set N = 0, simplifying the constraints on the positive (semi)-definiteness to Q 0 and R > 0. Further, we write Q and R in terms of their Cholesky decompositions:
60and let the RL algorithm adjust the elements of Q C and R C .
2) Time-Varying Gradients
61In what follows we will assume N = 0, for simplicity of the derivation and expressions (and the constraint reasons outlined above).We find the gradients with respect to p, where p is an arbitrary scalar element of the Q and R matrices.The full gradients ∇ Q,R K k can then be found by solving (62) for each parameter of Q and R and arranging the results into the appropriate matrix structure.The derivations involve repeated application of the chain rule and the following relation for the gradient of the matrix inverse, where we define E for convenience:
62Note that these gradients could easily be extended with time-varying Q and R matrices.The time-varying gradients of K k are given as follows:
D. Summary of Control Algorithm with Learning
63The complete control algorithm is outlined in Algorithm 1.This shows the control algorithm in the exploration phase, but the exploitation phase is identical with the two exceptions: 1) there is no data collection (and therefore no parameter updates), and 2) we use the deterministic version (i.e. the mode of the probability distribution) of all policies except for the recomputation policy.The Bernoulli distribution of the recomputation policy does not generally tend to quasideterminism as exploration settles, unlike the other policies.As such, we find that the deterministic version of this policy has worse control performance and less consistency in the plant response than the stochastic version which we are in fact optimizing the response for.
64The system to be optimized runs in an episodic fashion, and every Z steps the RL algorithm updates the parameters of the control system.
E. Reward Function
65The RL reward function codifies the behaviour that the control algorithm is designed to exhibit, wrt.stability, control performance, and computational complexity.As RL is a trialand-error based optimization approach, the control algorithm will necessarily have to attempt risky maneuvers and experience the consequences in order to learn how to control the system.However, with a feasible composition of the learning problem in terms of hyperparameters and expressive power of the learned components, the end result of the converged behaviour should be stable and yield good control performance.A failure to achieve this would therefore indicate a misalignment between choice of reward function, and the control design requirements.With this in mind, we formulate a reward function on the following form:
66Here, λ h and λ c are weighting factors that represents the relative importance of the different terms.R is the control performance term which incentivizes the RL policy to achieve good control performance.We set it to be the same as the stage cost from the MPC objective, i.e.R = − but this is not a strict requirement.R h is a term that indicates whether any system constraints are violated.If using hard constraints as is the case in this paper, this term is binary and is further weighted by T − t, that is, the number of time steps remaining in the episode, since the episode is prematurely terminated if any constraints are violated.If the system to be controlled has soft constraints, the R h term could be made continuous.The R c term indicates whether the MPC was computed at the current step (R c = 1), and as such it should reflect the relative computational complexity of the of the two modes of the control system.Finally, R N represents the computational complexity of the MPC as a function of the prediction horizon N .We assume that the computational complexity grows linearly in the prediction horizon, i.e.R N (N t ) = N t , as a lower bound for the true complexity.We favor a lower bound as this would bias the RL policy towards better control performance rather than lower computation.The relationship between the prediction horizon and the computational complexity depends upon the algorithms used in the MPC implementation.We employ an interior point method, which under the assumption of local convergence and a guess of an initial solution that is reasonable, generally yields linear complexity [36], while other methods such as active set methods typically yield quadratic growth in computational complexity [37].
F. Initialization of the Learning Procedure
67How to initialize the control algorithm, that is, defining its behaviour before any learning takes place is a question that has several valid answers.One could favor the most computationally expensive initialization, i.e. compute MPC every step with the maximum horizon, which without any prior knowledge about the task would be the "safest" initialization that is most likely to give the best control performance.This is however not necessarily the initialization that would facilitate the learning process most optimally, and might trap the learned components in local minima.To simplify the learning problem one might therefore instead favor initializing the components in the center of their operating range and with high entropy (wrt.to its output) such that exploration is maximal.
68We offered some guidance in the case of the LQR in Section II-A3, i.e. the LQR should be initialized such that it is compatible with the MPC.We view the purpose of the recomputation policy as finding instances where comparable (or better) control performance can be achieved without computing the MPC, and as such, we choose to initialize it to emulate the MPC paradigm and with high probability elect to compute the MPC.For the horizon policy, we initialize it equal to the best performing fixed horizon MPC scheme.Initializing the policies can be done by adjusting the bias terms of the policy outputs:
69IV. NUMERICAL RESULTS
70This section illustrates the proposed control method as outlined in Section III on the simulated inverted pendulum system.Additionally, to aid in highlighting the contributions of the different meta-parameters of the control algorithm we also present experiments for each meta-parameter in isolation.
71We set N min = 1 and N max = 40, and note that this horizon does not cover a full swing-up maneuver of the pendulum (requiring N > 100).The maximum horizon is chosen to emulate the effects of a computationally limited embedded hardware platform.The weighting terms of the reward function (65) are set to λ h = −10 and λ c = 10 −2 .This ensures that violating constraints incur a higher cost than finishing the episode, and makes the computation account for approximately 8% of the total cost of the standard MPC scheme (i.e.MPC computed at every step) with the highest prediction horizon.
72While our method supports tuning parameters internal to the MPC (i.e.objective, constraints etc.), doing so requires reevaluating the log-probabilities and recomputing the OCP for every data sample after every parameter update (when using minibatches or several passes over a dataset).This adds considerable computation, and optimization of these parameters with RL has been successfully demonstrated in previous works [15,34].Therefore, since this paper focuses on optimizing the meta-parameters of the MPC scheme (that is, the prediction horizon and when to compute) we do not tune any parameters internal to the MPC in this example.We do however optimize the parameters of the LQR to illustrate the concept, as the LQR is less costly to evaluate.Finally, we omit learning the value function of the MPC, as it adds considerable complexity to the experiments, and was found to not add much benefit for control of similar systems in [13].
A. The Inverted Pendulum System
73The inverted pendulum system is a classic control task in which a pendulum, consisting of a rigid rod with a mass at the end, is mounted on top of a cart that is fixed on a track.The control system exerts a horizontal force on the cart, which moves the cart back and forth on the track, which subsequently swings the pendulum.The control objective is to stabilize the pendulum in the up-position and positioning the cart at the position reference, while respecting the constraint that the cart's position is limited by the physical size of the track.The dynamics of the system are highly nonlinear, and further the system is unstable, meaning that a controller is necessary to guide the system to stable conditions and then to maintain the stability.We perturb the parameters of the MPC dynamics model such that its dynamics differs from the plant dynamics, as shown in Table I, and thus the LQR is a useful addition to correct for prediction errors in between the MPC computations.The state x consists of the cart position ψ and velocity v, pendulum angle φ and angular velocity ω.
74Each episode lasts a maximum of 150 steps (i.e.T=150), or until the position constraint (72) is violated.We sample initial conditions according to (71), and a position reference (70) that is redrawn every 50 steps, where U is the uniform distribution.The MPC objective is defined as (73), i.e. minimize the kinetic energy of the system and the distance of the cart to the position reference, while maximizing the potential energy.
75x 0 ∼ [0, U(−1, 1), U(−π, π), U(−1, 1)] , D = [0.1](71)
B. Training and Evaluation
76The hyperparameters of the PPO algorithm are listed in Appendix A. The horizon and recomputation policies are fullyconnected neural networks (NNs) with 2 hidden layers with 64 nodes in each, whereas the value function is an NN with 2 hidden layers of 128 nodes, all using the tanh activation function.We use the same hyperparameters for the isolated experiments, rather than tuning them specifically, and as such the isolation experiments serve mainly to assess how the two meta-parameters contribute.For the horizon experiment we use a frame-skip of d = 10, and for the other experiments we use a varying d ∈ [1,2,3,4] that is drawn at the start of every episode (with d = 1 when evaluating).
77We initialize the recomputation policy using (66) to compute the MPC with 90% probability, thus within two time steps there is a 99% probability that the MPC is computed.It therefore initially mimics the traditional MPC scheme closely.The horizon policy is initialized at the best performing fixedhorizon (Fig. 2), i.e.N = 31, using equation (67).
78To evaluate the performance of the control system governed by the RL policy, we construct a "test-set" consisting of 25 episodes where all stochastic elements are drawn in advance (i.e. initial conditions and position references) such that the episodes are consistent across evaluations.This gives us an objective way to compare and order policies on their performance, and to compare against the MPC baselines.We set the cost objective (1) C = −R, and evaluate models based on the total sum of costs over the episodes in the test-set.
79Moreover, for every experiment we report the average over five random initial seeds (referred to as models), which impact the initializations of NNs and the randomness in exploration and episodes.Fig. 2 shows the total cost of the control algorithm baselines as a function of a static prediction horizon and recomputation schedule.The minimum cost is achieved with a prediction horizon of N = 31 and a schedule of recompute at every step.It is important to note that while this figure indicates that the optimization landscape as a function of these two variables is monotonic and amenable to optimization, the reward landscape as a function of the parameters θ (which in this example consists of the parameters of the LQR and the parameters of the recomputation and horizon NNs) is likely very different -containing many valleys and hills to overcome in order to minimize the cost objective.
C. Inverted Pendulum Results and Discussion
80The results of the experiments are presented in Figures 4 and 3, and Table II.When reporting the cost of the tuned system, we average over the best performing policy of each model, as well as over five seeds to account for the stochastic recomputation policy.When describing learned behaviour as in Fig. 3 however, we use the best performing policy and one specific seed.We summarize our main findings as follows:
81Learning improves both computational complexity and control performance.The RL framework we propose is able to improve upon the total objective by 21.5%, which interestingly is not only due to reductions in the computation term (70.7%) but also a sizable improvement on the control performance objective (18.4%).For this example it takes about 20 hours of data of interaction with the system to reach convergence, corresponding to 700 thousand data samples.Fig. 4a shows that generally the performance monotonically improves with more data, we therefore do not view the data requirement as a major issue.Note that we did not spend significant time tuning the hyperparameters of the RL algorithm, and we favored consistency over faster rate of improvement.Thus, the algorithm's data requirement could potentially be improved with hyperparameter optimization.Fig. 4 shows that the recomputation meta-parameter is the most impactful, reaching a cost of around 700 when optimized by itself, which is about 13% higher than the converged value of the optimized complete policy.It also shows why we favor biasing towards higher computation, as while initializing the recomputation policy to compute the MPC with 10% probability reaches the same asymptotic performance as the 90% initialization, it is the only policy we trained that intermittently violates the constraint.
82Because we initialize the learning problem at a best-effort of optimal tuning, the control performance improvements we observe are non-trivial to explain and arise due to complex interactions between multi-step adaptive-horizon MPC and the LQR control law.Fig. 3 shows the distribution of the prediction horizon, and the steps between MPC computations chosen by the policies.The horizon policy has converged to only selecting the maximum horizon, while the MPC is mostly computed at every step (70% of steps) with some significantly longer streaks.Because of the finite-horizon nature of the OCP the MPC will produce solutions of varying optimality based on the exact initial conditions it is computed from.The RL policy has learned to recognize a set of conditions for which the computed solutions are more optimal than neighboring conditions, and therefore not recomputing and employing a longer section of the more optimal input sequence will produce better control performance.
83The control algorithm we propose adds some overhead compared to MPC, i.e. evaluating the policies deciding if the MPC should be computed and with what horizon, and computing the LQR gain-matrix as necessary.The overhead is however small compared to the execution time of the MPC, and therefore our framework results in a 36% reduction in the total processing time of the control system compared to the best performing MPC scheme.This frees up resources for other on-board tasks the controlled system might have, or could be leveraged to increase the battery life of the system.
84One of the models we trained for the complete policy, and one of the models for the isolated recomputation policy got stuck in the local minima of computing the MPC at every step, and since this didn't give any interesting results (essentially maintaining the initial behaviour and performance) we excluded them from Fig. 4 and the discussions, replacing them with new models with new seeds.Since policy gradient algorithms are local search methods it is to be expected that it finds local minima, and random exploration can cause it to sometimes settle in sub-optimal local minima.This is also a question of how much data is used to generate the gradient.
85Joint optimization delivers additional improvements.These results support the conjecture stated in the introduction; by optimizing the different parameters of the control algorithm together, we are able to enhance the control algorithm in ways that we are not able to when optimizing the same parameters in isolation.The horizon policy tends to a mean horizon of 28-31 when optimized by itself (Fig. 4c), which is consistent with the best performing fixed horizon MPC as seen in Fig. 2.However, as Fig. 3 shows the complete RL policy favored higher horizons when optimizing all meta-parameters together.
86As shown in Table II this improves performance significantly, where imposing a maximum horizon of 31 results in a 13.4% increase in cost.When solely tuning the LQR applied on an MPC computed on a fixed recomputation schedule, we were not able to achieve any consistent improvements.We hypothesize that this is due to the model mismatch (the MPC is overestimating the weight of the system by 36%) such that the computed LQR is not very well suited for the actual control problem, and therefore its gradients are flat and noisy.When combining LQR tuning with meta-parameter optimization we are able to tune the LQR to achieve meaningful improvements, with the tuned LQR improving by 1.95% over the initialization described in Section II-A3.This might be due the recomputation policy generating trajectories for the LQR that are similar, thus yielding more consistent gradients.The last entry in Table II shows a scenario where the same amount of computation is expended uniformly in time rather than dynamically allocated by the recomputation policy, resulting in a 35.45% increase in cost.+13.41%Recompute at the average frequency (every t = 4) +35.45%
V. CONCLUSION
87This paper has introduced a novel control algorithm that is tuned with RL to jointly improve the computational power usage and the control performance.We focus on optimizing the meta-parameters of the MPC scheme, and demonstrate its efficacy on the classic control task of balancing an inverted pendulum.We show that by selecting the conditions under which the MPC is computed, control performance can be (c) Optimizing the prediction horizon meta-parameter in isolation.
88Fig. 4. Training process for the proposed learned control algorithm, and for each meta-parameter in isolation.In the isolated cases, we show that the tuning process is capable of recovering from sub-optimal initializations.
89improved over the paradigm of computing at every step, and that the control algorithm can be further improved by considering all the optimized parameters together.Seeing as MPC is increasingly being considered for applications with fast dynamics or limited computational power and energy resources, our framework could be an important tool in enabling such applications to harness the good control performance and constraint satisfaction abilities of the MPC.We found that with model mismatch, tuning the dual mode MPC and LQR control law was difficult.Future work could evaluate if state-dependent Q and R matrices alleviates this issue, which would also provide a gain-scheduling property to the control algorithm.Whether any stability guarantees and control satisfaction properties can be given under the learned metaparameter-deciding policies should be investigated.
Fig. 1 .
90Fig.1.An overview of the control algorithm.Not shown here is the connection of each policy's output to the RL algorithm that updates the policy's parameters.
Fig. 2 .
91Fig. 2. Total cost over the evaluation set for the MPC as a function of fixed horizons and fixed recomputation schedules.The minimum is found at horizon N = 31 and recompute every step with a cost of 781.
Fig. 3 .
92Fig.3.Distribution of prediction horizons and steps between MPC computations selected by the best performing policy on the evaluation test-set.
93Optimizing both meta-parameters jointly.The MPC baseline represents the MPC scheme tuned as a function of fixed recomputation schedule and horizon.
1 (
94b) Optimizing the recomputation meta-parameter in isolation.
95Calculate LQR system matrices: A 1:Nmax , B 1:Nmax for t = 1, 2, . . ., T do Measure system state: xt if π c θ
96c (c t | s t ) draws ct = 1 then Compute MPC solution: ũMN t:t+Nt−1 , xt+1:t+Nt = π MN θ MN (ũ MN |s t ) Execute control input: ũMN t Calculate LQR system matrices: A t:t+Nt , B t:t+Nt Update last computation states: i ← t else Compute input: ũCS t = π CS θ M,L,N (u CS t |s t ) Execute input: ũCS t Collect data: D ← (s t , ãt , R(s t , ãt ), s t+1 ) if size(D) = Z then for e = 1, . . ., NumEpochs do for B ∈ D do
TABLE I PARAMETERS
97OF THE INVERTED PENDULUM SYSTEM.
TABLE II ABLATION
98ANALYSIS: WE TAKE THE BEST PERFORMING POLICY AND ALTER ONE ASPECT AT A TIME, OBSERVING ITS EFFECT ON THE COST.
참고문헌 52건
- The Elements of Statistical Learning Springer series in statistics · Springer Science+Business Media · 2001 10.1007/978-0-387-21606-5
- Nonlinear Predictive Control and Moving Horizon Estimation — An Introductory Overview Springer eBooks · Springer Nature · 1999 10.1007/978-1-4471-0853-5_19
- Application of Interior-Point Methods to Model Predictive Control Journal of Optimization Theory and Applications · Springer Science+Business Media · 1998 10.1023/a:1021711402723
- Robust model predictive control: A survey Springer eBooks · Springer Nature · 2007 10.1007/bfb0109870
- Nonlinear Model Predictive Control Communications and control engineering/Communications and control engineering series · 2011 10.1007/978-0-85729-501-9
- Value function approximation and model predictive control 2013 10.1109/adprl.2013.6614995
- Aircraft control based on fast non-linear MPC &amp; multiple-shooting 2012 10.1109/cdc.2012.6426439
- Constrained model predictive control: Stability and optimality Automatica · Elsevier BV · 2000 10.1016/s0005-1098(99)00214-9
- Robust model predictive control of constrained linear systems with bounded disturbances Automatica · Elsevier BV · 2004 10.1016/j.automatica.2004.08.019
- The explicit linear quadratic regulator for constrained systems Automatica · Elsevier BV · 2002 10.1016/s0005-1098(01)00174-1
- Approximate Explicit Nonlinear Receding Horizon Control for Decompression of Divers IEEE Transactions on Control Systems Technology · Institute of Electrical and Electronics Engineers · 2011 10.1109/tcst.2011.2162516
- Provably safe and robust learning-based model predictive control Automatica · Elsevier BV · 2013 10.1016/j.automatica.2013.02.003
- Modeling household fertility decisions with generalized Poisson regression Journal of Population Economics · Springer Science+Business Media · 1997 10.1007/s001480050043
- Event-triggered robust model predictive control of continuous-time nonlinear systems Automatica · Elsevier BV · 2014 10.1016/j.automatica.2014.03.015
- Self-triggered MPC for constrained linear systems and quadratic costs IFAC Proceedings Volumes · Elsevier BV · 2012 10.3182/20120823-5-nl-3013.00058
- 28th IEEE Conference on Decision and Control Computing & Control Engineering Journal · Institution of Engineering and Technology · 1990 10.1049/cce:19900035
- Dynamic Programming and Optimal Control 1995
- Suboptimal model predictive control (feasibility implies stability) IEEE Transactions on Automatic Control · Institute of Electrical and Electronics Engineers · 1999 10.1109/9.751369
- Robust receding horizon control of constrained nonlinear systems IEEE Transactions on Automatic Control · Institute of Electrical and Electronics Engineers · 1993 10.1109/9.262032
- Reinforcement Learning: An Introduction IEEE Transactions on Neural Networks · Institute of Electrical and Electronics Engineers · 2005 10.1109/tnn.2004.842673
- Human-level control through deep reinforcement learning Nature · Nature Portfolio · 2015 10.1038/nature14236
- A Schur method for solving algebraic Riccati equations IEEE Transactions on Automatic Control · Institute of Electrical and Electronics Engineers · 1979 10.1109/tac.1979.1102178
- Min-max feedback model predictive control for constrained linear systems IEEE Transactions on Automatic Control · Institute of Electrical and Electronics Engineers · 1998 10.1109/9.704989
- A Simple Semi-explicit MPC Algorithm IFAC-PapersOnLine · Elsevier BV · 2015 10.1016/j.ifacol.2015.11.326
- Tackling problem nonlinearities & delays via asymmetric, state-dependent objective costs in MPC of an artificial pancreas IFAC-PapersOnLine · Elsevier BV · 2015 10.1016/j.ifacol.2015.11.276
- Nonlinear MPC for a two-stage turbocharged gasoline engine airpath 2021 60th IEEE Conference on Decision and Control (CDC) · 2015 10.1109/cdc.2015.7402335
- Toward Dependable Embedded Model Predictive Control IEEE Systems Journal · Institute of Electrical and Electronics Engineers · 2014 10.1109/jsyst.2014.2368129
- On accurate and precise generation of generalized Poisson variates Communications in Statistics - Simulation and Computation · Taylor & Francis · 2014 10.1080/03610918.2014.968725
- Nonlinear Model Predictive Control Lecture notes in control and information sciences · Springer Science+Business Media · 2012 10.1007/978-3-642-28780-0_2
- Diagnosing Non-Intermittent Anomalies in Reinforcement Learning Policy Executions (Short Paper) arXiv (Cornell University) · Cornell University · 2017 10.4230/oasics.dx.2024.16
- Machine Learning Based Adaptive Prediction Horizon in Finite Control Set Model Predictive Control IEEE Access · Institute of Electrical and Electronics Engineers · 2018 10.1109/access.2018.2839519
- Differentiable MPC for End-to-end Planning and Control arXiv (Cornell University) · Cornell University · 2018 10.48550/arxiv.1810.13400
- Plan Online, Learn Offline: Efficient Learning and Exploration via Model-Based Control arXiv (Cornell University) · Cornell University · 2018
- Data-Driven Economic NMPC Using Reinforcement Learning IEEE Transactions on Automatic Control · Institute of Electrical and Electronics Engineers · 2019 10.1109/tac.2019.2913768
- Event-Triggered Model Predictive Control With a Statistical Learning IEEE Transactions on Systems Man and Cybernetics Systems · Institute of Electrical and Electronics Engineers · 2019 10.1109/tsmc.2019.2916626
- Adaptive Horizon Model Predictive Control IFAC-PapersOnLine · Elsevier BV · 2018 10.1016/j.ifacol.2018.07.250
- Plan Online, Learn Offline: Efficient Learning and Exploration via Model-Based Control arXiv (Cornell University) · Cornell University · 2018 10.48550/arxiv.1811.01848
- A General Safety Framework for Learning-Based Control in Uncertain Robotic Systems IEEE Transactions on Automatic Control · Institute of Electrical and Electronics Engineers · 2018 10.1109/tac.2018.2876389
- Performance-Oriented Model Learning for Data-Driven MPC Design IEEE Control Systems Letters · Institute of Electrical and Electronics Engineers · 2019 10.1109/lcsys.2019.2913347
- An Analysis of Frame-skipping in Reinforcement Learning. arXiv (Cornell University) · Cornell University · 2021
- Reinforcement Learning based on MPC/MHE for Unmodeled and Partially Observable Dynamics arXiv (Cornell University) · Cornell University · 2021
- Safe Reinforcement Learning via Projection on a Safe Set: How to Achieve Optimality? IFAC-PapersOnLine · Elsevier BV · 2020 10.1016/j.ifacol.2020.12.2276
- Reinforcement Learning based on MPC/MHE for Unmodeled and Partially Observable Dynamics 2022 American Control Conference (ACC) · 2021 10.23919/acc50511.2021.9483399
- Reinforcement Learning based on MPC and the Stochastic Policy Gradient Method 2022 American Control Conference (ACC) · 2021 10.23919/acc50511.2021.9482765
- Reinforcement Learning of the Prediction Horizon in Model Predictive Control IFAC-PapersOnLine · Elsevier BV · 2021 10.1016/j.ifacol.2021.08.563
- Automatic Tuning for Data-driven Model Predictive Control 2021 10.1109/icra48506.2021.9562025
- Optimization of the Model Predictive Control Update Interval Using Reinforcement Learning IFAC-PapersOnLine · Elsevier BV · 2021 10.1016/j.ifacol.2021.10.362
- 2005 American Control Conference IEEE Control Systems · Institute of Electrical and Electronics Engineers · 2005 10.1109/mcs.2005.1550213
- Reinforcement Learning: An Introduction IEEE Transactions on Neural Networks · Institute of Electrical and Electronics Engineers · 1998 10.1109/tnn.1998.712192
- Performance-oriented model learning for control via multi-objective Bayesian optimization Computers & Chemical Engineering · Elsevier BV · 2022 10.1016/j.compchemeng.2022.107770
- 2009 IEEE Symposium on Adaptive Dynamic Programming and Reinforcement Learning IEEE Symposium on Adaptive Dynamic Programming and Reinforcement Learning · 2009 10.1109/adprl14682.2009
- Robustness in identification and control Lecture notes in control and information sciences · Springer Science+Business Media · 1999 10.1007/bfb0109854