clc;clear
f=[0 44 50 64 90];
Aeq=[0 2.5 3.7 4.5 5.8;1 1 1 1 1];%酒精含量%以及∑x=1
beq=[3.1;1];
A1=[...
1 1.030 1.043 1.050 1.064;...%比重
0 11 9 8 7;...%EBC
0 30 20 28 30];%蛇麻子脂
b1=[1.040;10;25];
A2=-A1;
b2=[-1.034;-8;-20];
A=[A1;A2]
b=[b1;b2]
LB=zeros(length(A),1);
UB=ones(length(A),1);
[X,FVAL,EXITFLAG]=LINPROG(f,A,b,Aeq,beq,LB,UB)
alcoh=Aeq(1,:)*X
other=A1*X
结果:
A =
1.0000 1.0300 1.0430 1.0500 1.0640
0 11.0000 9.0000 8.0000 7.0000
0 30.0000 20.0000 28.0000 30.0000
-1.0000 -1.0300 -1.0430 -1.0500 -1.0640
0 -11.0000 -9.0000 -8.0000 -7.0000
0 -30.0000 -20.0000 -28.0000 -30.0000
b =
1.0400
10.0000
25.0000
-1.0340
-8.0000
-20.0000
Optimization terminated.
X =
0.0984
0.1967
0.7049
0.0000
0.0000
FVAL =
43.9016
EXITFLAG =
1
alcoh =
3.1000
other =
1.0362
8.5082
20.0000