matlab 代码
T1:
clc,clear;
c=[3 -1 -1]';
a=[1 -2 1;4 -1 -2];
b=[11,-3]';
aeq=[-2 0 1];
beq=1;
[x,y]=linprog(-c,a,b,aeq,beq,zeros(3,1));
y=-y;
T2
clc,clear;
c=[1 2 3 4];
c=[c,c]';
aeq=[1 -1 -1 1;1 -1 1 -3;1 -1 -2 3];
beq=[0 1 -1/2];
aeq=[aeq,-aeq];
[uv,val]=linprog(c,[],[],aeq,beq,zeros(8,1));
x=uv(1:4)-uv(5:end);