# Job shop scheduling

(Redirected from Job-shop problem)

Job shop scheduling or the job-shop problem (JSP) is an optimization problem in computer science and operations research in which jobs are assigned to resources at particular times. The most basic version is as follows: We are given n jobs J1J2, ..., Jn of varying processing times, which need to be scheduled on m machines with varying processing power, while trying to minimize the makespan. The makespan is the total length of the schedule (that is, when all the jobs have finished processing).

The standard version of the problem is where you have n jobs J1J2, ..., Jn. Within each job there is a set of operations O1O2, ..., On which need to be processed in a specific order (known as Precedence constraints). Each operation has a specific machine that it needs to be processed on and only one operation in a job can be processed at a given time. A common relaxation is the flexible job shop where each operation can be processed on any machine (the machines are identical).

This problem is one of the best known combinatorial optimization problems, and was the first problem for which competitive analysis was presented, by Graham in 1966.[1] Best problem instances for basic model with makespan objective are due to Taillard.[2]

Applying machine learning to job scheduling is an emerging approach.[3][4] In this approach, artificial intelligence determines optimizations without the need for human programmers to create an algorithm for them or to fully understand the complex causation that drives them.

The name originally came from the scheduling of jobs in a job shop, but the theme has wide applications beyond that type of instance.

## Problem variations

Many variations of the problem exist, including the following:

• Machines can have duplicates (duplicate machines) or be identical (flexible job shop) [5]
• Machines can require a certain gap between jobs or no idle-time
• Machines can have sequence-dependent setups
• Objective function can be to minimize the makespan, the Lp norm, tardiness, maximum lateness etc. It can also be multi-objective optimization problem
• Jobs may have constraints, for example a job i needs to finish before job j can be started (see workflow). Also, the objective function can be multi-criteria.[6]
• Set of jobs can relate to different set of machines
• Deterministic (fixed) processing times or probabilistic processing times

## NP-hardness

Since the travelling salesman problem is NP-hard, the job-shop problem with sequence-dependent setup is clearly also NP-hard, since the TSP is a special case of the JSP with a single machine (the salesman is the machine and the cities are the jobs).

## Problem representation

The disjunctive graph [7] is one of the popular models used for describing the job shop scheduling problem instances.[8]

A mathematical statement of the problem can be made as follows:

Let ${\displaystyle M=\{M_{1},M_{2},\dots ,M_{m}\}}$ and ${\displaystyle J=\{J_{1},J_{2},\dots ,J_{n}\}}$ be two finite sets. On account of the industrial origins of the problem, the ${\displaystyle \displaystyle M_{i}}$ are called machines and the ${\displaystyle \displaystyle J_{j}}$ are called jobs.

Let ${\displaystyle \displaystyle \ {\mathcal {X}}}$ denote the set of all sequential assignments of jobs to machines, such that every job is done by every machine exactly once; elements ${\displaystyle x\in {\mathcal {X}}}$ may be written as ${\displaystyle n\times m}$ matrices, in which column ${\displaystyle \displaystyle i}$ lists the jobs that machine ${\displaystyle \displaystyle M_{i}}$ will do, in order. For example, the matrix

${\displaystyle x={\begin{pmatrix}1&2\\2&3\\3&1\end{pmatrix}}}$

means that machine ${\displaystyle \displaystyle M_{1}}$ will do the three jobs ${\displaystyle \displaystyle J_{1},J_{2},J_{3}}$ in the order ${\displaystyle \displaystyle J_{1},J_{2},J_{3}}$, while machine ${\displaystyle \displaystyle M_{2}}$ will do the jobs in the order ${\displaystyle \displaystyle J_{2},J_{3},J_{1}}$.

Suppose also that there is some cost function ${\displaystyle C:{\mathcal {X}}\to [0,+\infty ]}$. The cost function may be interpreted as a "total processing time", and may have some expression in terms of times ${\displaystyle C_{ij}:M\times J\to [0,+\infty ]}$, the cost/time for machine ${\displaystyle \displaystyle M_{i}}$ to do job ${\displaystyle \displaystyle J_{j}}$.

The job-shop problem is to find an assignment of jobs ${\displaystyle x\in {\mathcal {X}}}$ such that ${\displaystyle \displaystyle C(x)}$ is a minimum, that is, there is no ${\displaystyle y\in {\mathcal {X}}}$ such that ${\displaystyle \displaystyle C(x)>C(y)}$.

## Scheduling efficiency

Scheduling efficiency can be defined for a schedule through the ratio of total machine idle time to the total processing time as below:

${\displaystyle C'=1+{\sum _{i}l_{i} \over \sum _{j,k}p_{jk}}={C.m \over \sum _{j,k}p_{jk}}}$

Here ${\displaystyle l_{i}}$ is the idle time of machine ${\displaystyle i}$, ${\displaystyle C}$ is the makespan and ${\displaystyle m}$ is the number of machines. Notice that with the above definition, scheduling efficiency is simply the makespan normalized to the number of machines and the total processing time. This makes it possible to compare the usage of resources across JSP instances of different size.[9]

## The problem of infinite cost

One of the first problems that must be dealt with in the JSP is that many proposed solutions have infinite cost: i.e., there exists ${\displaystyle x_{\infty }\in {\mathcal {X}}}$ such that ${\displaystyle C(x_{\infty })=+\infty }$. In fact, it is quite simple to concoct examples of such ${\displaystyle x_{\infty }}$ by ensuring that two machines will deadlock, so that each waits for the output of the other's next step.

## Major results

Graham had already provided the List scheduling algorithm in 1966, which is (2 − 1/m)-competitive, where m is the number of machines.[1] Also, it was proved that List scheduling is optimum online algorithm for 2 and 3 machines. The Coffman–Graham algorithm (1972) for uniform-length jobs is also optimum for two machines, and is (2 − 2/m)-competitive.[10][11] In 1992, Bartal, Fiat, Karloff and Vohra presented an algorithm that is 1.986 competitive.[12] A 1.945-competitive algorithm was presented by Karger, Philips and Torng in 1994.[13] In 1992, Albers provided a different algorithm that is 1.923-competitive.[14] Currently, the best known result is an algorithm given by Fleischer and Wahl, which achieves a competitive ratio of 1.9201.[15]

A lower bound of 1.852 was presented by Albers.[16] Taillard instances has an important role in developing job shop scheduling with makespan objective.

In 1976 Garey provided a proof[17] that this problem is NP-complete for m>2, that is, no optimal solution can be computed in polynomial time for three or more machines (unless P=NP).

In 2011 Xin Chen et al. provided optimal algorithms for online scheduling on two related machines[18] improving previous results.[19]

## Offline makespan minimization

### Atomic jobs

The simplest form of the offline makespan minimisation problem deals with atomic jobs, that is, jobs that are not subdivided into multiple operations. It is equivalent to packing a number of items of various different sizes into a fixed number of bins, such that the maximum bin size needed is as small as possible. (If instead the number of bins is to be minimised, and the bin size is fixed, the problem becomes a different problem, known as the bin packing problem.)

Dorit S. Hochbaum and David Shmoys presented a polynomial-time approximation scheme in 1987 that finds an approximate solution to the offline makespan minimisation problem with atomic jobs to any desired degree of accuracy.[20]

### Jobs consisting of multiple operations

The basic form of the problem of scheduling jobs with multiple (M) operations, over M machines, such that all of the first operations must be done on the first machine, all of the second operations on the second, etc., and a single job cannot be performed in parallel, is known as the open shop scheduling problem. Various algorithms exist, including genetic algorithms.[21]

#### Johnson's algorithm

A heuristic algorithm by S. M. Johnson can be used to solve the case of a 2 machine N job problem when all jobs are to be processed in the same order.[22] The steps of algorithm are as follows:

Job Pi has two operations, of duration Pi1, Pi2, to be done on Machine M1, M2 in that sequence.

• Step 1. List A = { 1, 2, …, N }, List L1 = {}, List L2 = {}.
• Step 2. From all available operation durations, pick the minimum.

If the minimum belongs to Pk1,

Remove K from list A; Add K to beginning of List L1.

If minimum belongs to Pk2,

Remove K from list A; Add K to end of List L2.

• Step 3. Repeat Step 2 until List A is empty.
• Step 4. Join List L1, List L2. This is the optimum sequence.

Johnson's method only works optimally for two machines. However, since it is optimal, and easy to compute, some researchers have tried to adopt it for M machines, (M > 2.)

The idea is as follows: Imagine that each job requires m operations in sequence, on M1, M2 … Mm. We combine the first m/2 machines into an (imaginary) Machining center, MC1, and the remaining Machines into a Machining Center MC2. Then the total processing time for a Job P on MC1 = sum( operation times on first m/2 machines), and processing time for Job P on MC2 = sum(operation times on last m/2 machines).

By doing so, we have reduced the m-Machine problem into a Two Machining center scheduling problem. We can solve this using Johnson's method.

## Makespan prediction

Machine learning has been recently used to predict the optimal makespan of a JSP instance without actually producing the optimal schedule.[9] Preliminary results show an accuracy of around 80% when supervised machine learning methods were applied to classify small randomly generated JSP instances based on their optimal scheduling efficiency compared to the average.

## Example

Here is an example of a job shop scheduling problem formulated in AMPL as a mixed-integer programming problem with indicator constraints:

 param N_JOBS;
param N_MACHINES;

set JOBS ordered = 1..N_JOBS;
set MACHINES ordered = 1..N_MACHINES;

param ProcessingTime{JOBS, MACHINES} > 0;

param CumulativeTime{i in JOBS, j in MACHINES} =
sum {jj in MACHINES: ord(jj) <= ord(j)} ProcessingTime[i,jj];

param TimeOffset{i1 in JOBS, i2 in JOBS: i1 <> i2} =
max {j in MACHINES}
(CumulativeTime[i1,j] - CumulativeTime[i2,j] + ProcessingTime[i2,j]);

var end >= 0;
var start{JOBS} >= 0;
var precedes{i1 in JOBS, i2 in JOBS: ord(i1) < ord(i2)} binary;

minimize makespan: end;

subj to makespan_def{i in JOBS}:
end >= start[i] + sum{j in MACHINES} ProcessingTime[i,j];

subj to no12_conflict{i1 in JOBS, i2 in JOBS: ord(i1) < ord(i2)}:
precedes[i1,i2] ==> start[i2] >= start[i1] + TimeOffset[i1,i2];

subj to no21_conflict{i1 in JOBS, i2 in JOBS: ord(i1) < ord(i2)}:
!precedes[i1,i2] ==> start[i1] >= start[i2] + TimeOffset[i2,i1];

data;

param N_JOBS := 4;
param N_MACHINES := 4;

param ProcessingTime:
1 2 3 4 :=
1 4 2 1
2 3 6 2
3 7 2 3
4 1 5 8;


## References

1. ^ a b Graham, R. (1966). "Bounds for certain multiprocessing anomalies" (PDF). Bell System Technical Journal. 45: 1563–1581. doi:10.1002/j.1538-7305.1966.tb01709.x.
2. ^
3. ^ Goodhill, Geoff (2017-06-06), "No More Playing Games: AlphaGo AI to Tackle Some Real World Challenge", SingularityHub, retrieved 2017-06-09, What’s next? The game of Go provided a nicely constrained development platform for optimizing these learning algorithms. But many real-world problems are messier than this and have less opportunity for the equivalent of self-play (for instance self-driving cars). So, are there problems to which the current algorithms can be fairly immediately applied? One example may be optimization in controlled industrial settings. Here the goal is often to complete a complex series of tasks while satisfying multiple constraints and minimizing cost.
4. ^ Rosemarin, Hanan; Dickerson, John; Kraus, Sarit (2017-06-19). "Learning to Schedule Deadline- and Operator-Sensitive Tasks". arXiv: [cs.AI].
5. ^ Maccarthy (1993). "Addressing the gap in scheduling research: a review of optimization and heuristic methods in production scheduling".
6. ^ Malakooti, B (2013). Operations and Production Systems with Multiple Objectives. John Wiley & Sons. ISBN 978-1-118-58537-5.
7. ^ B. Roy, B. Sussmann, Les problèmes d’ordonnancement avec constraintes disjonctives, SEMA, Note D.S., No. 9, Paris, 1964.
8. ^ Jacek Błażewicz, Erwin Pesch, Małgorzata Sterna, The disjunctive graph machine representation of the job shop scheduling problem, European Journal of Operational Research, Volume 127, Issue 2, 1 December 2000, Pages 317-331, ISSN 0377-2217, 10.1016/S0377-2217(99)00486-5.
9. ^ a b Mirshekarian, Sadegh; Šormaz, Dušan N. (2016). "Correlation of job-shop scheduling problem features with scheduling efficiency" (PDF). Expert Systems with Applications. 62: 131–147. doi:10.1016/j.eswa.2016.06.014.
10. ^ Coffman, E. G. Jr.; Graham, R. L. (1972), "Optimal scheduling for two-processor systems" (PDF), Acta Informatica, 1: 200–213, doi:10.1007/bf00288685, MR 0334913.
11. ^ Lam, Shui; Sethi, Ravi (1977), "Worst case analysis of two scheduling algorithms", SIAM Journal on Computing, 6 (3): 518–536, doi:10.1137/0206037, MR 0496614.
12. ^ Bartal, Y.; A. Fiat; H. Karloff; R. Vohra (1992). "New Algorithms for an Ancient Scheduling Problem". Proc. 24th ACM Symp. Theory of Computing. pp. 51–58. doi:10.1145/129712.129718.
13. ^ Karger, D.; S. Phillips; E. Torng (1994). "A Better Algorithm for an Ancient Scheduling Problem". Proc. Fifth ACM Symp. Discrete Algorithms.
14. ^ Albers, Susanne; Torben Hagerup (1992). "Improved parallel integer sorting without concurrent writing". Proceedings of the third annual ACM-SIAM symposium on Discrete algorithms. Symposium on Discrete Algorithms archive. pp. 463–472.
15. ^ Fleischer, Rudolf (2000). Algorithms - ESA 2000. Berlin / Heidelberg: Springer. pp. 202–210. ISBN 978-3-540-41004-1.
16. ^ Albers, Susanne (1999). "Better bounds for online scheduling". SIAM Journal on Computing. 29 (2): 459–473. doi:10.1137/S0097539797324874.
17. ^ Garey, M.R. (1976). "The Complexity of Flowshop and Jobshop Scheduling". Mathematics of Operations Research. 1 (2): 117–129. doi:10.1287/moor.1.2.117. JSTOR 3689278.
18. ^ Chen, Xin; Lan, Yan; Benkő, Attila. "PDF, György Dósa, Xin Hana (2011). Optimal algorithms for online scheduling with bounded rearrangement at the end". Theoretical Computer Science. 412 (45): 6269–6278. doi:10.1016/j.tcs.2011.07.014. External link in |title= (help)
19. ^ Liu, M.; Xu, Y.; Chu, C.; Zheng, F. (2009). "Online scheduling on two uniform machines to minimize the makespan". Theoret. Comput. Sci. 410 (21–23): 2099–2109. doi:10.1016/j.tcs.2009.01.007.
20. ^
21. ^ Khuri, Sami; Miryala, Sowmya Rao (1999). "Genetic Algorithms for Solving Open Shop Scheduling Problems". Proceedings of the 9th Portuguese Conference on Artificial Intelligence: Progress in Artificial Intelligence. London: Springer Verlag. CiteSeerX .
22. ^ S.M. Johnson, Optimal two- and three-stage production schedules with setup times included, Naval Res. Log. Quart. I(1954)61-68.