MATLAB Answers

Am I Going About This the Right Way?

33 views (last 30 days)
Asuna Rayleigh
Asuna Rayleigh on 27 Feb 2021
Answered: Walter Roberson on 27 Feb 2021
I have come up with a script that I know isn't completed, but I was wondering if someone could tell me if I am on the right track.
Here is my script so far, but it does have some notes that I added because I wasn' sure where to place certain things within the code:
chart=[10 280 3;70 180 7;80 160 4;170 20 5;220 100 2;270 80 6]
distace= pdist(x_location,y_location);
%any other counters.
for x=1:280;
for y=1:280;
distance= sqrt((x2-x1)^2 + (y2-y1)^2) ;----------
if cost < cost?
Here is the Question for the problem that I am trying to figure out:
Suppose that you are an engineer tasked with finding a new location for your distribution center (let's say you work as an industrial engineer at a cosmetics company). You have a good idea of who your customers are and how many tons of cosmetics you must ship per week. Using your company headquarters as the origin, you plot out the following table:
Customer x-location (miles) y-location (miles) Volume (tons/week)
JC Penney 10 280 3
BB&B 70 180 7
Target 80 160 4
Bath&Body Works 170 20 5
Walmart 220 100 2
Macy's 270 80 6
Your job as an industrial engineer is to come up with the location of the distribution center (to the nearest mile) that minimizes the cost for your company. The cost is given by the formula cost = 0.5 * distance * volume. Assume a dense network of roads such that the distance between your new distribution center and the customer is a straight line.
Any help is appreciated!

Answers (1)

Walter Roberson
Walter Roberson on 27 Feb 2021
You need to find the location x, y such that the total of (0.5*distance*volume) over each of the customers, is minimized.
You can create a function that evaluates the cost for a given [x,y] pair, and then use a minimizer on the function.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by