PSU CS410/510: Search and Scheduling
Homework 2
Brute Force Shift Packing

In this assignment, we will explore the ``shift-packing problem'', a classic bin-packing problem in a scheduling setting. The problem is this: given a collection of shifts of given duration, and a collection of jobs of given duration, find an assignment of jobs to shifts which maximizes the total amount of work accomplished.

Note that there are no ordering constraints in this problem: the assignment of ``times to tasks'' is underdetermined, since the jobs performed during a shift can be performed in any order.

I have provided you with three instances of job and shift data (also available as a ZIP archive or tar archive)
Inst.JobsShifts
(a) jobs-10-10.dat shifts-2-58.dat
(b) jobs-20-10.dat shifts-8-106.dat
(c) jobs-100-100.dat shifts-53-5300.dat
Each file contains a sequence of integers, one per line. For a job file, the first line indicates the number of jobs in the file, and the remaining lines give the duration of each job. Similarly, for a shift file, the first line indicates the number of shifts in the file, and the remaining lines give the duration of each shift.

For the job files, the name indicates the number of jobs, and the maximum job duration. For the shift files, the name indicates the number of shifts, and the total length of the shifts. Instance (a) requires packing 10 jobs perfectly into two equal shifts (number partitioning). Instance (b) requires packing a random selection of jobs into an arbitrary assortment of bins. Instance (c) requires doing as well as possible at packing 100 jobs into a set of 53 equal shifts.

Note that it is not immediately obvious whether any of these instances have ``perfect'' solutions, in the sense of completely filling the shifts. It depends on how well things pack.

Assignment

  1. Formally define the problem and instance in the style of Garey and Johnson. What is the right measure of the size of an instance?

  2. Write a simple depth-first solver for this problem.

  3. While completing (2), answer the following questions about your solver:

    1. Did you assign jobs to shifts or shifts to jobs? Does it matter?
    2. As discussed above, there may be no perfect solutions. Does your code ever print a solution in this case?
    3. Does the order in which tasks or shifts are considered matter? If so, why, and what order works best?
    4. Is your solver systematic, or do you consider a given solution more than once? (Be careful: the answer is rarely obvious here.) Is there an easy way to make your solver systematic?

  4. Solve instance (a) to completion. (Hint: it should have multiple optimal solutions.) This should be a good first test of your code.

  5. Solve instances (b) and (c) as best you can.

Turn in answers to questions, source code, and output of runs. Plain old ASCII text strongly preferred. MIME packaging is OK, but not particularly desirable. E-mail everything to me at <bart@cs.pdx.edu> on or before Friday, February 4. Please include "CS510SS Homework 2" in the subject line of your e-mail.


Author: Bart Massey <bart@cs.pdx.edu>
Last Updated: 2000/1/18