Assignment 4


 

Consider the following "delivery scheduling" problem. A stationery supply service supplies many clients each day with stationery. Each day, several trucks leave the stationer's warehouse with supplies and return after deliveries are complete. Each truck is assigned a subset of the clients and their merchandise is loaded onto the truck. A truck makes its rounds as efficiently as possible by choosing the order of clients carefully. Note that because each client has different needs, the time spent unloading at client sites can vary. The total time taken by a truck is the time from leaving the warehouse to returning after all the clients on its list are served. This includes driving and unloading time. The "delivery scheduling" problem described above is actually a problem structure common to many problems, including various kinds of delivery scheduling (postal service, trash pickup, inter-state trucking).

In this assignment, you will implement (at least) two algorithms for a version of the delivery scheduling problem. This version simplifies the problem somewhat by removing the complexity of finding paths in street maps. The input to this problem is the following:

The goal of the algorithm is to "divvy" up the locations among the trucks so that each client location is served by only one truck. A second goal is to order the clients for each truck. Then the truck will travel from location to location in that order, thereby completely defining the time required from start to finish. The simplification of the general problem comes from allowing trucks to travel directly (in a straight line) from one location to another. This approximation might be reasonable for inter-state commerce or a "snow-sled" delivery service in the Alaskan wilderness. Whatever the application, it certainly helps reduce the routing complexity while still leaving the problem interesting.

The ultimate objective is to minimize the total time required to complete all deliveries assuming that all trucks leave at the same time and work in parallel. This amounts to minimizing the worst time among the trucks, since the total time is determined by the last truck to return.

An example might help clarify. First, we'll consider an example without loading times.

In the example above, the warehouse is located in the center of the square and there are 8 client locations on the periphery. The (x,y) coordinates of some of the locations are shown. Suppose we have two trucks and suppose Algorithm A assigns locations {0, 2, 4, 6} to one truck and locations {1, 3, 5, 7} to the other. Suppose for simplicity, the trucks move at unit speed. Then, the first truck moves a distance of 10.84 (approximately) while the second truck moves a distance of about 6.24. At unit speed, this amounts to 10.84 hours and 6.24 hours respectively. Thus, the total time required is 10.84 hours (the larger of the two).

Now consider Algorithm B that assigns locations {0, 1, 2, 3} to one truck and locations {4, 5, 6, 7} to the other:

Then, each truck moves a distance of 5.414 (approximately), resulting in a total time of 5.414 hours. This is obviously a better solution.

Now, in the actual problems, there will be loading times. For example, consider these two possible solutions:

In the left figure, the total load time for the red truck is 20, whereas the load time needed for the blue truck is 2. Here, the second solution requires longer driving, but the total time is shorter because the "load time", which dominates travel time, has been balanced between the trucks.

In your assignment, you will implement two algorithms. One will be called SimpleGreedy and the other will be called MyAlgorithm. The SimpleGreedy algorithm is just to help you get started; as you will see, it should be fairly easy to improve on its results. The second algorithm is up to you; we will run your second algorithm in a class-wide competition, as explained below. You are welcome to submit more than two algorithms. Simply name them MyAlgorithm2, MyAlgorithm3 etc. (Don't go overboard - we don't want to test too many).

For this assignment:

Submission: