# Flow-shop scheduling

Flow-shop scheduling is an optimization problem in computer science and operations research. It is a variant of optimal job scheduling. In a general job-scheduling problem, we are given n jobs J$_1$, J$_2$, ..., J$_n$ of varying processing times, which need to be scheduled on m machines with varying processing power, while trying to minimize the makespan – the total length of the schedule (that is, when all the jobs have finished processing). In the specific variant known as flow-shop scheduling, each job contains exactly m operations. The i-th operation of the job must be executed on the i-th machine. No machine can perform more than one operation simultaneously. For each operation of each job, execution time is specified.
Flow-shop scheduling is a special case of job-shop scheduling where there is strict order of all operations to be performed on all jobs. Flow-shop scheduling may apply as well to production facilities as to computing designs. A special type of flow-shop scheduling problem is the permutation flow-shop scheduling problem in which the processing order of the jobs on the resources is the same for each subsequent step of processing.
In the standard three-field notation for optimal-job-scheduling problems, the flow-shop variant is denoted by F in the first field. For example, the problem denoted by " F3|$p_{ij}$|$C_{\max }$" is a 3-machines flow-shop problem with unit processing times, where the goal is to minimize the maximum completion time.

## Formal definition

There are m machines and n jobs. Each job contains exactly m operations. The i-th operation of the job must be executed on the i-th machine. No machine can perform more than one operation simultaneously. For each operation of each job, execution time is specified.
Operations within one job must be performed in the specified order. The first operation gets executed on the first machine, then (as the first operation is finished) the second operation on the second machine, and so on until the m-th operation. Jobs can be executed in any order, however. Problem definition implies that this job order is exactly the same for each machine. The problem is to determine the optimal such arrangement, i.e. the one with the shortest possible total job execution makespan.

## Sequencing performance measurements (γ)

The sequencing problem can be stated as determining a sequence S such that one or several sequencing objectives are optimized.
* (Average) Flow time, $\sum (w_{i})F_{i}$
* Makespan, C$_{max}$
* (Average) Tardiness, $\sum (w_{i})T_{i}$
detailed discussion of performance measurement can be found in Malakooti(2013).

## Complexity of flow-shop scheduling

As presented by Garey et al. (1976), most of extensions of the flow-shop-scheduling problems are NP-hard and few of them can be solved optimally in O(nlogn); for example, F2|prmu|C$_{max}$ can be solved optimally by using Johnson's Rule.
Taillard provides substantial benchmark problems for scheduling flow shops, open shops, and job shops.

## Solution methods

The proposed methods to solve flow-shop-scheduling problems can be classified as exact algorithm such as branch and bound and heuristic algorithm such as genetic algorithm.

### Minimizing makespan, C$_{max}$

F2|prmu|C$_{max}$ and F3|prmu|C$_{max}$ can be solved optimally by using Johnson's Rule but for general case there is no algorithm that guarantee the optimality of the solution.
The flow shop contains n jobs simultaneously available at time zero and to be processed by two machines arranged in series with unlimited storage in between them. The processing time of all jobs are known with certainty. It is required to schedule n jobs on machines so as to minimize makespan. The Johnson's rule for scheduling jobs in two-machine flow shop is given below.
In an optimal schedule, job i precedes job j if min{p$_{1i}$,p$_{2j}$} < min{p$_{1j}$,p$_{2i}$}. Where as, p$_{1i}$ is the processing time of job i on machine 1 and p$_{2i}$ is the processing time of job i on machine 2. Similarly, p$_{1j}$ and p$_{2j}$ are processing times of job j on machine 1 and machine 2 respectively.
For Johnson's algorithm:
    Let p$_{1j}$ be the processing time of job j on machine 1
    and p$_{2j}$ the processing time of job j on machine 2
Johnson's algorithm:
* Form set1 containing all the jobs with p$_{1j}$ < p$_{2j}$
* Form set2 containing all the jobs with p$_{1j}$ > p$_{2j}$, the jobs with p$_{1j}$ = p$_{2j}$ may be put in either set.
* Form the sequence as follows:
    (i) The job in set1 go first in the sequence and they go in increasing order of p$_{1j}$ (SPT)
    (ii) The jobs in set2 follow in decreasing order of p$_{2j}$ (LPT). Ties are broken arbitrarily.
This type schedule is referred as SPT(1)–LPT(2) schedule.
A detailed discussion of the available solution methods are provided by Malakooti (2013).