求大神编个matlab程序MIN=2*(1.8*A1+2.2*A2+2.4*A3+2.1*A4+1.9*A5+1.7*B1+1.6*B2+2.0*B3+1.9*B4+1.7*B5+2.6*C1+2.9*C2+2.0*C3+1.9*C4+2.4*C5+2.4*D1+2.3*D2+2.5*D3+2.6*D4+2.3*D5)限制函数A1+B1+C1+D1=120A2+B2+C2+D2=100A3+B3+C3+D3=90A4+B4+C4+D4=85A5+B5+
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/15 06:51:45
求大神编个matlab程序MIN=2*(1.8*A1+2.2*A2+2.4*A3+2.1*A4+1.9*A5+1.7*B1+1.6*B2+2.0*B3+1.9*B4+1.7*B5+2.6*C1+2.9*C2+2.0*C3+1.9*C4+2.4*C5+2.4*D1+2.3*D2+2.5*D3+2.6*D4+2.3*D5)限制函数A1+B1+C1+D1=120A2+B2+C2+D2=100A3+B3+C3+D3=90A4+B4+C4+D4=85A5+B5+
求大神编个matlab程序
MIN=2*(1.8*A1+2.2*A2+2.4*A3+2.1*A4+1.9*A5+1.7*B1+1.6*B2+2.0*B3+1.9*B4+1.7*B5+2.6*C1+2.9*C2+2.0*C3+1.9*C4+2.4*C5+2.4*D1+2.3*D2+2.5*D3+2.6*D4+2.3*D5)
限制函数
A1+B1+C1+D1=120
A2+B2+C2+D2=100
A3+B3+C3+D3=90
A4+B4+C4+D4=85
A5+B5+C5+D5=85
A1+A2+A3+A4+A5
求大神编个matlab程序MIN=2*(1.8*A1+2.2*A2+2.4*A3+2.1*A4+1.9*A5+1.7*B1+1.6*B2+2.0*B3+1.9*B4+1.7*B5+2.6*C1+2.9*C2+2.0*C3+1.9*C4+2.4*C5+2.4*D1+2.3*D2+2.5*D3+2.6*D4+2.3*D5)限制函数A1+B1+C1+D1=120A2+B2+C2+D2=100A3+B3+C3+D3=90A4+B4+C4+D4=85A5+B5+
f=2*[1.8,2.2,2.4,2.1,1.9,1.7,1.6,2.0,1.9,1.7,2.6,2.9,2.0,1.9,2.4,2.4,2.3,2.5,2.6,2.3]';
A=zeros(4,20);
A(1,1:5)=1;
A(2,6:10)=1;
A(3,11:15)=1;
A(4,16:20)=1;
b=[120 150 160 160]';
Aeq=zeros(5,20);
Aeq(1,1:5:end)=1;
Aeq(2,2:5:end)=1;
Aeq(3,3:5:end)=1;
Aeq(4,4:5:end)=1;
Aeq(5,5:5:end)=1;
beq=[120 100 90 85 85]';
[x,fval,exitflag]= linprog(f,A,b,Aeq,beq,zeros(20,1))
运行结果:
Optimization terminated.
x =
120.0000
0.0000
0.0000
0.0000
0.0000
0.0000
100.0000
0.0000
0.0000
50.0000
0.0000
0.0000
75.0000
85.0000
0.0000
0.0000
0.0000
15.0000
0.0000
35.0000
fval =
1.7810e+03
exitflag =
1