Planning and Scheduling


List Processing
We are given Goals:
  1. minimize the completion time
  2. minimize the time any processor is idle
  3. find the minimum number of processors needed to finish the job
Example: House construction


        Priority list (dictated by labor cost, availability, weather, etc): F H J I D E A C G B

Note: this problem is also NP hard (just like the Hamilton circuit)

A task is ready at a particular time, if all its predecessors in the requirement digraph have been completed.
        e.g. you can't do the wiring until the interior walls are done.



List Processing Algorithm
repeat until all tasks are done:
        assign the first ready and not yet assigned task on the priority list to the lowest numbered processor


Example:

    Priority list: T8, T7,T6,T5,T4,T3,T2,T1,
    Schedule the tasks on two processors and find the completion time.

Example: same requirement digraph, different priority list: T1,T2,T3,T4,T5,T6,T7,T8
    Schedule the tasks on two processors and find the completion time.



Critical Path Schedules

sofar the priorities list was given in the beginning

Question: Is there a systematic way of choosing a priorities list that yields better results when processing a list?

use the critical path scheduling algorithm to
   generate a priorities list
   schedule tasks on a single processor


Critical Path Scheduling Algorithm
repeat until no more vertices are left in the directed graph:


Example: Given the directed graph

Given independent tasks of various time lengths and some processors
Schedule the tasks on the processors, so as to minimize total completion time

Decreasing Time List Processing Algorithm

Example: Process tasks with time lengths 10, ,9, 8, 7, 5, 4 on two processors

Example: Given 8 tasks with a total time length of 72 minutes. Distributed onto 3 processors, what is the minimum completion time?



Bin Packing

Task: Given objects with weights w1, w2, w3,... , wn
         Find the minimum number of bins with weight capacity w, so that all objects can be packed into the bins and never exceed the weight capacity for any bin.

Applications:

This is NP complete.

Heuristics:



Next Fit: Comment: this potentially leaves a lot of space in the earlier bins, if smaller objects come later in the list. The earlier bins cannot be accessed any more. But the algorithm is fast and doesn't use much computing space..

Example: Pack items of these sizes:
6, 3, 4, 5, 2, 3, 4, 2, 6, 1
into bins of size 8.



First Fit:

Worst Fit:

Decreasing Time Heuristics:

Comments:

Rescheduling Conflicts via Coloring

represent conflicts via graphs: vertices are objects, an edges represents a conflicts between two objects.

Example: schedule committee meetings for members of a state legislature.
               vertices: committees:

Agriculture A, Commerce C, Consumer Affairs CA, Education E, Forests F, Health H, Justice J, Labor L, Rules R
               edge: there is a legislator who is a member of two committees, who would have a time conflict if both committees held meetings
                at the same time.
                These conflicts are given by a table:
 
A C CA E F H J L R
A x x x
C x x x x
CA x x x x
E x x x
F x x x x
H x x x x
J x x x x
L x x x
R x x x

                Draw the graph represented by this table.

Vertex Coloring: color the vertices so that no two vertices sharing an edge are colored with the same color.
                             (different color - different meeting time)
The chromatic number is the least number of colors needed to do the vertex coloring.
                             (least number of colors - least number of different meeting times needed so that no legislator has a time conflict)