来送到碗里.
% 原始问题: max z = 45x1+70x2+50x3 ---> min -z = -45x1-70x2-50x3
% 约束条件:
% 40x1+80x2+90x3 =0 ---> -x1 - 0x2 - 0x3 =0 ---> -0x1 - 1x2 - 0x3 =0 ---> -0x1 - 0x2 - 1x3 <=0
clear;
f = [-45,-70,-50];
A = [40,80,90;100,160,140;190,240,160;200,310,220;-1,0,0;0,-1,0;0,0,-1];
b = [25;45;65;80;0;0;0];
[x,fval] = linprog(f,A,b);
x
-fval