90 likes | 215 Views
Engineering 25. Chp4 Tutorial: Prob 4.25 Solution. Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. Optimize Distribution Center Location for Customers:. The Situation. . . . . . . The Final Hand Notes. Set x-value (m-index)
E N D
Engineering 25 Chp4Tutorial: Prob 4.25Solution Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu
Optimize Distribution Center Location for Customers: The Situation
Set x-value (m-index) Test 31 y-values (n-index) Increment x-value (m = m+1) Test 31 new y-values Repeat GamePlan Illustrated
The Function File % Bruce Mayer, PE * 21Feb06 % ENGR25 * Problem 4-25 % file = Prob4_25_Dense_Road.m % Find Optimum Location for Shipping Distribution Center % % INPUT SECTION - Data For Six Shipping Destinations xloc = [1,7,8,17,22,27]; % X-CoOrd in Miles yloc = [28,18,16,2,10,8]; % Y-CoOrd in Miles V = [3,7,4,5,2,6]; % Shipping Volume in Tons/Week % % Initialize Low-Cost Location & CoOrds Collection Vectors %% Units for Collection Vectors: [$-Cost, X-miles, Y-Miles] C_Lo = [1e6, 31, 31]; C_L1 = [1e6, 31, 31]; C_L2 = [1e6, 31, 31]; % % CALCULATION SECTION % vary X&Y for Dist Cntr; calc cost at each location for m = 1:30 % vary X-CoOrd for n = 1:30 % vary Y-CoOrd for k = 1:6 % Calc Dist & Cost for 6 Destinations d(k) = sqrt((m-xloc(k)).^2 + (n-yloc(k)).^2); cost(k) = 0.5*d(k)*V(k); end % Sum the 6 costs for location (m,n) Cmn = sum(cost); % Compare to Previous value for Low-Cost if Cmn < C_Lo(1) % replace previous if true C_L2 = C_L1; C_L1 = C_Lo; C_Lo = [Cmn, m, n]; end end end % % REPORT RESULTS display('The LOWEST-Cost Option in [$-cost, X-miles, y-miles]') disp(C_Lo) display('The 2nd Lowest-Cost Option in [$-cost, X-miles, y-miles]') disp(C_L1) display('The 3rd Lowest-Cost Option in [$-cost, X-miles, y-miles]') disp(C_L2) • Prob4_25_Dense_Road.m
The Command Session >> run Prob4_25_Dense_Road The LOWEST-Cost Option in [$-cost, X-miles, y-miles] 147.2551 9.0000 16.0000 The 2nd Lowest-Cost Option in [$-cost, X-miles, y-miles] 147.3513 8.0000 16.0000 The 3rd Lowest-Cost Option in [$-cost, X-miles, y-miles] 150.3551 8.0000 15.0000