2
【cvxopt】最优化库(持续更新中)
source link: https://www.guofei.site/2019/09/21/cvxopt.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
【cvxopt】最优化库(持续更新中)
2019年09月21日Author: Guofei
文章归类: 5-6-最优化 ,文章编号: 7310
版权声明:本文作者是郭飞。转载随意,但需要标明原文链接,并通知本人
原文链接:https://www.guofei.site/2019/09/21/cvxopt.html
matrix
from cvxopt import matrix, solvers
cvxopt.matrix([[1.0,2.0]]) # 用list的话,生成的是2*1的矩阵,与一般的理解相反
cvxopt.matrix(np.array([[2,1]])) # 用array就正常
lp:线性规划
mins.t.cTxGx≤hAx=bmincTxs.t.Gx≤hAx=b
solvers.lp(c, G, h, A, b)
qp:二次规划
sv=cvxopt.solvers.qp(P,q,G,h,A,b)
sv['x'] # 就是最优解
标准形式:
mins.t.(1/2)xTPx+qTxGx≤hAx=bmin(1/2)xTPx+qTxs.t.Gx≤hAx=b
未完待续
cvxopt这个包做优化似乎很强大,可以与scipy形成互补。
所以有空把官方文档过一遍,做成笔记。
您的支持将鼓励我继续创作!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK