5.5

把max放进约束条件,不妨假定小于等于10000

linprog

from scipy.optimize import linprog
c=[0,0,3,2]
A=[[-1,-1,0,0],[0,0,-1,-1],[3,0,2,0],[0,3,0,2],[100,90,80,70]]
b=[[-30],[-30],[120],[48],[10000]]
LB=[0]len(c)
UB=[None]
len(c)
bound=tuple(zip(LB,UB))
res=linprog(c,A,b,None,None,bound)
print("目标函数的最小解:",res.fun)
print("最优解为:",res.x)

posted @ 2024-10-15 11:34  qi11  阅读(4)  评论(0编辑  收藏  举报