会Matlab请进 帮解决下运筹学的问题minz=1600x1+1600x2+1600x3+1600x4+300x1*x1+300x2*x2+300x3*x3+300x4 *x4-300x1*x2-300x2*x3-300x3*x4-300x4*x1-1433600 st x1>=220 x2>=256 x3>=240 x4>=180 x1.x2.x3.x4都为整数用MATLAB求最优解
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 02:46:37
会Matlab请进 帮解决下运筹学的问题minz=1600x1+1600x2+1600x3+1600x4+300x1*x1+300x2*x2+300x3*x3+300x4 *x4-300x1*x2-300x2*x3-300x3*x4-300x4*x1-1433600 st x1>=220 x2>=256 x3>=240 x4>=180 x1.x2.x3.x4都为整数用MATLAB求最优解
会Matlab请进 帮解决下运筹学的问题
minz=1600x1+1600x2+1600x3+1600x4+300x1*x1+300x2*x2+300x3*x3+300x4 *x4-300x1*x2-300x2*x3-300x3*x4-300x4*x1-1433600
st x1>=220
x2>=256
x3>=240
x4>=180
x1.x2.x3.x4都为整数
用MATLAB求最优解
会Matlab请进 帮解决下运筹学的问题minz=1600x1+1600x2+1600x3+1600x4+300x1*x1+300x2*x2+300x3*x3+300x4 *x4-300x1*x2-300x2*x3-300x3*x4-300x4*x1-1433600 st x1>=220 x2>=256 x3>=240 x4>=180 x1.x2.x3.x4都为整数用MATLAB求最优解
clc;clear
fun=@(x) 1600*x(1)+1600*x(2)+1600*x(3)+1600*x(4)+300*x(1)*x(1)+300*x(2)*x(2)+300*x(3)*x(3)+300*x(4)*x(4)-300*x(1)*x(2)-300*x(2)*x(3)-300*x(3)*x(4)-300*x(4)*x(1)-1433600
[X,FVAL,EXITFLAG,OUTPUT]=fmincon(fun,[248.0000 256.0000 248.0000 245.3333],[],[],[],[],[220 256 240 180],[])
结果:
X =
248.0000 256.0000 248.0000 245.3333
FVAL =
1.8347e+005
EXITFLAG =
5
用excel计算,结果为:
minz 183500
x1 248
x2 256
x3 248
x4 245