Docsity

Job Scheduling Problem and its Relation to the Traveling Salesman Problem, Assignments of Mathematics

Toggle sidebar
bg1
Math 381 Dr. Gunnar Gunnarsson
Solutions to HW #2 July 10, 2007
Selected Solutions for HW #2
Problem 1 — The Job Scheduling Problem
Formulate a general scheduling job in mathematical language to determine the optimal order of jobs
to minimize the total time spent on the entire task. For starters, suppose that for each pair jobs i
and jwe know the time tij required to switch from ito j. Then relate this to the traveling salesman
problem with tij relating to the distance from node ito node j. We could also specify an “origin” node
corresponding to the clean state found at the beginning of the day and required at the end of the day.
First, to formulate the problem:
Suppose that there are njobs, labeled 1,2, ..., n, and an “origin” state labeled 0. Suppose the
time to switch between jobs iand jis tij (for 0 ≤i, j ≤n). We need not assume that tij =tji.
We may model this nicely as a directed graph Gas follows:
•Let the nodes of Gcorrespond to the jobs; so there are n+ 1 nodes, labeled 0,1, ..., n.
•For each ordered pair i, j, put a directed edge from ito j, and give this edge weight tij.
Thus there are two directed edges between every pair of nodes one in each direction.
To illustrate, if there were two jobs, then Gwould look like this:
Now, the physical task of starting at the clean state, doing every job once, and then returning
to the clean state corresponds to the mathematical task of starting at node 0, following a path
(following the direction of the edges) that includes every node once, and then coming back
to 0. This is known as an Hamiltonian cycle. For example, if n= 4 and the job order is
0,3,4,2,1,0, then this corresponds to following the path 0,3,4,2,1,0 in G, with weight (total
switching time) t03 +t34 +t42 +t21 +t10. Thus the scheduling problem equivalent to the
mathematical problem:
•Find the Hamiltonian cycle in Gwith smallest total weight.
How does this relate to the Traveling Salesman Problem? The TSP is a special case of the job
scheduling problem (JSP). If we let tij =tji =dij represent the distance between nodes iand
j, then Gcollapses to an undirected graph with weights dij on each edge. Then solving the
JSP involves finding the shortest path starting at 0, visiting every other node exactly once,
and returning to 0, which is precisely the TSP. Thus any method to solve the JSP may also
be used to solve the TSP as well.
1

Partial preview of the text

Download Job Scheduling Problem and its Relation to the Traveling Salesman Problem and more Assignments Mathematics in PDF only on Docsity!

Math 381 Dr. Gunnar Gunnarsson Solutions to HW #2 July 10, 2007

Selected Solutions for HW

Problem 1 — The Job Scheduling Problem

Formulate a general scheduling job in mathematical language to determine the optimal order of jobs to minimize the total time spent on the entire task. For starters, suppose that for each pair jobs i and j we know the time tij required to switch from i to j. Then relate this to the traveling salesman problem with tij relating to the distance from node i to node j. We could also specify an “origin” node corresponding to the clean state found at the beginning of the day and required at the end of the day.

First, to formulate the problem:

Suppose that there are n jobs, labeled 1, 2 , ..., n, and an “origin” state labeled 0. Suppose the time to switch between jobs i and j is tij (for 0 ≤ i, j ≤ n). We need not assume that tij = tji. We may model this nicely as a directed graph G as follows:

  • Let the nodes of G correspond to the jobs; so there are n + 1 nodes, labeled 0, 1 , ..., n.
  • For each ordered pair i, j, put a directed edge from i to j, and give this edge weight tij. Thus there are two directed edges between every pair of nodes one in each direction.

To illustrate, if there were two jobs, then G would look like this:

Now, the physical task of starting at the clean state, doing every job once, and then returning to the clean state corresponds to the mathematical task of starting at node 0, following a path (following the direction of the edges) that includes every node once, and then coming back to 0. This is known as an Hamiltonian cycle. For example, if n = 4 and the job order is 0 , 3 , 4 , 2 , 1 , 0, then this corresponds to following the path 0, 3 , 4 , 2 , 1 , 0 in G, with weight (total switching time) t 03 + t 34 + t 42 + t 21 + t 10. Thus the scheduling problem equivalent to the mathematical problem:

  • Find the Hamiltonian cycle in G with smallest total weight.

How does this relate to the Traveling Salesman Problem? The TSP is a special case of the job scheduling problem (JSP). If we let tij = tji = dij represent the distance between nodes i and j, then G collapses to an undirected graph with weights dij on each edge. Then solving the JSP involves finding the shortest path starting at 0, visiting every other node exactly once, and returning to 0, which is precisely the TSP. Thus any method to solve the JSP may also be used to solve the TSP as well.