当前位置:网站首页>[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);
边栏推荐
- What should I learn in the zero foundation entry test? It's the most comprehensive. Just learn from it
- uniapp微信小程序组件按需引入
- Kotlin 协程调度切换线程是时候解开真相了
- 怎么理解JS Promise
- 内存泄漏定位工具之 valgrind 使用
- The "China Mobile Chain" state secret engine was officially launched on BSN
- Design and practice of new generation cloud native database
- A new round of popularity of digital collections opens
- 华为HMS Core携手超图为三维GIS注入新动能
- 【黑马早报】俞敏洪称从来不看新东方股价;恒驰5将于7月开启预售;奈雪虚拟股票或涉嫌非法集资;7月1日起冰墩墩停产...
猜你喜欢

106. construct binary tree from middle order and post order traversal sequence

The stock position building rate of global funds and asset management reached a new low in 15 years

投稿开奖丨轻量应用服务器征文活动(5月)奖励公布

TC8:UDP_USER_INTERFACE_01-08

好高的佣金,《新程序员》合伙人计划来袭,人人皆可参与!

谁还在买“三只松鼠”们

Design and practice of new generation cloud native database

I like two men...

Floyd repeat

Prefabricated dishes usher in the "golden age", who can lead the next trillion market
随机推荐
京东与腾讯续签三年战略合作协议;起薪涨至26万元!韩国三星SK争相加薪留住半导体人才;Firefox 102 发布|极客头条...
12. Gateway new generation gateway
大佬们 有没有搞过sink分流写入clickhouse 或者其他数据库的操作。
【黑马早报】俞敏洪称从来不看新东方股价;恒驰5将于7月开启预售;奈雪虚拟股票或涉嫌非法集资;7月1日起冰墩墩停产...
投稿开奖丨轻量应用服务器征文活动(5月)奖励公布
Programmers want to go to state-owned enterprises? The technology is backward and the salary is low. I can't find a job after lying flat for several years
怎么理解JS Promise
It is interesting to understand MMAP in this way!
零基础入行软件测试必看,10年测试老鸟的良心建议(共15条)
I like two men...
持续进阶,软通动力稳步推动云智能战略
亿学学堂帮个人开的证券账户安全吗?是不是有套路
Does anyone know the logic of limit statement execution in Clickhouse? In the picture, the SQL above can be executed successfully
[dark horse morning post] Yu Minhong said he never looked at the stock price of New Oriental; Hengchi 5 will start pre-sale in July; Naixue virtual stock or suspected of illegal fund-raising; From Jul
uniapp微信小程序组件按需引入
STM32逆变器电源设计方案,基于STM32F103控制器[通俗易懂]
Raspberry pie 4B system construction (ultra detailed version)
Initial experience of Flink, a mainstream real-time stream processing computing framework
中国探月工程独家藏品限量发售!
《天天数学》连载55:二月二十四日