Problem 4.16 The problem is to maximize the function M(s1 , s2 ) = R(s1 , s2 ) , C(s1 , s2 ) where R is the revenue from the sales and C the manufacturing costs, R(s1 , s2 ) = 339s1 + 399s2 − 0.01s21 − 0.007s1s2 − 0.01s22 C(s1 , s2 ) = 400, 000 + 195s1 + 225s2 . Since maximizing M is equivalent to minimizing −M, we code −M as objective function in Matlab function [f,gradf]=objfun(x) f1=339*x(1)+399*x(2)-0.01*x(1)^2-0.007*x(1)*x(2)-0.01*x(2)^2; f2=400000+195*x(1)+225*x(2); f=-f1/f2; grad1f=((339-0.02*x(1)-0.007*x(2))*f2-195*f1); grad2f=((399-0.02*x(2)-0.007*x(1))*f2-225*f1); gradf=[grad1f;grad2f]/f2^2; The objective function is very flat. By experimenting a while, the region in which the maximum is located is narrowed down to 3200 ≤ s1 ≤ 3400, 5000 ≤ s2 ≤ 5200. Executing the commands x0=[3400;5200]; options = optimset(’GradObj’,’on’); [xopt,fopt] = fmincon(’objfun’,x0,[],[],[],[],[3200;5000],[3400;5200],[],options) leads to the following answer xopt = 1.0e+003 * 3.30366979593808 5.09632706307705 fopt = -1.21715632659868 1 Let’s check this answer analytically. The necessary conditions for a maximum are ∂M ∂s1 ∂M C2 ∂s2 C2 = (339 − 0.02s1 − 0.007s2)C − 195R = 0 = (399 − 0.007s1 − 0.02s2 )C − 225R = 0, from which it follows that 225(339 − 0.02s1 − 0.007s2 ) = 195(399 − 0.007s1 − 0.02s2). We can solve this linear equation for s2 , s2 = 1.34838709677419s1 + 658.0645161290322, and then substitute s2 into the first of the two gradient equations to obtain 0.203360625s21 + 4.4726175s1 − 3684501 = 0. This quadratic equation has one positive and one negative solution. Only the positive solution is of interest, and after substituting this into the expression for s2 we find the corresponding value of s2 . The final answer is s∗1 = 3296.61217535090 ≈ 3297, s∗2 = 5103.17383644089 ≈ 5104, with M(s∗1 , s∗2 ) = 1.21715661352767. The level contours M = 1.217, 1.2171, 1.21715, 1.217156 shown in the figure below clearly demonstrate that (s∗1 , s∗2 ) is a maximum point. The prices for this solution point are p∗1 = 290.72, p∗2 = 334.78. Note that the solution is in the feasible region defined by the inequality constraints of the constrained optimization problem of Example 4.10. Thus there is no need to solve the constrained problem separately. 5300 5250 s2 5200 1.217156 5150 5100 5050 1.21715 5000 4950 4900 1.2171 1.217 3100 3150 3200 3250 3300 3350 3400 3450 3500 s 2 1