UMBC CMSC641, Design & Analysis of Algorithms, Spring 2001
- Problem 18-3, page 376.
- Exercise 20.2-10 page 417.
- The business plan for the startup company SingleToy.com calls for the
company to sell a single toy each week. (This greatly simplifies the
design of their website!) Customers place their orders Monday through
Friday and all the orders are shipped out on Saturday from two warehouses
owned by the company. These toys are very popular and sell out each week.
In fact, most customers place orders for many units. You've been hired to
optimize their shipping costs.
Let r1 and r2 denote the inventory at warehouses
W1 and W2 respectively and let n =
r1+r2. (I.e., W1 has r1 units
of the toy of the week and W2 has r2 units for a
total of n.) Suppose that m customers placed orders this week. Let
xj denote the number of units ordered by customer j. Since the
toys were sold out,
n = r1 + r2 = x1 + ... + xm.
Let cij denote the cost per unit for shipping the toy
from warehouse Wi to customer j. For each customer j, you have
the option of shipping yj units, 0 <= yj <=
xj, from W1 and zj units, 0 <=
zj <= xj, from W2 as long as
yj + zj = xj. Your job is to minimize the
total shipping cost, which is given by:
c11y1 + ...+c1mym +
c21z1 + ...+c2mzm
- Your predecessor at SingleToy.com used the following strategy: sort
the cij's then starting with the smallest cij, ship
as many units from Wi to customer j as possible and then go on
with the next smallest cij. Give a concrete example with 2
customers and show that in your example, your predecessor's strategy does
not give the minimum shipping cost.
- Devise an efficient algorithm that finds the values of yj
and zj that gives the minimum shipping costs. Briefly justify
that your algorithm is correct. Analyze the running time of your algorithm.
29 Jan 2001 13:00:53 EST
to Spring 2001 CMSC 641 Homepage