Computer Algorithms in Systems Engineering
Spring 2010
Problem Set 7: Branch and bound: Staging building materials
Due: 12 noon, Friday, May 8, 2010
Problem statement
This homework explores the sum of subsets problem, which arises in many contexts. We will use
a truck loading problem. A large number of trucks is used to carry structural elements and many
types of equipment for construction projects.
In many projects, this is a significant portion of the
total cost.
You must ship a series of items from a staging area to a construction site, each with a given
weight, in the minimum number of trucks.
Each truck has the same capacity. We assume that
weight is the limiting factor, not the size of the shipment.
For example, a truck may hold a
maximum of 48,000 pounds of freight. We omit the thousands in the examples that follow, so we
consider the truck to have a capacity of 48. If we have items that weigh 14, 12, 11, 6, 3 and 2,
they can fit exactly on the truck.
The input to the problem is 1,000 integers, which give the weight of each of 1,000 items to be
shipped to the construction site. You are to design an algorithm to place these items on trucks
with the maximum possible efficiency (i.e., using the smallest number of trucks). Suggestions:
1.
Use a greedy algorithm to place ‘obvious’ combinations of items on a truck. For example,
if a truck has a capacity of 48, you can assign it 48 weight-1 items or 24 weight-2 items,
etc. Or you can assign it 12 weight-2 items and 6 weight-4 items.
2.
After your greedy algorithm has handled the obvious combinations, you will be left with
a smaller number of integers. Implement the ‘sum of subsets’ algorithm described below
using a branch and bound framework to assign this next set of items to trucks, again with
maximum efficiency.
3.
Last, there will be some items left over that don’t fit on a truck exactly. Find a way to
assign them to trucks so that there is minimal inefficiency.
We don’t provide any hints for the greedy algorithm; this homework allows you to exercise some
of the algorithm design knowledge you’ve been acquiring this semester.
Sum of subsets
The sum of subsets algorithm is described below, and in section 7.3 of the Horowitz text. It uses
the backtracking version of branch and bound. The key steps are:
•
Sort the weights in ascending order. There will be ties, since many items may have the
same weight.