Introduction to Computers and Engineering Problem Solving
Spring 2005
Problem Set 9: Organizing containers for vessel loading
Due: 12 noon,
Session 32
Problem summary
At container ports, trucks hauling containers on chassis line up at cranes to have their
containers loaded onto an ocean-going vessel.
There are C cranes and thus C lines of
trucks.
Each truck is hauling one container, which may be 10, 20 or 40 feet long.
Not all
cranes handle all container sizes.
Each container has a size (10, 20 or 40 feet), a weight (in tons, from 0 to 40), and a
unique ID (string).
It will also be in a line in a crane.
We do not need to separately keep
track of the truck; it is uniquely identified by the container it is hauling.
Containers arrive in time order; we give you a set of 25 arrivals. See the
MIT server
for the file.
Each container chooses the shortest line among the cranes that can handle its
size, and joins it at the end. After all 25 containers have arrived, the cranes service the
containers in each line in order. At any point in the arrival or loading process, we need to
know the following variables:
1. The list of containers in each line, in physical order
2. The list of containers by size, in descending order of weight
3. The number of containers in each line
4. The number of containers, by size
5. The total weight in all containers of a given size (10, 20 or 40 feet)
Your program must process the containers in the order in which they are added by the
user (see below).
The containers must be placed in a two-dimensional linked list.
Each
container must be in a list, by arrival order, in a line for a crane.
And each container must
also be in a list, by ascending weight order, in a “virtual line” by container size.
That is,
we want a list of all 10 foot containers, by weight, a list of all 20 foot containers, by