Keywords

1 Introduction

Scheduling deals with the allocation of resources to operations over given time periods, with the aim of optimising one or more objectives [16]. The Job Shop Scheduling Problem (JSSP) is one of many formulations in scheduling, and has attracted many researchers investigating properties of NP-hard problems and methods to tackle them. It is an important optimisation problem and, for the authors in particular, the problem that sparked, based on [20], the collaboration with Juraj Hromkovič and his research group, see [9, 10, 14].

There are many variants (relaxations and restrictions) of JSSP. In this paper, we consider the standard version defined as follows. There are n jobs in the set \(J = \{j_1,j_2,\ldots ,j_n \}\) and m machines \(M=\{ m_1,m_2,\ldots ,m_m \}\). Each job \(j\in J\) consists of m operations; one operation for each machine. Let \(\pi _j(i)\) be the operation for job j performed on machine i. The operations \(\pi _j\) must be performed in a specific order. Let \(\mathbf {O}\in [1,m]^{m\times n}\) contain the order of the operations for each of the jobs. The column vector \(\mathbf {o}_j\) contains the order of operations for the job j. To be explicit, \(o_{ij} \in [1,m]\) is the position of \(\pi _j(i)\) in the sequence of operations for j. So if \(o_{ij} = 4\), then operation \(\pi _j(i)\) must be the 4-th operation to run for job j. Finally, the elements \(p_{ij}\) of the matrix \(\mathbf {P}\in \mathbb {R}^{m\times n}\) denote the time taken for operation \(\pi _j(i)\), \(j \in J\), \(i \in M\). Each machine can only process a single operation at a time, and once an operation has started, no preemption is permitted.

A schedule is a matrix \(\mathbf C \in \mathbb {R}^{m\times n}\) containing the completion times of the operations. Element \(c_{ij}\) is the completion time of operation \(\pi _j(i)\). Let the makespan L of \(\mathbf C \) be \(\max _{i,j} \mathbf C _{ij}\). The job shop scheduling problem is to find a valid schedule such that the makespan L (the total time taken for all jobs to complete) is minimised.

As an example, take a problem instance with three machines and three jobs, with the time matrix \(\mathbf {P}\) and order matrix \(\mathbf {O}\) as follows:

(1)

Figure 1 shows two examples of valid schedules for this example instance of JSSP.

Fig. 1.
figure 1

Two possible schedules for an example instance of the job shop scheduling problem with three jobs on three machines, with times and orders defined in (1). The problem is to find the schedule that leads to the shortest makespan, that is, the shortest possible time needed to complete all operations.

In this paper, we propose an algorithm for creating schedules that minimise the makespan of JSSP instances by combining the Simulated Annealing algorithm with a Firefly-inspired methodology. The rationale behind this combination is to escape from local minima and avoid becoming constrained in the solution space.

The JSSP has been a focal point for many researchers over the last few decades, primarily due to the growing need for efficiency accompanied by the rapid increase in the speed of computing [2]. This, together with the more recent developments in the availability of cloud resources allowing for large scale distributed and parallel computation, has opened up many additional avenues in terms of algorithmic techniques for working with optimisation problems.

The JSSP has a core motivation in production planning and manufacturing systems. Reduced costs and efficient production lines are a direct result of fast and accurate scheduling solvers. Advancements in job shop scheduling also allow for prioritisation of operations and improved predicted completion times [1].

This paper builds on the research of Steinhöfel et al. on SA [20] and her work with Albrecht et al. on FA [13] by evaluating their symbiosis for the job shop scheduling problem. Moreover, the presented method is motivated by the property of a backbone structure, see [22], and the Firefly idea which enables the search of areas close to the estimated backbones of optimal schedules.

2 Background

The publication of a seminal paper by Johnson (1954) is largely credited as being the starting line for scheduling research [11]. The article outlines two and three-stage production schedules with the objective of minimising the total elapsed time. Early methods of solving JSSP instances include priority rules, branch and bound, integer programming, Monte-Carlo methods, stochastic analysis, algorithms with learning, and enumerative algorithms [15, 17].

An important graphical representation of the JSSP, is the disjunctive graph proposed by Roy and Sussman [17].

Fig. 2.
figure 2

Disjunctive graph exemplified from the previous section (Fig. 1). Recall that \(\pi _j(i)\) refers to the operation for the j-th job on the i-th machine. Solid arcs indicate the order of operations for each job. Dashed edges indicate operations on the same machine.

Figure 2 shows a disjunctive graph for the example defined in the previous section. This graphical formulation provides an outline of all feasible schedules, enabling better interpretation than the usual Gantt chart representations. Modification of the schedule structure is achieved by activating disjunctive edges to represent an ordering of tasks on a machine path. Figure 3 outlines a concrete schedule equivalent to instance (a) in Fig. 1.

Fig. 3.
figure 3

Disjunctive graph of the schedule instance (a) from the previous section (Fig. 1). Recall that \(\pi _j(i)\) refers to the operation for the j-th job on the i-th machine. The vertex weights are shown on their outgoing edges, and the thick arcs show a longest path with respect to vertex weights.

The source o and dummy vertex * act as start and end points respectively, allowing for full navigation of the directed graph; the longest path from o to * is the makespan. The makespan can be calculated by weighting all vertices by the respective P values of each operation \(\pi _j(i)\) and summing the total processing time of all operations on the longest path.

Note that, in [4], the graph derived from a disjunctive graph by considering a concrete schedule has exactly one arc for every disjunctive edge, let us call these disjunctive arcs. But any disjunctive arc shortcutting a directed path of disjunctive arcs does not contribute to a longest path (in terms of vertex weights) since the shortcut misses at least one vertex. Thus, we can omit these shortcuts from the graph.

Potts and Strusevich (2009) demonstrate a simple lower bound of JSSP instances by removing all disjunctive edges in such a graph and finding the maximum weight path in the resulting sub-graph [18]. Various more complex lower bounds are evaluated by dividing a JSSP instance into sub-problems by machine, calculating the lower bound for the single instance and selecting the optimal result.

2.1 Local Search

Local Search (LS) methods involve starting with some initial solution, and then iteratively moving to solutions that are similar, but have better objective function values. This iterative process repeats until a local optimum is found. A survey of LS methods for JSSP can be found in Vaessens et al. [24].

Let F be the set of feasible solutions for some problem instance. The cost of any \(x\in F\) is defined by \(c:F \rightarrow \mathbb {R}\). The neighbourhood function \(N:F\rightarrow \{0,1\}^F\) determines which solutions in F are similar to x. That is, for \(x\in F\), the solutions in the neighbourhood \(N(x) \subseteq F\) are said to be neighbours to x. The execution of a local-search algorithm defines a walk in F such that each solution visited is a neighbour of the previously visited one. A solution \(x \in F\) is called a local minimum with respect to a neighbourhood function N if \(c(x) \le c(y)\) for all \(y \in N(x)\).

A major drawback of LS methods is that of becoming trapped in a local optimum. One attempt at addressing this problem is Simulated Annealing (SA). Annealing in metallurgy is the method of heating and then cooling metals to maximise the size of crystals. SA simulates this process for optimisation problems. As in LS methods, there is a neighbourhood function and a cost function. In SA, rather than always moving to a solution with a better objective value, there is some probability of moving to worse solutions. This probability is determined by the temperature, which reduces with time. A higher temperature means the algorithm is more likely to move to a worse solution. This allows the algorithm to leave local minima and explore more of the solution space.

In 1992, Laarhoven et al. first formulated the SA approach for the JSSP [25], along with further results by Blazewicz et al. [4], Steinhöfel et al. [20] and Satake et al. [19], respectively. SA has proven to be an effective technique for efficiently finding approximate results, overcoming to some extent the aforementioned limitations of LS.

2.2 Evolutionary Algorithms and Hybrids

Various evolutionary algorithms have been used as heuristics for solving JSSP instances, including Genetic Algorithms (GA) [7], Ant Colony Optimisation (ACO) [5] and Particle Swarm Optimisation (PSO) [6]. Instead of improving a single candidate solution, these meta-heuristics improve a population of solutions.

The method developed in this paper follows a line of research on hybrid approaches that combine SA with nature-inspired algorithms. Our method combines SA with the Firefly Algorithm (FA), which is one of the more recent nature inspired optimisation algorithms, published in 2008 by Xin-She Yang [6]. Fireflies are characterised by their luminescence, using their emittance of light to attract other fireflies - essentially their main form of communication.

The intensity of light emitted is directly proportional to the volume and rate at which other flies converge toward it. The attractiveness of the flies is linked to their objective function and monotonic decay of the attractiveness with distance, allowing individual flies to be attracted to any other firefly in the population, assuming they are close enough. The algorithm developed in this paper simplifies this approach somewhat, and resembles more accurately the algorithm developed by Steinhöfel et al. on protein structure prediction in lattice models [13]. This implementation considers a single target, setting the optimal instance as the beacon of light for the rest of the population. In this scenario, the so called fireflies all attempt to move in the same direction.

The rationale supporting the use of FA for the JSSP emanates from an understanding of the solution space, wherein schedule instances close to the optimal are more likely to have similar edge orientations. In addition, updates of the beacon during execution allow for the population to constantly change direction, increasing the likelihood of exploring optimal zones.

3 Our Algorithm

The method presented in this paper is a hybrid of Simulated Annealing (SA) and the Firefly Algorithm (FA).

The neighbourhood function determines for each solution x a subset of F. A solution belongs to that subset only if it can be reached from x with a single modification step, i.e., \(N:F \rightarrow \{0,1\}^F\). That is, \(N(x) \subseteq F\) is the set of feasible schedules similar to \(x\in F\).

We define neighbours based on edge switching. Edges on a machine path can be switched such that a machine path \(\pi _1(1)\)-\(\pi _2(1)\)-\(\pi _3(1)\)-\(\pi _4(1)\) can transition to \(\pi _1(1)\)-\(\pi _3(1)\)-\(\pi _2(1)\)-\(\pi _4(1)\). A visual representation of this is provided in Fig. 4.

Fig. 4.
figure 4

Transition depicting edge flip on a machine path.

Given the disjunctive graph of a JSSP instance, switching a machine edge on the longest path will always result in a feasible (acyclic) schedule [20]. The choice of which edge on the longest path to flip can be determined by its rate of occurrence across all longest paths; known as its edge popularity. By flipping the most popular edge on a longest path, the likelihood of the neighbour having divergent longest paths, and hence more disparate makespan values, is greater.

However, computing all longest paths for every schedule is time consuming. We employ a different method, as follows. We switch a random machine edge and check if the resulting schedule is feasible. This can be determined by considering a sub-graph around the flipped edge in the full disjunctive graph. This allows us to efficiently check if a schedule is feasible. If it is feasible, it is considered a neighbour. If not, it is not.

An empirical analysis on real datasets showed that on average approximately 80% of edge flips resulted in a feasible schedule.

The full algorithm is shown in Algorithm 1. First, a set X of r initial schedules is generated. For each \(x \in X\), a greedy local search is performed until each x is a local optimum. That is, after the greedy search, for every \(x\in X\), we have that \(\forall j \in N(x), L_x \le L_j\). Let \(\varTheta \) be the current best solution. Simulated annealing is executed on \(\varTheta \). And parallel to this, the firefly algorithm is performed using the \(|X|-1\) schedules in the set \(X \setminus \varTheta \).

figure a

In a given iteration of simulated annealing, if a randomly selected neighbour solution is better than the current solution, we move to it. If not, then we move to it with some transition probability. This probability is proportional to a temperature that reduces (cools) from iteration to iteration. Early on in the SA procedure, the temperature is high and the probability of moving to worse solutions is higher compared to later in the SA procedure when the temperature is lower.

In the firefly algorithm, we also have a temperature that reduces over time. The temperature in this case, is relative to the luminescence of the firefly. We may consider the reduction in temperature equivalent to the intensification of the luminescence of \(\varTheta \). With some probability proportional to the luminescence, a firefly moves towards \(\varTheta \) with an edge flip. Otherwise it moves to a random neighbour.

If at any point, a schedule with a makespan smaller than \(\varTheta \) is found, it replaces \(\varTheta \), and the current schedule being considered in the SA thread is replaced by that new \(\varTheta \).

Starting temperatures and cooling rates are chosen such that the number of iterations increases with input size. The starting population of the fireflies is altered such that the runtime is acceptable for the resources available.

4 Experimental Results

Table 1 shows the results of the SAFA algorithm on a selection of benchmark JSSP instances. The ID’sFootnote 1 are constructed based on their origin, with benchmarks from Fisher & Thompson (ft) [8], Lawrence (la) [12], Storer, Wu and Vaccari (swv) [21], Taillard (ta) [23], Yamada and Nakano (yn) [26] and Applegate and Cook (orb) [3].

Table 1. Results on benchmark problems. LB = lower bound. BF = best found with existing methods. SAFA BF and AF = Best found and average found respectively with SAFA method presented in this paper. % Diff = Percentage difference between the best found makespan of SAFA method compared to the best found. Note: ** = BF > LB

The SAFA algorithm was executed 30 times for each benchmark problem. Therefore, the SAFA AF (average found) is the average makespan found out of 30 runs. The makespan is calculated by reversing Dijkstras algorithm and finding the longest path from the source o to the dummy vertex *, as seen in Fig. 2.

A multitude of benchmarks have been considered for the purpose of evaluating the accuracy of the hybrid algorithm. The benchmarks have been selected based on their recognisability, size and comparability. Accordingly, results are compared to the best-found makespans, including a dissimilarity percentage between the best-found solutions of the SAFA hybrid and the known Upper Bound (UB). All computations were performed on a cloud server hosting a standard Intel dual-core processor and 7.5 gb of memory.

The SA parameter settings for the individual benchmarks are dependent on the size and complexity of the instance. In reference to Algorithm 1, the starting temperatures \(t_0^{\text {(sa)}}\) and \(t_0^{\text {(fa)}}\) are initiated with approximately the same value across all benchmarks. In contrast, the cooling rate parameters \(c^{\text {(sa)}}\) and \(c^{\text {(fa)}}\) decrease as the proportions of the benchmark increase. In other words, a lower cooling rate parameter is used for larger benchmark instances. This property allows SA to execute within a middle-ground of efficiency and efficaciousness, while enabling FA with enough iterations for fireflies to achieve their objective function - fully transitioning toward the state of the optimal schedule. This characteristic is essential for the firefly population given there is a greater likelihood of \(\varTheta \) being replaced when the underlying structures, and therein longest paths, become alikened to one another.

5 Conclusion

We have designed a hybrid SAFA algorithm for solving the JSSP. The algorithm has been implemented and executed on a number of different benchmarks. The experimental results are encouraging, wherein the best-found solution was reached for a number of instances and near-optimal solutions found for a wide range of others. The algorithm will be complemented by a more fine-grained analysis in the future. FA improves on the underlying SA algorithm at multiple junctures throughout its execution, with results reflecting conclusive remarks similar to other applications of FA for optimisation problems. Given the results of this paper, future work will be directed at utilising information and estimations of the backbone structure even more. In general, the combination of SA and FA works well and could further be tailored to reach best-found solutions for the larger JSSP instances as well as also being applied to solving other combinatorial optimisation problems.