^{1}

^{*}

^{1}

An algorithm using the heuristic technique of Simulated Annealing to solve a scheduling problem is presented, focusing on the scheduling issues. The approximated method is examined together with its key parameters (freezing, tempering, cooling, number of contours to be explored), and the choices made in identifying these parameters are illustrated to generate a good algorithm that efficiently solves the scheduling problem.

In general terms, an operation is defined as an elementary activity whose realization requires a machine, that is, an instrument capable of performing operations. For example, a production process is composed of operations that require the use of resources (machines, manpower).

There are three main problems to be considered:

1) Loading: to allocate the operations to the available resources;

2) Sequencing: to determine the sequence according to which the operations are to be performed;

3) Scheduling: to define the planning of each operation; that is, to identify its instants of beginning and completion.

The term “scheduling” can be used to indicate the timing according to which the operations must be carried out and the process that leads to the identification of this timing. Scheduling problems [

A machine can be: dedicated (if it can only perform certain operations), or parallel (if it can perform all the operations indifferently). In the case of parallel machines we speak of machines: identical, if they process the operations with the same speed; uniform, if the speed of the machines is different but constant and independent of the operations; uncorrelated, if the speed depends on the operations to be carried out.

The state of the art of the job scheduling problem is illustrated in [

We can define the following entities in a scheduling problem:

Processing time p i j : Time needed by machine i to perform operation j;

Weight or priority w j : Represents a priority level of operation j;

Release time r j : Time from which operation j can be processed;

Start time s j : Time at which operation j is started ( s j ≥ r j );

Completion time C j : Time when operation j ends;

Expiry time (due date) d j : The interval within which operation j should be completed;

Deadline e j : The latest time by which operation j should be completed;

Flow time F j = C j − r j : Difference between the completion time and the release time; it is the turnaround time of the operation j;

Lateness L j = C j − d j : Difference between the completion time and the expiry time; if L j > 0 the operation was completed late; if L j < 0 , it was completed early;

Tardiness T j = max { L j , 0 } : Only takes into account delays with respect to completion times;

Slack (scroll) s l j = d j − r j − p j : The possible sliding for the execution of the operation.

Examples of possible operation scheduling based on the previous definitions are shown in

The objectives of a scheduling problem can be summarised as follows:

1) Maximum completion time (makespan): C max = max { C j } ;

2) Weighted sum of the completion times: ∑ w j C j ;

3) Weighted sum of flow times: ∑ w j F j ;

4) Weighted sum of the delays: ∑ w j L j ;

5) Maximum delay: L max = max { L j } ;

6) Maximum tardiness: T max = max { T j }

7) Number of delayed operations: ∑ δ ( L j ) 1

8) Weighted number of delayed operations: ∑ w j δ (Lj)

9) Weighted sum of the tardinesses: ∑ w j T j

Objective (1) is oriented towards the efficient use of machines; objectives (2-4) are user-oriented; objectives (5-9) are time-oriented. The most important objectives are the makespan ( C max ), the weighted sum of the completion times ( ∑ w j C j ) and the maximum delay ( L max ). An objective is regular if its value cannot decrease as the processing time of any operation increases.

A scheduling problem typically involves the following constraints:

· Each machine cannot process more than one operation at a time;

· Each operation must be processed at most by one machine at a time;

· An operation can be performed in the time interval [ r j , d j ] ;

· Any technological constraints must be satisfied.

Some examples of technological constraints may be:

1) Possibility to interrupt the execution of an operation and to resume it later (preemptive scheduling);

2) Constraints of precedence between operations;

3) Need to wait for setup times between the completion of one operation and the start of another on the same machine;

4) Possibility to execute groups of operations simultaneously (batch scheduling).

Scheduling problems can be classified on the basis of: characteristics of operations; time constraints; type of information available.

Classification according to the characteristics of the operations.

According to the characteristics of the operations you can distinguish between: one-step problems (all jobs require only one operation and, therefore, you can talk about either job or task), multi-stage problems (each job is composed of several operations among which there are precedence constraints).

One-step problems can, in turn, be distinguished, depending on the number of machines, under (see

Classification according to time constraints.

Taking into account time constraints, you can distinguish among:

· Static problems: If the operations are all available at the start of the schedule ( r j = 0 for each operation);

· Dynamic problems: If operations become available in time in a way known a priori ( r j > 0 known in advance);

· Online problems: If operations become available over time in a way not known a priori ( r j > 0 not known in advance).

Classification according to the type of information available.

Considering the type of information available, scheduling problems can be:

· Deterministic, if the parameters associated with the operations (processing times, release times, deadlines) are all deterministic;

· Stochastic, if any of the parameters associated with the operations (processing times, release times, deadlines) are defined in random terms.

A standard method for classifying a scheduling problem is Graham’s notation [

A solution to a scheduling problem can be (see

A solution without delay is also active. An active solution may be delayed. The optimal solution to a scheduling problem is an active solution but not necessarily without delay.

Like all optimization problems, a scheduling problem can be solved with exact or heuristic methods depending on its complexity [

A widely used construction method for solving scheduling problems is the “dispatching rules” method. It is a construction method that, in the initialisation phase, orders operations on the basis of rules or priority indexes, and then builds the solution by assigning them, in this order, to the available machines.

Priority rules are static if the value of the index does not depend on the start time of the operation, otherwise dynamic. For some problems, when the priority rule is properly chosen, the method obtains the best solution. The most commonly used static priority rules are:

FCFS (First Come First Served): Increasing release time;

WSPT (Weighted Shortest Processing Time): Decreasing ratio w j / p j or, if w j = 1 ∀ j , increasing processing time;

LPT (Longest Processing Time): Decreasing processing time;

EDD (Earliest Due Date): Increasing expiry time;

MST (Minimum Slack Time): Increasing value of slack s l j = d j − r j − p j (dynamic).

CR (Critical Ratio) ( d j − r j ) / p j : Increasing value of the ratio ( d j − r j ) / p j (dynamic).

The following section illustrates the scheduling problem applied to a typical CPU processing environment; then the Simulated Annealing technique is presented, followed by two mathematical models formalising the scheduling problem in terms of objective function and related constraints. The final sections deal with the algorithm derived from the application of SA to the CPU scheduling problem, the related computational tests and conclusions.

With reference to the management of the Central Processing Unit, it is fundamental to have an algorithm that specifies the sequence according to which the processing service is assigned to a specific job. This algorithm is called scheduler and implements some computing methodologies which can be very time-consuming [

It is therefore important to indicate a “cost” function with which the weight of each possible sequence can be measured: based on this, it is necessary to find a sequence order that allows the minimisation of the cost function. It is therefore clear that scheduling issues are intimately linked to decisions about what needs to be done and how it needs to be done.

Given a problem, we will say that we can extract the sequence requests associated with this problem when the following assumptions are met:

1) The jobs to be executed are fully known, and may not be announced to the scheduling process simultaneously but sequentially over time;

2) The resources that can be used in the execution of the work are fully specified;

3) The sequence of core tasks required to perform each of the jobs is known.

The scheduling problem can be solved in several ways [

Other classic methods that solve the problem exactly consist of algorithms for branch-and-bound [

Simulated annealing (SA) [

This analogy is best illustrated in terms of the physics of single crystal formation starting from a melting phase. The temperature of this “molten crystal” is then very slowly reduced until the crystal structure is formed. If cooling is carried out very quickly, undesirable phenomena occur as dislocations and polycrystalline phases. In particular, very large irregularities are enclosed in the structure of the crystal and the level of potential energy incorporated is much higher than that which would exist in a perfect single crystal.

This “quick cooling” process can be seen as similar to local optimization (

Physical System | Optimization Problem |
---|---|

State | Feasible solution |

Energy | Cost |

Fundamental state | Optimal solution |

Quick cooling | Local search |

Accurate annealing | Simulated annealing |

When the temperature is, theoretically, at absolute zero Kelvin no state transition can lead to a higher energy state. Therefore, as in local optimization, upward movements are forbidden and the consequences of this may be undesirable.

When crystals begin to form, the risk of undesirable local states is avoided by lowering the temperature very slowly, with a process called accurate annealing. In this process the temperature drops very slowly through a series of levels, each maintained long enough to allow the search for equilibrium—at that temperature—for the crystal. As long as the temperature is larger than zero Kelvin, upward movements are always possible. By not allowing the temperature to deviate from that one compatible with the energy level of the current equilibrium, we can hope to avoid local optima until we are relatively close to the basic state.

SA is the algorithmic counterpart of this physical annealing process. Its name refers to the technique of simulation of the physical annealing process in conjunction with an annealing schedule of temperature decrease. It can be seen as an extension of the local optimization technique [

This technique was proposed by [

A simple scheme of simulated annealing is as follows:

1) Consider an initial solution S

2) Until you have a freeze

a) For w : = 0 up to the number of neighbors considered

i) Let S’ an unexamined neighbor of S

ii) If Cost(S’) < Cost(S) then S : = S ′

else set S : = S ′ with a certain probability

b) Cool the temperature

3) Return S

From what reported above it is clear that the fundamental parameters for the SA phase are:

Freezing. This consists of establishing the criteria for stopping the algorithm.

Temperature. This is a value on which the probability of accepting upward movements depends. At each iteration this temperature is reduced by a constant rate called cooling.

Number of neighbors to explore. Each iteration considers a (fixed) number of sequences close to the one considered.

SA is widely applicable in local optimization problems. It seems to produce better solutions than other local optimization techniques, as it permits you to get out of locally excellent but globally poor solutions by allowing upward movements with a certain probability.

In Subection 1.1, we indicated with the term completion time ( C j ) a value that

depends on the particular scheduling sequence. If a job is in position j in the sequence, its completion time is the completion time of the job at position j − 1 plus its processing time. We will denote with the term total completion time the sum of the completion times of each individual job.

The sequencing problems that we will deal with are called non preemptive: the job that is in the processing state cannot be interrupted for any reason.

For the solution of scheduling problems we describe two mathematical models [

x i j k the variable that is equal to 1 if job j is the k-th job executed on the machine i, 0 otherwise. We also indicated p i j the processing time of job j on machine i.

The model is therefore as follows:

Minimize ∑ i = 1 m ∑ j = 1 n ∑ k = 1 n p i j x i j k subject to : ∑ k = 1 n ∑ i = 1 m x i j k = 1 ( j = 1 , ⋯ , n ) ∑ j = 1 n x i j k ≤ 1 ( k = 1 , ⋯ , n ; i = 1 , ⋯ , m ) x i j k ∈ { 0 , 1 } ( i = 1 , ⋯ , m ; j , k = 1 , ⋯ , n )

where the first constraint binds the j-th job to run as k-th on the i-th machine for some i and j.

The second model concerns the scheduling of n jobs on m machines that minimizes the sum of the single completion times. By specifying with C i j k = ∑ l = 1 k p i j x i j l the completion time of job j scheduled as k-th on machine i, the related mathematical model is therefore:

Minimize ∑ i = 1 m ∑ j = 1 n ∑ k = 1 n C i j k subject to : ∑ k = 1 n ∑ i = 1 m x i j k = 1 ( j = 1 , ⋯ , n ) ∑ j = 1 n x i j k ≤ 1 ( k = 1 , ⋯ , n ; i = 1 , ⋯ , m ) x i j k ∈ { 0 , 1 } ( i = 1 , ⋯ , m ; j , k = 1 , ⋯ , n )

The problem that we are going to solve with the simulated annealing technique can be summarized as follows [

Basic parameters for the phase of simulated annealing are:

Initialization. Choice of an initial solution. In theory the choice of an initial solution has no effect on the quality of the final solution, i.e. the solution converges to the overall optimum independently of the initial solution [

Selection of a mechanism that generates small perturbations, to pass from one configuration to another one. The perturbation pattern is a crucial element to obtain good performances. The chosen perturbation scheme consists in considering two randomly generated numbers and exchanging places for the jobs that in the scheduling queue occupy the positions relative to the random numbers chosen.

The data structure chosen for the representation of the j-th job (with 0 < j ≤ n − 1 ) implements the most important definitions of Subsection 1.1 as follows:

p ( i ) , ∀ 0 ≤ i ≤ m − 1

It is a vector that stores the job’s processing time on the i-th processor (machine). These data are read from the input stream.

tot_{p}

This is the total processing time of the job, obtained by summing the processing time of the job on all processors = ∑ i = 1 m p ( i ) .

d

Job due date. This data is read from the input stream and is calculated by the generator in the following way:

d = t o t p + ( input percentage of t o t p )

c

This is the completion time of the job; its value depends on the particular permutation of the scheduling queue. If the job is in the j-th position in the scheduling queue, then its completion time is given by the value of the completion time of the job that precedes it in the scheduling queue plus its own processing time.

late

This is the late work [

· If c − d ≤ 0 then l a t e = 0

· If 0 < c − d ≤ t o t p then l a t e = c − d

· If c − d > t o t p then l a t e = t o t p

Other useful information for understanding the algorithm are:

Actual order

This is the scheduling order of the jobs currently considered. The order following the reading of the data from the input stream is assumed to be 0,1,2, ⋯ , n − 1 .

Best order

It is the job scheduling order that obtains the minimum from the objective function. This minimum value is stored in the variable BOF (Best Objective Function).

Parameters chosen for the simulated annealing phase are:

Freezing criterion

A freeze occurs when the algorithm, for MAXITERATIONS times, does not perform neither a downhill nor an uphill movement.

Temperature

The initial temperature for the simulated annealing phase is set in the temperature parameter.

Cooling

At each iteration, the temperature is cooled by this parameter.

L

Number of neighbors to visit at each iteration.

The proposed algorithm consists of two nested cycles. Basically, it chooses two integer random numbers (i and j) in the range { 0,1, ⋯ , n − 1 } ; then exchanges job i and job j in the scheduling queue; finally it calculates the value of the objective function. If this value is lower than the value stored in BOF, the scheduling order is stored and the variable BOF is updated. Otherwise, if the value worsens the objective function, a probability is computed on the basis of which the worsening of the objective function is accepted.

The detailed algorithm is shown in

Let’s take an example of how the algorithm works. Let’s suppose we have the situation represented in

actual order | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
---|---|---|---|---|---|---|---|

Machine 0 | 10 | 40 | 80 | 30 | 50 | 15 | 70 |

Machine 1 | 8 | 45 | 87 | 22 | 52 | 13 | 75 |

Machine 2 | 12 | 30 | 85 | 20 | 50 | 18 | 48 |

tot_{p} | 30 | 115 | 252 | 72 | 152 | 46 | 193 |

d | 33 | 126.5 | 277.2 | 79.2 | 167.2 | 50.6 | 212.3 |

c | 30 | 145 | 397 | 469 | 621 | 667 | 860 |

late | 0 | 18.5 | 119.8 | 72 | 152 | 46 | 193 |

best order | 0 | 1 | 2 | 3 | 4 | 5 | 6 |

actual order | 0 | 1 | 4 | 3 | 2 | 5 | 6 |
---|---|---|---|---|---|---|---|

Machine 0 | 10 | 40 | 50 | 30 | 80 | 15 | 70 |

Machine 1 | 8 | 45 | 52 | 22 | 87 | 13 | 75 |

Machine 2 | 12 | 30 | 50 | 20 | 85 | 18 | 48 |

tot_{p} | 30 | 115 | 152 | 72 | 252 | 46 | 193 |

d | 33 | 126.5 | 167.2 | 79.2 | 277.2 | 50.6 | 212.3 |

c | 30 | 145 | 297 | 369 | 621 | 667 | 860 |

late | 0 | 18.5 | 129.8 | 72 | 252 | 46 | 193 |

best order | 0 | 1 | 2 | 3 | 4 | 5 | 6 |

In this case we have worsened the value of the objective function (the late work values for jobs 2 and 4 increased). In fact the best order queue is unchanged, but it remains evident that the completion time values:

· for the first two positions (job 0 and job 1) remained unchanged (respectively 30 and 145, being their positions unaltered);

· for positions 2 (now job 4) and 3 (job 3, unchanged) have been decreased by the same amount (100); this decrease is precisely equal to the difference d i f f = t o t p ( 4 ) − t o t p ( 2 ) of the initial scheme;

· for the jobs at positions 4 (now job 2), 5 (job 5, unchanged) and 6 (job 6, unchanged) remained the same.

For late work values (see 5.2) we have instead:

· l a t e has not changed for jobs 0 and 1 in the new scheduling queue;

· for job 4 (that occupies position 2 in the new queue) we have 0 < c − d = 297 − 167.2 = 129.8 ≤ t o t p = 152 ⇒ l a t e = c − d = 129.8 ;

· for job 3 we have c − d = 369 − 79.2 = 289.8 > t o t p = 72 ⇒ l a t e = t o t p = 72 ;

· for job 2 (at position 4 in the new scheduling queue) we have c − d = 621 − 277.2 = 343.8 > t o t p = 252 ⇒ l a t e = t o t p = 152 ;

· for jobs 5 and 6 the late values are unchanged.

In general, if we intend to exchange job i with job j ( i < j ):

· the values of late work will be unchanged for jobs in positions { 0,1, ⋯ , i − 1 } ;

· the following value is computed: d i f f = t o t p ( j ) − t o t p ( i ) ;

· for job in position i, the new late work value is calculated by comparing the quantity: d i f f + c ( i ) − d ( j ) with the due date value of process j;

· for jobs in position { i + 1, i + 2, ⋯ , j − 1 } the late work value is computed by comparing the quantity: d i f f + c ( k ) − d ( k ) with the due date value of process k, where k ∈ { i + 1, i + 2, ⋯ , j − 1 } ;

· for job in position j the new late work value is computed by comparing the quantity: d i f f + c ( j ) − d ( i ) with the due date value of process i;

· for jobs in position { j + 1, j + 2, ⋯ , n − 1 } the late work values are unchanged.

We can therefore compute the value of the objective function without having to build the tables for the new schedule queue, but simply by processing information that is already available without using memory quantities.

Before analyzing the computational tests, let us consider the (random) generator of the numbers that form the processing time values. For each job on each machine a random integer number is generated in the range [ 0,100 ] ∩ N which represents the processing time value of the job on the processor.

The seed of the random number generator is initialized to a different number depending on the system time. The due date time is instead calculated by adding the sum of the values of the processing time of the job on all the available machines, increased by a percentage given by input.

Data to be considered common to all tests are:

· increase percentage for the due date values: 10;

· number of neighbors to be explored: 10;

· number of iterations per problem: 15.

With regard to the number of neighbors to be explored, the above value was chosen because from an experimental check it was noted that for a smaller number (of neighbors) you get results close to the optimal one, while for a larger number you will keep (in the cases we tested) values that often coincide with the optimal one but, being computationally severe, they negatively affect the execution time of the approximation algorithm.

Some test cases are presented to verify the computational weight on the basis of the hypotheses made.

Guidance for understanding computational testing.

n: number of jobs to be scheduled;

m: number of machines used;

OF: optimum value of the objective function;

OF = SA: number of times that the result obtained with the approximated algorithm of simulated annealing coincides with the optimal one;

T_{min}: minimum time (in seconds) taken by the simulated annealing algorithm to find a result that coincided with the optimum;

T_{max}: maximum time (in seconds) taken by the simulated annealing algorithm to find a result that coincided with the optimum;

OF ≠ SA: number of times the result obtained by the approximated simulated annealing algorithm differs from the optimum one;

min: minimum value used by the simulated annealing algorithm to obtain a result that does not coincide with the optimum;

T: time (in seconds) taken by the simulated annealing algorithm to obtain a result that does not coincide with the optimum;

Δ%: average percentage difference.

n | m | OF | OF = SA | T_{min} (sec.) | T_{max} (sec.) | OF ≠ SA | min | T (sec.) | Δ% | max | T (sec.) | Δ% |
---|---|---|---|---|---|---|---|---|---|---|---|---|

10 | 3 | 1112.200 | 15 | 0.04 | 0.35 | 0 | -- | -- | -- | -- | -- | -- |

10 | 4 | 1312.600 | 13 | 0.06 | 0.33 | 2 | 1338.6 | 0.03 | 1.94 | 1353.6 | 0.01 | 3.02 |

10 | 5 | 2393.210 | 15 | 0.06 | 0.33 | 0 | -- | -- | -- | -- | -- | -- |

11 | 3 | 1170.000 | 13 | 0.05 | 0.64 | 2 | 1195.0 | 0.02 | 2.09 | 1195.0 | 0.08 | 2.09 |

11 | 4 | 1819.800 | 15 | 0.03 | 0.34 | 0 | -- | -- | -- | -- | -- | -- |

11 | 5 | 2433.900 | 15 | 0.05 | 0.31 | 0 | -- | -- | -- | -- | -- | -- |

In this paper we present a randomised algorithm using the heuristic technique of Simulated Annealing (SA)—which proved its positive result as a single-state optimization search algorithm for both discrete and continuous problems—for solving scheduling problems. The main goal behind our randomisation is to improve the solutions generated by classical job scheduling algorithms using SA to explore the search space in an efficient manner. The proposed hybrid algorithm were evaluated, and the experimental results show that it provides a performance enhancement in terms of best solutions and running time when compared to job scheduling and SA as stand-alone algorithms.

The followed solution method is of a non-deterministic type. It is based on the probability of obtaining an optimal solution in relation to the current situation of the objective function and the possible improvement due to a controlled movement in the space of the feasible solutions—linked to the concept of “temperature” of the algorithm—until it reaches the freezing point, that is an optimal acceptable one.

The choice made in our method prescinds from the initial solution and it rather takes into account the total computing time required, since it is more important to obtain an “almost” optimal feasible solution in a reasonable time rather than trying to arrive at the optimal solution in a theoretically unlimited time.

The authors declare no conflicts of interest regarding the publication of this paper.

Gallo, C. and Capozzi, V. (2019) A Simulated Annealing Algorithm for Scheduling Problems. Journal of Applied Mathematics and Physics, 7, 2579-2594. https://doi.org/10.4236/jamp.2019.711176