Page 379 - Applied Numerical Methods Using MATLAB
P. 379
368 OPTIMIZATION
7.9 A Constrained Optimization on Location
A company has three factories that are located at the points (−16,4), (6,5),
and (3,−9), respectively, in the x 1 x 2 -plane, and the numbers of deliveries
to those factories are 5, 6, and 10 per month, respectively (Fig. P7.9). The
company has a plan to build a new warehouse in its site bounded by
|x 1 − 1|+ |x 2 − 1|≤ 2 (P7.9.1)
and is trying to minimize the monthly mileage of delivery trucks in deter-
mining the location of a new warehouse on the assumption that the distance
between two points represents the driving distance.
(a) What is the objective function that must be defined in the program
“nm7p09.m”?
(b) What is the statement defining the inequality constraint (P7.9.1)?
(c) Complete and run the program “nm7p09.m” to get the optimum location
of the new warehouse.
function [C,Ceq] = fp_warehouse_c(x)
C = sum(abs(x - [1 1])) - 2;
Ceq = []; % No equality constraint
%nm7p09.m to solve the warehouse location problem
f = ’sqrt([sum((x - [-16 4]).^2) sum((x - [6 5]).^2) sum((????????).^2)])’;
fp_warehouse = inline([f ’*[?;?;?]’],’x’);
x0 = [1 1]; A = []; b = []; Aeq = []; beq = []; l = []; u = [];
xo = fmincon(fp_warehouse,x0,A,b,Aeq,beq,l,u,’fp_warehouse_c’)
5
site factory B
factory A
0
+
−5
factory C
−10
−20 −10 0 10
Figure P7.9 The site of a new warehouse and the locations of the factories.
7.10 A Constrained Optimization on Ray Refraction
A light ray follows the path that takes the shortest time when it travels in
the space. We want to find the three angles θ 1 ,θ 2 ,and θ 3 (measured between
the array and the normal to the material surface) of a ray traveling from
P = (0, 0) to Q = (L, −(d 1 + d 2 + d 3 )) through a transparent material of
thickness d 2 and index of refraction n as depicted in Fig. P7.10. Note the
following things.

