当前位置:网站首页>[MPC] ① quadratic programming problem matlab solver quadprog
[MPC] ① quadratic programming problem matlab solver quadprog
2022-07-01 10:21:00 【Houchang Village Road caixukun】
List of articles
One 、 summary
Quadratic programming is a quadratic optimization problem with linear constraints . stay Matlab in ,quadprog It is a quadratic objective function solver with linear constraints .
( One ) Standard form of secondary Planning
min x 1 2 x T H x + f T x \mathop {\min }\limits_x \frac{1}{2}{ {\bf{x}}^{\bf{T}}}{\bf{Hx}} + { {\bf{f}}^{\bf{T}}}{\bf{x}} xmin21xTHx+fTx
Actually H yes Hessian front , yes n ride n Symmetric matrix of .
1、 Positive definiteness and function optimality of Hessian matrix
- If Hessian The matrix is positive semidefinite , Then we say that the formula is a convex quadratic programming , In this case, the difficulty of the problem is similar to that of linear programming . If at least one vector satisfies the constraint and The feasible region There is a lower bound , Then the convex quadratic programming problem has a global minimum .
- If it is positive definite , Then this kind of quadratic programming is strictly convex quadratic programming , Then the global minimum is unique .
- If it's a Indefinite matrix , Is a nonconvex quadratic programming , This kind of secondary planning is more challenging , Because they have multiple stationary points and local minimum points .
2、 Basic mathematical concepts
- Basic concepts :https://blog.csdn.net/jbb0523/article/details/50598523
- Convex Strictly convex , give an example :https://zhuanlan.zhihu.com/p/399549564
3、 On the positive definiteness of symmetric matrices
- Positive definite matrix : All eigenvalues of the matrix are greater than 0
- Positive semidefinite matrices : All eigenvalues of the matrix are non negative
- Negative definite matrix : All eigenvalues of the matrix are less than 0
https://blog.csdn.net/Infinity_07/article/details/109569450

4、matlab just 、 Half positive 、 Negative definite matrix generation , And quadprog verification
(1)matlab Judge positive qualitative :
% Judgment matrix m It's positive definite 、 Semi positive definite or negative definite
m = [2 -1; -1 2];
if issymmetric(m) % Check whether the matrix is symmetrical
% disp(' Matrix symmetry ');
d = eig(m); % Calculate the eigenvalue of the matrix
if all(d > 0)
disp(' The matrix is positive definite ');
elseif all(d >= 0)
disp(' Matrix positive semidefinite ');
else
disp(' Matrix negative definite ');
end
else
disp(' Matrix asymmetry ');
end
(2)matlab Operation of generating positive definite matrix
https://blog.csdn.net/zhao523520704/article/details/52918376/
H_posi=diag([1,2,3]);
H_semi=diag([0,2,3]);
H_nega=diag([-1,-2,-3]);
( Two ) Input parameters
| Symbol | Parameter meaning |
|---|---|
| H | Quadratic objective matrix |
| f | Linear objective vector |
| A | Linear inequality matrix |
| b | Linear inequality vector |
| Aeq | Linear equality constraint matrix |
| beq | Linear equality constraint vector |
| lb | Lower bound |
| ub | upper bound |
( 3、 ... and ) Output parameters
| Symbol | Parameter meaning |
|---|---|
| x | Explain , Returns... As a vector of real numbers |
| wsout | Hot start object of solution |
| fval | The value of the objective function at the re solution |
| exitflag | quadprog The reason for the stop |
| output | Information about the optimization process , Returns... As a structure |
| lambda | Lagrange multiplier at the solution |
Two 、MATLAB Basic grammar
x = quadprog(H,f)
x = quadprog(H,f,A,b)
x = quadprog(H,f,A,b,Aeq,beq)
x = quadprog(H,f,A,b,Aeq,beq,lb,ub)
x = quadprog(H,f,A,b,Aeq,beq,lb,ub,x0)
x = quadprog(H,f,A,b,Aeq,beq,lb,ub,x0,options)
x = quadprog(problem)
[x,fval] = quadprog(___)
[x,fval,exitflag,output] = quadprog(___)
[x,fval,exitflag,output,lambda] = quadprog(___)
[wsout,fval,exitflag,output,lambda] = quadprog(H,f,A,b,Aeq,beq,lb,ub,ws)
3、 ... and 、MATLAB Typical solution examples
( One ) Quadratic programming with linear inequality constraints

H = [1 -1; -1 2];
f = [-2; -6];
A = [1 1; -1 2; 2 1];
b = [2; 2; 3];
[x,fval,exitflag,output,lambda] = quadprog(H,f,A,b);
x =
0.6667
1.3333
fval = -8.2222
exitflag =
1
( Two ) Quadratic programming with linear equality constraints

H = [1 -1; -1 2];
f = [-2; -6];
Aeq = [1 1];
beq = 0;
[x,fval,exitflag,output,lambda] = ...
quadprog(H,f,[],[],Aeq,beq)
x = -0.8000
0.8000
fval = -1.6000
exitflag =
1
( 3、 ... and ) Quadratic programming with linear constraints and boundaries

H = [1,-1,1
-1,2,-2
1,-2,4];
f = [2;-3;1];
lb = zeros(3,1);
ub = ones(size(lb));
Aeq = ones(1,3);
beq = 1/2;
x = quadprog(H,f,[],[],Aeq,beq,lb,ub);
边栏推荐
- 关于#SQL#的问题,如何解决?
- SQL 化是 ETL 增量生产的第一步,这样的架构的核心能力是什么?
- 怎么理解JS Promise
- prism journal导航按钮的可用性探索记录
- Can MySQL CDC take out the op field
- Zero foundation software testing must see, 10 years of testing old bird's conscience suggestions (a total of 15)
- SQL SERVER2014删除数据库失败,报错偏移量0x0000...
- 678. Valid bracket string
- About database: how to avoid deadlock in gbase 8s
- Apple amplification! It's done so well
猜你喜欢

bash: ln: command not found

基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建

12.Gateway新一代网关

SQL server2014 failed to delete the database, with an error offset of 0x0000

JD and Tencent renewed the three-year strategic cooperation agreement; The starting salary rose to 260000 yuan! Samsung sk of South Korea competes for salary increase to retain semiconductor talents;

Initial experience of Flink, a mainstream real-time stream processing computing framework

Zero foundation software testing must see, 10 years of testing old bird's conscience suggestions (a total of 15)

Fried money, lost 10million.

Common penetration tools -goby

106. 从中序与后序遍历序列构造二叉树
随机推荐
数据库的增删改查问题
问下群里的各位,有使用flink oracle cdc的logminer方案,在生产上稳定运行的实际
哪个券商公司炒股开户佣金低又安全又可靠
SQL server2014 failed to delete the database, with an error offset of 0x0000
Daily mathematics serial 55: February 24
数字藏品新一轮热度开启
This is the best flash popular science article I have ever seen!
Zero foundation software testing must see, 10 years of testing old bird's conscience suggestions (a total of 15)
STM32 inverter power supply design scheme, based on STM32F103 controller [easy to understand]
【论文阅读】Trajectory-guided Control Prediction for End-to-end Autonomous Driving: A Simple yet Strong Ba
IDEA运行报错Command line is too long. Shorten command line for...
PO模式深入封装
Floyd repeat
C# [字节数组]与[16进制字符串]互相转换 - CodePlus系列
基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建
Lack of comparator, operational amplifier to save the field! (the op amp is recorded as a comparator circuit)
The stock position building rate of global funds and asset management reached a new low in 15 years
button按钮清除边框
华为HMS Core携手超图为三维GIS注入新动能
编写自己的who命令