Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are consulting for a trucking company that does a large amount of business shipping packages between New York and Boston. The volume is high

You are consulting for a trucking company that does a large amount of business shipping packages between New York and Boston. The volume is high enough that they have to send a number of trucks each day between the two locations. Trucks have a fixed limit W on the maximum amount of weight they are allowed to carry. Boxes arrive at the New York station one by one, and each package i has a weight wi. The trucking station is quite small, so at most one truck can be at the station at any time. Company policy requires that boxes are shipped in the order they arrive; otherwise, a customer might get upset upon seeing a box that arrived after his make it to Boston faster. At the moment, the company is using a simple greedy algorithm for packing: they pack boxes in the order they arrive, and whenever the next box does not fit, they send the truck on its way. But they wonder if they might be using too many trucks, and they want your opinion on whether the situation can be improved. Here is how they are thinking. Maybe one could decrease the number of trucks needed by sometimes sending off a truck that was less full, and in this way allow the next few trucks to be better packed.

Prove that, for a given set of boxes with specified weights, the greedy algorithm currently in use actually minimizes the number of trucks that are needed. Your proof should follow the type of analysis we used for the Interval Scheduling Problem: it should establish the optimality of this greedy packing algorithm by identifying a measure under which it stays ahead of all other solutions.

We can formulate this problem as follows. Let {b1, b2, , bn} be the n boxes and let wi be the weight of box bi . A trucking plan P is represented as a sequence P = {t1, t2, , tm} where ti is the index of the last box that is loaded onto truck i. The problem is to find a trucking plan P = {t1, t2, , tm} such that m is minimized. Answer the following questions.

1. Describe the greedy algorithm in pseudocode.

2. First step of correctness proof

Let P = {t1, t2, , tm} be the plan produced by the greedy algorithm. Prove, by induction, that P always stays ahead in the following sense: for any plan P 0 = {t 0 1 , t0 2 , , t0 k }, we have t 0 i ti , 1 i m.

3, Correctness proof

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+With whom does the firm have to negotiate?

Answered: 1 week ago

Question

=+Are there shop stewards?

Answered: 1 week ago