How to write a Quadratic Programming on the Vector Reference Governor?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
sorry for interruption, I need some help on the quadratic programming code on this equation. I have meet some This equation is based on the Vector Reference Governor(VRG). Hope anyone is good in this can provide a help for me
minimize || v(t)- r(t)||
k∈[0,1]
s.t. v(t) = v(t − 1) +K(r(t) − v(t − 1))
(x(t), v(t)) ∈ O∞
0 comentarios
Respuestas (1)
Jaynik
el 26 de Feb. de 2024
Hi,
We can solve the equation using the "quadprog" function by converting ||v(t) - r(t)|| to a quadratic programming problem. The Euclidean norm ||v(t) - r(t)|| is not quadratic because it involves the square root of a sum of squares. However, minimizing the Euclidean norm is equivalent to minimizing the square of the Euclidean norm ||v(t) - r(t)||^2 because the square root function is monotonically increasing. This means that the value of "k" that minimizes ||v(t) - r(t)||^2 will also minimize ||v(t) - r(t)||.
Assuming that you have all the information needed to solve the equations, you can refer to the following sample code to solve the equations:
r_t = ...; % Your reference vector r(t)
v_t_minus_1 = ...; % Your vector from the previous time step v(t-1)
K = ...; % Your scaling matrix K
H = 2 * (K'*K); % The H matrix is 2*K'*K because we are minimizing ||k*K*(r(t) - v(t-1))||^2
f = -2 * K' * (r_t - v_t_minus_1);
% The f vector is -2*K'*(r(t) - v(t-1)).
% It comes from the derivative of the squared term, which is necessary for the formulation of the quadratic programming problem.
% Define the bounds on k
lb = 0;
ub = 1;
% Define the inequality constraints (A * k <= b) that ensure (x(t), v(t)) ∈ O∞
% You need to formulate the constraints of O∞ in terms of k
A = ...; % Coefficient matrix for the inequality constraints
b = ...; % Right-hand side vector for the inequality constraints
% Solve the quadratic programming problem
options = optimoptions('quadprog', 'Display', 'off');
k_opt = quadprog(H, f, A, b, [], [], lb, ub, [], options);
% Compute the optimal v(t) using the optimal k
v_t_opt = v_t_minus_1 + k_opt * K * (r_t - v_t_minus_1);
You can read more about the following functions here:
0 comentarios
Ver también
Categorías
Más información sobre Quadratic Programming and Cone Programming en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!