Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Engineering 25
Chp4
Tutorial:
Prob 4.28
Solution
Bruce Mayer, PE
Licensed Electrical & Mechanical Engineer
BMayer@ChabotCollege.edu
Engineering/Math/Physics 25: Computational Methods
1
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
The Situation
Optimize Distribution Center
Location for Customers:
ENGR25 Problem 4.25 * 23Feb06
35
NOTES
• Size of Bubbles denotes relative shipping Volume
30
25
North Distance (Ymiles)
20
15
10
5
0
-5
0
5
10
15
20
25
file = P4-25_Dense-Road_Bubble-Chart_0602.xls
-5
East Distance (Xmiles)
Engineering/Math/Physics 25: Computational Methods
2
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
30
35
WhareHouse Location
Optimization
N
Engineering/Math/Physics 25: Computational Methods
3
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
E
Engineering/Math/Physics 25: Computational Methods
4
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
Engineering/Math/Physics 25: Computational Methods
5
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
Engineering/Math/Physics 25: Computational Methods
6
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
The Final Hand Notes
Engineering/Math/Physics 25: Computational Methods
7
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
GamePlan Illustrated
Set x-value (m-index)
Test 31 y-values (n-index)
Increment x-value (m = m+1)
Test 31 new y-values
Repeat
N
E
Engineering/Math/Physics 25: Computational Methods
8
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
The MATLAB Program
% Bruce Mayer, PE * 8Sep11 * Rev 26Feb12
% ENGR25 * Problem 4-28
% file = Prob4_28_Dense_Road_1109.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 = 0:30 % vary X-CoOrd in Miles
for n = 0:30 % vary Y-CoOrd in Miles
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);
LcnCost(m+1, n+1) = Cmn; % Store all Cost-Tests for later inspection
%* Note: Array indices are NATURAL No'.s; they canNOT Start a Zerot
% Compare to Previous value for Low-Cost
if Cmn < C_Lo(1) % replace ALL THREE previous if new CHAMPION
C_L2 = C_L1;
C_L1 = C_Lo;
C_Lo = [Cmn, m, n];
elseif Cmn < C_L1(1) % Replace TWO RunnersUp if new 1st RunnerUp
C_L2 = C_L1;
C_L1 = [Cmn, m, n];
elseif Cmn < C_L2(1) % Replace ONE RunnerUp if new 2nd RunnerUp
C_L2 = [Cmn, m, n];
end
end
end
%
% REPORT RESULTS
display('The LOWEST-Cost Option in [$-cost, X-miles, Y-miles]')
disp(C_Lo)
display('The 1st "RunnerUp" Low-Cost Option in [$-cost, X-miles, Y-miles]')
disp(C_L1)
display('The 2nd "RunnerUp" Low-Cost Option in [$-cost, X-miles, Y-miles]')
disp(C_L2)
%
% Make SURF plot to show Cost vs Location
E = [0:30];
N = [0:30];
surfc(E, N, LcnCost), xlabel('miles North'), ylabel('miles East'), zlabel('$Cost
per Week'
Bruce Mayer, PE
Engineering/Math/Physics 25: Computational Methods
9
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
The Number Results
The LOWEST-Cost Option in [$-cost,
X-miles, Y-miles]
147.2551
9.0000
16.0000
The 1st "RunnerUp" Low-Cost Option
in [$-cost, X-miles, Y-miles]
147.3513
8.0000
16.0000
The 2nd "RunnerUp" Low-Cost Option
in [$-cost, X-miles, Y-miles]
148.0319
10.0000
16.0000
Engineering/Math/Physics 25: Computational Methods
10
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
The Graph Results
400
$Cost per Week
350
300
250
200
150
100
30
20
10
0
30
25
15
20
10
miles East
miles North
Note the Fairly Large
Optimum Region
@ 10mi-E & 16mi-N
Engineering/Math/Physics 25: Computational Methods
11
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
5
0