建立数学模型:
minz=10x1+5x2+6x3+4x4+8x5+15x6
s.t.:x1+x2+x3>=60
x4+x5+x6>=100
x1+x4=45
x2+x5=75
x3+x6=40
输入命令
c=[10;5;6;4;8;15];
A=[-1 -1 -1 0 0 0;0 0 0 -1 -1 -1];
b=[-60;-100];
Aeq=[1 0 0 1 0 0;0 1 0 0 1 0;0 0 1 0 0 1];
beq=[45;75;40];
lb=zeros(6,1);
[x,fv]=linprog(c,A,b,Aeq,beq,lb)
Optimization terminated.
x =
0.0000
20.0000
40.0000
45.0000
55.0000
0.0000
fv =
960.0000