# (Solved) : Two Warehouses W1 W2 Supplies Shipped Destinations Di 1 N Let Di Demand Di Let Ri Inventor Q42235085 . . .

$9.00

There are two warehouses W1 and W2 from which supplies are to beshipped to destinations Di , 1 ≤ i ≤ n. Let di be the demand at Diand let ri be the inventory at Wi (all integer numbers). Assumethat r1 + r2 = Pdi . Let cij (xij ) be the cost of shipping xijunits from warehouse Wi to destination Dj . The warehouse problemis to find nonnegative integers xij , 1 ≤ i ≤ 2 and 1 ≤ j ≤ n suchthat x1j + x2j = dj , 1 ≤ j ≤ n and P i,j cij (xij ) is minimized.Let gi(x) be the cost incurred when W1 has an inventory of x andsupplies are sent to Dj , 1 ≤ j ≤ i, in an optimal manner (theinventory at W2 is P 1≤j≤i dj − x). The cost of an optimal solutionto the warehouse problem is gn(r1).

a. Use the optimality principle to obtain a recurrence relationfor gi(x).

b. Write an algorithm to solve the recurrence and obtain anoptimal sequence of values for xij , 1 ≤ i ≤ 2 and 1 ≤ j ≤ n.

c. Show steps and tables of your DP algorithm on this particularproblem instance: two warehouses with supply of 10 and 7 units,five destinations with demands of 4, 3, 2, 5, and 3 units. The costof supplying these destinations from warehouse one is 1, 2, 3, 1,2/unit and from warehouse two is 2, 3, 3, 1, 1/unit.

## Expert Answer

Answer to There are two warehouses W1 and W2 from which supplies are to be shipped to destinations Di , 1 ≤ i ≤ n. Let di be t…