1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elena L [17]
4 years ago
5

You are consulting for a trucking company that does a large amount ofbusiness shipping packages between New York and Boston. The

volume ishigh enough that they have to send a number of trucks each day betweenthe two locations. Trucks have a fixed limit w on the maximum amountof weight they are allowed to carry. Boxes arrive at the New York stationone by one, and each package i has a weight wi. The trucking stationis 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 arrivedafter his make it to Boston faster. At the moment, the company is usinga simple greedy algorithm for packing: they pack boxes in the order theyarrive, and whenever the next box does not fit, they, send the truck on itsway.But they wonder if they might be using too many trucks, and theywant your opinion on whether the situation can be improved. Here ishow they are thinking. Maybe one could decrease the number of trucksneeded by sometimes sending off a truck that was less full, and in thisway allow the next few trucks to be better packed.Prove that, for a given set of boxes with specified weights, the greedyalgorithm currently in use actually minimizes the number of trucks thatare needed. Your proof should follow the type of analysis we used forthe Interval Scheduling Problem: it should establish the optimality of thisgreedy packing algorithm by identifying a measure under which it "staysahead" of all other solutions.
Computers and Technology
1 answer:
likoan [24]4 years ago
6 0

Answer:

Answer explained with detail below

Explanation:

Consider the solution given by the greedy algorithm as a sequence of packages, here represented by indexes: 1, 2, 3, ... n. Each package i has a weight, w_i, and an assigned truck t_i. { t_i } is a non-decreasing sequence (as the k'th truck is sent out before anything is placed on the k+1'th truck). If t_n = m, that means our solution takes m trucks to send out the n packages.

If the greedy solution is non-optimal, then there exists another solution { t'_i }, with the same constraints, s.t. t'_n = m' < t_n = m.

Consider the optimal solution that matches the greedy solution as long as possible, so \for all i < k, t_i = t'_i, and t_k != t'_k.

t_k != t'_k => Either

1) t_k = 1 + t'_k

    i.e. the greedy solution switched trucks before the optimal solution.

    But the greedy solution only switches trucks when the current truck is full. Since t_i = t'_i i < k, the contents of the current truck after adding the k - 1'th package are identical for the greedy and the optimal solutions.

    So, if the greedy solution switched trucks, that means that the truck couldn't fit the k'th package, so the optimal solution must switch trucks as well.

    So this situation cannot arise.

  2) t'_k = 1 + t_k

     i.e. the optimal solution switches trucks before the greedy solution.

     Construct the sequence { t"_i } s.t.

       t"_i = t_i, i <= k

       t"_k = t'_i, i > k

     This is the same as the optimal solution, except package k has been moved from truck t'_k to truck (t'_k - 1). Truck t'_k cannot be overpacked, since it has one less packages than it did in the optimal solution, and truck (t'_k - 1)

     cannot be overpacked, since it has no more packages than it did in the greedy solution.

     So { t"_i } must be a valid solution. If k = n, then we may have decreased the number of trucks required, which is a contradiction of the optimality of { t'_i }. Otherwise, we did not increase the number of trucks, so we created an optimal solution that matches { t_i } longer than { t'_i } does, which is a contradiction of the definition of { t'_i }.

   So the greedy solution must be optimal.

You might be interested in
____, a Symantec product, offers a number of residential firewall and security applications that also provide various degrees of
Alexeev081 [22]

Answer:

Norton

Explanation:

<h2><u>Fill in the blanks </u></h2>

<u>Norton</u> , a Symantec product, offers a number of residential firewall and security applications that also provide various degrees of content filtering and proxy services.

4 0
3 years ago
What is the best way to ensure personal privacy with regard to online information?
Alenkinab [10]
A) only post it via an anonymizer is my guess
7 0
3 years ago
How secure is a password protected word document?
tensa zangetsu [6.8K]
Secure enough to keep someone out who get on your pc but you should encrypted it so no one o the pc or remotely access it with out a password or with out decrypting it
8 0
4 years ago
What is computer ?how does it work​
Lorico [155]

Answer:

A computer is an electronic device for storing and processing data, typically in binary form, according to instructions given to it in a variable program. It receives data through an input unit based on the instructions it is given and after it processes the data, it sends it back through an output device.

Explanation:

5 0
4 years ago
Read 2 more answers
You can create a graphic from either an image or a string using different initializers True or false?
Bad White [126]

Answer:

It is obviously True

Explanation:

hope it helps .

3 0
3 years ago
Other questions:
  • Given three dictionaries, associated with the variables, canadian_capitals, mexican_capitals, and us_capitals, that map province
    11·1 answer
  • Which version represents the video project after the assembly cut has been completed, transitions and special effects have been
    9·1 answer
  • What is <br> Warehouse schema.
    14·1 answer
  • Is ubisoft still making assassins creeds on xbox 360
    8·2 answers
  • Which is most likely a presentation file?
    8·1 answer
  • What do you call when a hacker users multiple guest computers to crack a password?
    11·1 answer
  • In C++ Please :
    6·1 answer
  • What are the two types of formulas in excel
    9·1 answer
  • Private sharing model on Opportunities. Leadership has asked the Administrator to create a new custom object that will track cus
    7·1 answer
  • As a general rule, what is the size of a brochure?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!