Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Suppose you are acting as a consultant for the Port Authority of a small Pacific Rim nation. They are currently doing a multi-billion-dollar business
Suppose you are acting as a consultant for the Port Authority of a small Pacific Rim nation. They are 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. Here is a basic sort of problem they face. A ship arrives with n containers of weight w, W2, ..., wn. Standing on the deck is a set of trucks, each of which can hold K units of weight. (You may assume that K and w, are integers.) You can stack multiple containers in each truck, subject to the weight restrictions of K. The goal is to minimize the number of trucks that are needed to carry all the containers. This problem is NP-complete. A greedy algorithm you might use for this is the following. Start with an empty truck and begin piling containers 1,2,3,... onto it until you get to a container that would overflow the weight limit. (These containers might not be sorted by weight.) Now declare this truck "loaded" and send it off. Then continue the process with a fresh truck. By considering trucks one at a time, this algorithm may not achieve the most efficient way to pack the full set of containers into an available collection of trucks. (a) [10 points] Give an example of a set of weights and a value for K where this algorithm does not use the minimum number of trucks. (b) [10 points] Prove that the number of trucks used by this algorithm is within a factor of two of the minimum possible number for any set of weights and any value of K.
Step by Step Solution
★★★★★
3.33 Rating (165 Votes )
There are 3 Steps involved in it
Step: 1
a Lets consider an example where the greedy algorithm doesnt use the minimum number of trucks Suppose we have containers with weights 3 4 5 and K is 6 ...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