What is the SPT priority rule?

Rules used to decide the priorities for fulfilling orders. Examples include:•first-come-first-served (FCFS);•first-in-first-out (FIFO) – often seen as a fair rule, especially by the customer, but in practice it leads to overall inefficiency;•earliest-due-date (EDD) first – the job due out first is processed first: this ignores arrival times and processing times;•shortest processing time (SPT) first – an ideal method for getting small jobs out of the way and minimizing work in progress, but it can make large jobs late and it ignores due dates and arrival times;•longest processing time (LPT) first – this tends to increase work in progress and to make short jobs late;•truncated shortest processing time (TSPT) – jobs that have been waiting longer than a predetermined time are given priority (if no work has been waiting long, SPT rules apply);•critical ratio (CR) – this is the ratio of the time until the due date to the processing time: jobs with the lowest CR are processed first.


Scheduling -- determine the timing and order of operations to optimize the use of resources to meet production requirements

n jobs 1 machine case

Priority rules (pg.590)

First Come First Serve (FCFS)
Shortest Processing Time (SPT)
Earliest Due Date (EDD)
Slack Time Remaining (STR) = time remaining before due date - remaining processing time
    The shortest STR goes first
Critical Ratio (CR) = Time remaining before due date/Remaining processing time
    The smallest CR goes first

Comparison of priority rules

Average Completion time/Mean flow time =(Total processing time + total waiting time)/Number of jobs
Average lateness = total late days/number of jobs

Example

Given:

A2030101.5B3050201.7C1025152.5D1680645.0E1860423.3

Comparing the priority rules

Exercises

Pg. 607 Problem 5, 13

Flow shop scheduling

n jobs two machines: all jobs require the same sequence/order in visiting the machines

Johnson's rule

If the shortest time is for the first machine, do the job first
If the shortest time is for the second machine, do the job last

Example

Job sequence: B à E à D à C à A

Gantt Chart representation

What is the SPT priority rule?

Exercises

Pg. 606 Problem 3, 9, 12, 14

Get full access to Operations Management: An Integrated Approach, 5th Edition and 60K+ other titles, with free 10-day trial of O'Reilly.

There's also live online events, interactive content, certification prep materials, and more.

Discusses the most widely accepted operations principle in the job shop working environment as the shortest processing time (SPT) job priority sequencing rule. It can be demonstrated that use of average job flow time as the measure of SPT efficiency in job flow scheduling introduces a mathematical artefact which can bias results in favour of SPT without adding any real efficiency. Average job flow time with SPT priority sequencing creates the illusion of efficiency. A simple simulation model is used to demonstrate that even though average job flow time is clearly and significantly shorter with SPT it can mask under‐utilization of capacity‐constrained work stations – bottlenecks – present in the flow. Giving priority to those jobs which fill capacity at a bottleneck significantly improves capacity utilization at the bottleneck and reduces the amount of work which awaits capacity at the conclusion of the work schedule.

Java programming environment. Here are instructions for setting up an IntelliJ-based Java programming environment for Mac OS X, Windows, and Linux.

Design goals. Our original goal for this book was to cover the 50 algorithms that every programmer should know. We use the word programmer to refer to anyone engaged in trying to accomplish something with the help of a computer, including scientists, engineers, and applications developers, not to mention college students in science, engineering, and computer science. The code is optimized for clarity, portability, and efficiency. While some of our implementations are as fast as their counterparts in java.util, our primary goal is to express the core algorithmic idea in an elegant and efficient manner. While we embrace some advanced Java features (such as generics and iterators), we avoid others that would interfere with the exposition (such as inheritance and concurrency).

Algorithms and clients in the textbook. The list below includes nearly 200 Java programs (some are clients, some others are basic infrastructure). Click on the program name to access the Java code; click on the description to access the javadoc; click on the data file names to access the data.

Standard input and output libraries.

We use these standard input and output libraries from Introduction to Programming: An Interdisciplinary Approach. They are part of algs4.jar.

Using the textbook libraries.

If you used our recommmended environment, you should be ready to go.
  • IntelliJ. The IntelliJ project folders that we suppply for COS 226 and Coursera are pre-configured to add algs4.jar to the Java classpath.
  • Windows Git Bash (autoinstaller wrapper script). The Windows installer downloads algs4.jar to C:\Program Files\LIFT-CS\algs4.jar and provides the wrapper scripts javac-algs4 and java-algs4, which add algs4.jar to the Java classpath. These wrapper scripts are available only in Git Bash, not the Command Prompt.
  • Mac OS X Terminal (via autoinstall wrapper script). The Mac OS X installer downloads algs4.jar to the /usr/local/lift/lib/algs4.jar folder and provides the wrapper scripts javac-algs4 and java-algs4, which add algs4.jar to the Java classpath.
  • Linux shell (via wrapper script). The Linux installation guide downloads algs4.jar to the /usr/local/lift folder and provides the wrapper scripts javac-algs4 and java-algs4, which add algs4.jar to the Java classpath.
Now, we'll describe how to add our textbook libraries to your Java classpath in a variety of other environments. First, download algs4.jar. Do not unjar it.
  • Windows Command Prompt (temporary). Download algs4.jar to, say C:\Users\username\algs4\algs4.jar. Compile and execute your program using the -classpath or
    C:\Users\username\algs4\algs4.jar;
    
    0 option.
    javac -cp .;C:\Users\username\algs4\algs4.jar HelloWorld.java
    java -cp .;C:\Users\username\algs4\algs4.jar HelloWorld
    
  • Windows Command Prompt (permanent). Download algs4.jar to, say C:\Users\username\algs4\algs4.jar. Next, add algs4.jar to the CLASSPATH environment variable.
    • Windows 8 or 10: Control Panel → System and Security → System → Advanced system settings → Advanced → Environment Variables → CLASSPATH.

      Windows 7: Start → Computer → System Properties → Advanced system settings → Environment Variables → User variables → CLASSPATH.

      Vista: Start → My Computer → Properties → Advanced → Environment Variables → User variables → CLASSPATH.

    • Prepend the following to the beginning of the CLASSPATH variable:
      C:\Users\username\algs4\algs4.jar;
      

      The semicolons separate entries in the CLASSPATH.

    • Click OK three times.

    If you don't see a variable named CLASSPATH, click New and in the popup window enter CLASSPATH for the variable name. Then, perform the instructions above.

  • Mac OS X Terminal (temporary). Download algs4.jar to, say ~/algs4/algs4.jar. Compile and execute your program using the -classpath or
    C:\Users\username\algs4\algs4.jar;
    
    0 option.
    javac -cp .:~/algs4/algs4.jar HelloWorld.java
    java -cp .:~/algs4/algs4.jar HelloWorld
    
  • Mac OS X Terminal (manual). Download algs4.jar to, say ~/algs4/algs4.jar. Depending on your shell, add the following line or lines to the file specified:
    • Bourne-again shell (bash). Add the following line to the file ~/.bash_profile (if it exists); otherwise add it to the file ~/.bash_login (if it exists); otherwise, add it to the file ~/.profile (if it doesn't exist, create it first):
      export CLASSPATH=$CLASSPATH:~/algs4/algs4.jar
      

      The colons separate entries in the CLASSPATH.

    • C shell (csh). Add the following line to the file ~/.cshrc (if it doesn't exist, create it first):
      if ( !($?CLASSPATH) ) then
          setenv CLASSPATH .:~/algs4/algs4.jar
      else
          setenv CLASSPATH .:~/algs4/algs4.jar:${CLASSPATH}
      endif
      
    • Bourne shell (sh). Add the following line to the file ~/.profile (if it doesn't exist, create it first):
      export CLASSPATH=$CLASSPATH:~/algs4/algs4.jar
      
    • T shell (tcsh). Add the following line to the file ~/.tcshrc (if it exists); otherwise add it to the file ~/.cshrc (if it doesn't exist, create it first):
      if ( !($?CLASSPATH) ) then
          setenv CLASSPATH .:~/algs4/algs4.jar
      else
          setenv CLASSPATH .:~/algs4/algs4.jar:${CLASSPATH}
      endif
      
  • Linux Command Line (manual). Follow the same instructions as for Mac OS X Terminal.
  • IntelliJ (manual). Download algs4.jar to a folder and add
    C:\Users\username\algs4\algs4.jar;
    
    3 to the project via File → Project Structure → Libraries → New Project Library.
  • Eclipse (manual). Download algs4.jar to a folder and add algs4.jar to the project via Project → Properties → Java Build Path → Libaries → Add External JARs and select
    C:\Users\username\algs4\algs4.jar;
    
    3.
  • VSCode (manual). Download algs4.jar to a folder and add algs4.jar to the project via Java Project → Referenced Library and select
    C:\Users\username\algs4\algs4.jar;
    
    3.

Accessing the textbook libraries.

To access the classes in algs4.jar, you will need to use import statements like the ones below:
import edu.princeton.cs.algs4.MinPQ;
import edu.princeton.cs.algs4.StdIn;

Download our test data files.

To use the data, unzip algs4-data.zip. It will create a subdirectory algs4-data with all of the data files used in the textbook.

Git.

We maintain the source code in a Git repository, suitable for use with Maven or Gradle.

Maven and Gradle.

We maintain algs4.jar as a Bintray resource, for use with Maven or Gradle.

Exercise solutions.

Here is a list of solutions to selected coding exercises.

Q + A


Q. What is the easiest way to execute the main() method in classes that are contained in algs4.jar?

A. If you used our autoinstaller, you can execute with a command like

% java-algs4 edu.princeton.cs.algs4.StdDraw

Q. Can I use algs4.jar in my project?

A. The library algs4.jar is released under the GNU General Public License, version 3 (GPLv3). If you wish to license the code under different terms, please contact us to discuss.

Q. There are some classic algorithms missing from your library. Can I help you add more?

A. Here are a few algorithms on our wishlist. If you wish to implement any of these and contribute to algs4.jar, send us an email and we'd be happy to include your code with an appropriate attribution. Be sure to thoroughly test and comment your code; strive for clarity; and use a style consistent with the other programs in the library.

What is the SPT rule?

SPT (Shortest Processing Time). SPT sequencing rule is that the job takes the shortest time to process is first to complete.

What are the priority rules for sequencing?

studies, the following four sequencing rules are included: (1) Shortest processing time rule (2) Slack per operation rule (3) First-in, first-out rule (4) Due date rule.

What is SPT in sequencing?

Weighted Shortest Processing Time (WSPT) The weighted shortest processing time rule is a variation of the SPT rule. Let t[i] and w[i] denote the processing time and the weight associated with the ith job to be done in the sequence ordered by the WSPT rule.

What are the priority rules in scheduling activities in projects?

A priority rule based scheduling approach consists of two components, a priority rule to determine the list with the rankings of activities and a schedule generation scheme to construct a feasible project schedule based on the constructed activity list.