Question
Suppose you re actmg as a consultant for the Port Authority of a small Pacific Rim nation. Theyre currently doing a multi-billion-dollar business per year,
Suppose you re actmg as a consultant for the Port Authority of a small Pacific Rim nation. Theyre currently doing a multi-billion-dollar business per year, and their revenue is constrained almost entirely by the rate at which they can unload ships that arrive in the port.
Heres a basic sort of problem they face. A ship arrives, with n con- tainers of weight w1, tv2 ..... tun. Standing on the dock is a set of trucks, each of which can hold K units of weight. (You can assume that K and each wi is an integer.) You can stack multiple containers in each truck, subject to the weight restriction of K; the goal is to minimize the number of trucks that are needed in order to carry all the containers. This problem is NP-complete (you dont have .to prove this).
A greedy algorithm you might use for this is the following. Start with an empty truck, and begin piling containers 1, 2, 3 .... into it unlil you get to a container that would overflow the weight limit. Now declare this truck "loaded" and send it off; then continue the process with a fresh truck. This algorithm, by considering trucks one at a time, may not achieve the most efficient way to pack the full set of containers into an available collection of trucks.
(a) Give an example of a set of weights, and a value of K, where this algorithm does not use the minimum possible number of trucks.
(b) Show, however, that the number of trucks used by this algorithm is within a factor of 2 of the minimum possible number, for any set of weights and any value of K.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started