使用python线性规划学习总结x.docx
《使用python线性规划学习总结x.docx》由会员分享,可在线阅读,更多相关《使用python线性规划学习总结x.docx(7页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、使用python线性规划学习总结x运用 python 线性规划学习总结1.pulp 例子: 2.python-pymprog 3. scipy.optimize.linprog 1.pulp 试试这个模块 from pulp import *# 设置对象f= LpProblem(lptest, LpMinimize)# 设置三个变量,并设置变量最小取值x = LpVariable(x, lowBound = 0)y = LpVariable(y, lowBound = 0)z = LpVariable(z, lowBound = 0) # 载入约束变量f += 3.05 * x + 4.05
2、* y + 6.1 * z >= 7.9 # 求解GLPK().solve(f) # 显示结果for i in f.variables():print(i.name + = + str(i.varValue)显示如下:GLPSOL: GLPK LP/MIP Solver, v4.55Parameter(s) specified in the command line: -cpxlp C:UserstonyAppDataLocalTemp12100-pulp.lp -o C:UserstonyAppDataLocalTemp12100-pulp.solReading problem dat
3、a from C:UserstonyAppDataLocalTemp12100-pulp.lp.1 row, 4 columns, 3 non-zeros8 lines were readGLPK Simplex Optimizer, v4.551 row, 4 columns, 3 non-zerosPreprocessing.1 row, 3 columns, 3 non-zerosScaling. A: min|aij| = 3.050e+000max|aij| = 6.100e+000ratio = 2.000e+000Problem data seem to be well scal
4、edConstructing initial basis.Size of triangular part is 10: obj =0.000000000e+000infeas = 7.900e+000 (0)* 1: obj =0.000000000e+000infeas = 0.000e+000 (0)OPTIMAL LP SOLUTION FOUNDTime used: 0.0 secsMemory used: 0.0 Mb (36952 bytes)Writing basic solution to C:UserstonyAppDataLocalTemp12100-pulp.sol.1
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 使用 python 线性规划 学习 总结
限制150内