ListScheduling Package

Mathematica Packages
Bruce Torrence Homepage

times = {4, 2, 2, 5, 5, 10, 10} ; edges = {{1, 4}, {1, 5}, {2, 3}, {3, 4}, {3, 5}, {3, 6}, {4, 7}, {5, 7}} ; coords = {{3, 18}, {13, 18}, {13, 14}, {10, 7}, {0, 7}, {18, 2}, {5, 2}} ; 
ShowSchedulingDigraph[times, edges, VertexCoordinates -> coords, TaskOffset -> {-3, 1}, ImageSize -> 400, Background -> RGBColor[1, 1, 0.8], Highlight -> {2, 3, 5, 7}, HighlightColor -> RGBColor[.7, .3, .7]] ;

- Graphics -

priorityList = {1, 2, 3, 4, 5, 6, 7} ;
ShowSchedule[times, priorityList, edges, 3] ;

- Graphics -

Synopsis

This package provides several commands for working with list scheduling; It was developed for use with the COMAP text "For All Practical Purposes". It includes commands to produce Gantt charts (the schedule graphic above) and order-requirement digraphs. It will also implement the list-processing algorithm to generate a schedule from a priority list.

Commands

The following commands are provided in this package:

AllScheduleTimes[tasktimes, edges, processors] applies the list-processing algorithm to every possible priority list, and calculates the total times needed for each of the n! schedules (where n is the total number of tasks). It will return a table showing how frequently each schedule time occurs. Note that this command will take a very long time to execute if n is greater than 7 or so. The syntax for the three arguments is as follows: tasktimes is a list of times for the tasks. For instance, {3,5,2} would be used if there were three tasks, with task one taking 3 minutes, task two taking 5 minutes, and task three taking 2 minutes. edges is the list of directed edges in the order-requirement digraph. Each edge is itself expressed as a list of length two, so edges is a nested list. For exampl {{1,2},{2,3}} would be used if there is an arrow from task 1 to task 2, and another arrow from task 2 to task 3. Lastly, processors is the number of processors to be used (a number such as 1, 2 or 3). The option setting Reminders->False will suppress the printout of the input information.

LPA[tasktimes, prioritylist, edges, processors] returns the schedule produced by applying the list processing algorithm. The output is a list of length two. The first item is a nested list of task numbers, one for each processor, showing the order in which the tasks will be performed. The second is a nested list of task completion times, one for each processor. The syntax for the four arguments is as follows: tasktimes is a list of times for the tasks. For instance, {3,5,2} would be used if there were three tasks, with task one taking 3 minutes, task two taking 5 minutes, and task three taking 2 minutes. prioritylist is list of the task numbers in order of priority. For example {3,1,2} would be used if task 3 has highest priority, followed by task 1, and then task 2. edges is the list of directed edges in the order-requirement digraph. Each edge is itself expressed as a list of length two, so edges is a nested list. For example {{1,2},{2,3}} would be used if there is an arrow from task 1 to task 2, and another arrow from task 2 to task 3. Lastly, processors is the number of processors to be used (a number such as 1, 2 or 3).

RenderSchedule[{tasks, schedtimes}, xreference] takes a schedule object in the form returned by LPA as its first argument, and a positive number as its second. This number is used to set the scale on the horizontal axis, and should be set to a value near the maximum completion time. The scale will be such that this number appears 400 printer's points from the left. RenderSchedule is called by ShowSchedule, and is only needed as a stand-alone command to manually produce a scheduling graphic.

ScheduleTime[tasktimes, prioritylist, edges, processors] returns the total time taken by the schedule produced by applying the list processing algorithm. The syntax for the four arguments is as follows: tasktimes is a list of times for the tasks. For instance, {3,5,2} would be used if there were three tasks, with task one taking 3 minutes, task two taking 5 minutes, and task three taking 2 minutes. prioritylist is list of the task numbers in order of priority. For example {3,1,2} would be used if task 3 has highest priority, followed by task 1, and then task 2. edges is the list of directed edges in the order-requirement digraph. Each edge is itself expressed as a list of length two, so edges is a nested list. For example {{1,2},{2,3}} would be used if there is an arrow from task 1 to task 2, and another arrow from task 2 to task 3. Lastly, processors is the number of processors to be used (a number such as 1, 2 or 3).

ShowSchedule[tasktimes, prioritylist, edges, processors] returns the schedule produced by applying the list processing algorithm. The syntax for the four arguments is as follows: tasktimes is a list of times for the tasks. For instance, {3,5,2} would be used if there were three tasks, with task one taking 3 minutes, task two taking 5 minutes, and task three taking 2 minutes. prioritylist is list of the task numbers in order of priority. For example {3,1,2} would be used if task 3 has highest priority, followed by task 1, and then task 2. edges is the list of directed edges in the order-requirement digraph. Each edge is itself expressed as a list of length two, so edges is a nested list. For example {{1,2},{2,3}} would be used if there is an arrow from task 1 to task 2, and another arrow from task 2 to task 3. Lastly, processors is the number of processors to be used (a number such as 1, 2 or 3). The option XReference can be set to a positive number. If two schedules have the same XReference value they will be rendered with the same horizontal scale. XReference should be set to a value near the maximum time needed for the schedules (the value will appear 400 printer's points from the left of the image). The option RectangleStyle can be set to a graphics directive (or to a list of such) to control the color, etc. of the solid rectangles in the schedule.

ShowSchedulingDigraph[tasktimes,edges] will render the order-requirement digraph with the given tasktimes and edges.The syntax for the two arguments is as follows: tasktimes is a list of times for the tasks. For instance, {3,5,2} would be used if there were three tasks, with task one taking 3 minutes, task two taking 5 minutes, and task three taking 2 minutes. edges is the list of directed edges in the order-requirement digraph. Each edge is itself expressed as a list of length two, so edges is a nested list. For example {{1,2},{2,3}} would be used if there is an arrow from task 1 to task 2, and another arrow from task 2 to task 3. There are several options available. The option VertexRadius can be set to any positive number. The option VertexCoordinates may be set to a list of the {x,y} coordinates of each of the vertices (if you do not like the default choice). The option TaskOffset controls the placement of the Task labels for the vertices. It can be set to either a single value (the default is {2,-2}), or a list of such values, one for each individual vertex (if they need to be in different places). The option Levels may be set to 1 (default) or 2. These two settings result in different vertex placement when VertexCoordinates are not specified. The option setting Highlight->{1,3,4} will result in a graph with vertices 1, 3, and 4 highlighted, along with edges {1,3} and {3,4} (if these edges exist in the graph). Vertices in the Highlight list may appear more than once - this can be useful to enable multiple edges from a single vertex to be colored, for example. The option HighlightColor sets the color of the highlighted objects. Graphics options are also accepted.


Last Updated: February 26, 2004