5.5(学号:3025)

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:47  唐锦珅  阅读(0)  评论(0编辑  收藏  举报