第1个回答 2010-06-28
(1)设47寸x1台,42寸x2台
成本 4500x1 + 3800x2 + 3200000
售价 (7900 - 0.08x1 - 0.032x2)x1 + (6500 - 0.08x2 - 0.024x1)x2
化解问题转化为
max -0.08x1^2 - 0.08x2^2 -0.056x1x2 + 3400x1 + 2700x2 - 3200000
求偏导
dy/ dx1 = -0.16x1 -0.056x2 + 3400
dy/ dx2 = -0.16x2 -0.056x1 + 2700
解方程
0.16x1 + 0.056x2 = 3400
0.16x2 + 0.056x1 = 2700
用MATLAB得出
[0.16 0.056;0.056 0.16] \ [3400;2700]
ans =
1.0e+004 *
1.7486
1.0755
可得x1 = 17486 x2 = 10755时取到最大值41045014元
(3)加限制条件
max -0.08x1^2 - 0.08x2^2 -0.056x1x2 + 3400x1 + 2700x2 - 3200000
x1 + x2 <= 10000
0 <= x1 <= 8000
0 <= x2 <= 5000
用MATLAB遗传算法工具箱求解
>> fit = @(x) 0.08*x(1).^2 + 0.08*x(2).^2 + 0.056*x(1).*x(2) - 3400*x(1) - 2700*x(2) + 3200000;
>> [x,fval] = patternsearch(fit,[6000 4000],[1 1],10000,[],[],[0;0],[8000;5000])
Optimization terminated: mesh size less than options.TolMesh.
x =
1.0e+003 *
8.0000 2.0000
fval =
-2.3064e+007
得出x1= 8000 x2 = 2000时 取到最大值23064000
(4)
max -0.08x1^2 - 0.08x2^2 -0.056x1x2 + 3400x1 + 2700x2 - 3200000
x1 + x2 <= 10000
0 <= x1 <= 8000
0 <= x2 <= 3000
>> fit = @(x) 0.08*x(1).^2 + 0.08*x(2).^2 + 0.056*x(1).*x(2) - 3400*x(1) - 2700*x(2) + 3200000;
>> [x,fval] = patternsearch(fit,[6000 4000],[1 1],10000,[],[],[0;0],[8000;3000])
Optimization terminated: mesh size less than options.TolMesh.
x =
1.0e+003 *
8.0000 2.0000
fval =
-2.3064e+007
得出x1= 8000 x2 = 2000时 取到最大值23064000