A Firefly Algorithm for the Mono-Processors Hybrid Flow Shop Problem

Nature-inspired swarm metaheuristics become one of the most powerful methods for optimization. In discrete optimization, the efficiency of an algorithm depends on how it is adapted to the problem. This paper aims to provide a discretization of the Firefly Algorithm (FF) for the scheduling of a specific manufacturing system, which is the mono processors two-stage hybrid flow shop (HFS). This kind of manufacturing system appears in several fields as the operating theatre scheduling problem. Results of proposed discrete firefly algorithm are compared to results of other methods found in the literature. Computational results with different numbers of fireflies and on a standard HFS benchmark of about 55 cases, generating about 1900 instances demonstrates that the proposed discretized metaheuristic reaches the best makespan. Keywords—Firefly algorithm; hybrid flow shop; metaheuristics; discrete optimization


I. INTRODUCTION
Scheduling is an essential decision making task.Short term scheduling consists into allocating resources as machines or persons to perform a set of jobs or tasks to minimize or maximize objective functions.In manufacturing systems, the scheduling objective may be minimization of makespan or Cmax, machine idle time, mean or total flow time and tardiness.Baker [1] addressed different types of scheduling environments in industries.Among them, the hybrid flow shop (HFS) or flexible flow shop problem.This environment, which is the generalization of a flow shop, is made of a set of manufacturing stages.At least one stage may contain several machines.The HFS has a variety of real-industrial applications including ceramic, operating theatre [2] and electronic.HSF scheduling problem was been the interest of many researchers since it was first proposed in [3].It has been demonstrated to be NP-hard in [4].Hence, exact methods cannot solve HFS problems.Several methods have been proposed so far to solve HFS scheduling problems.A hybrid heuristic algorithm was addressed to solve the multistage Hybrid Flow Shop problem [5].A heuristic based on simulated annealing (SA) technique was proposed in [6].The performance of heuristics in a flow shop scheduling with multiple processors was investigated in [7] where authors studied five heuristics for their performances on makespan and mean flow time criteria in a multiple processors HFS.A generic simulation model for the scheduling problem was detailed in [8] and the task priorities at each stage were established dynamically in order to make easier the performance evaluation of job dispatching priority strategies, concerning the makespan and mean flow time as well as other criteria like average queue length and average resource utilization.Botta-Genoulaz [9] lectured the time windowed multistage version of the problem with identical parallel recourses, when tasks are subject to precedence constraints.She investigated six heuristics to solve minimization of lateness.Hybridation of the Tabu search (TS) with another approach was presented in [10].Authors considered the manufacturing of concrete blocks in a building industry factory as a hybrid flow shop with the purpose to minimize makespan.With the same purpose, a branch-and-bound algorithm was addressed in [11].Several heuristics were studied to schedule multiprocessor tasks in the two-stage extension of the same problem in order to minimize makespan as simulating analytics (SA) and TS [12].In [13] and with recirculation to minimize the weighted number of tardy tasks, authors compare a greedy algorithm with a genetic algorithm (GA) on solving a three-stage HFS scheduling problem.A GA has been applied to solve a more realistic problem with sequence dependent set-up times, numerous manufacturing stages with unrelated parallel machines at each stage and machine eligibility [15].A hybrid constructive Genetic algorithm was made in [17], advanced GAs with some new machine assignment instructions in [19] and an efficient GA in [22].Others bio-inspired metaheuristics as an ant colony optimization (ACO) in [16] were studied to solve the HFS scheduling problems.A bat algorithm was adapted in [14].An effective parallel greedy algorithm (PGA) was addressed in [18] and a particle swarm optimization (PSO) algorithm was studied to solve the flexible flow shop scheduling problems [20].The PSO was also compared to a bottleneck heuristic to solve the HFS problems [23].A hybrid artificial neural network (ANN) simulation approach is suggested for solving multi-attribute combinatorial dispatching (MACD) decision problem for scheduling a with multiple processors hybrid flow shop [21].
One can notice that most of papers in HFS literature were addressed to flexible flow shop with multi-processors tasks [55], [56].In the other hand, some few manuscripts studied the mono processors HSF [24]- [27].The standard hybrid flow shop or the HSF with mono-processors tasks can be considered as a typical example of scheduling problem and has several applications.One can quote, authors in [2], [28]- [30] that define a surgeries scheduling problem as a standard hybrid flow shop of two to three stage that are induction stage, www.ijacsa.thesai.orgoperating rooms stage and post anesthesia care unit stage.In [31] authors studied an energy aware multi-objective optimization that has a mono-processor tasks flexible flow shop configuration.
In the present paper, the firefly metaheuristic is discretised and adapted to the mono-processor hybrid flow shop problem.For that, in the second section the fireflies in the nature are described.We detailed the firefly algorithm giving a simple pseudo-code.In the third section, the hybrid flow shop problem (HFS) is presented and its notation according to the literature.In the fourth section, an adaptation of the firefly algorithm to the HFS problem and a discretization of fireflies are presented.Also, we describe briefly the particles swarm optimization for the same problem in order to compare it later.In the last section, the results of the discrete firefly algorithm and other implanted algorithms are discussed and compared on a benchmark using improvement rate and average percentage deviation from the lower bound.Finally, we give conclusion and perspectives.

II. FIREFLY METAHEURISTIC
In the section below, the firefly algorithm and its principles are described.

A. Inspiration
Fireflies, as a spice of Lampyridae are small insects with wings talented of producing a cold light flashes in order to attract mates.Their mechanism is supposed to slowly charges until the convinced threshold is obtained, at which they set free the power in the form of light, then the process repeats [32] Firefly algorithm that was first proposed by Yang [33] was inspired by the fireflies mutual attraction and the light decreasing over the distance rather than by the fireflies light flashing phenomenon.Algorithm considers what each firefly observes at the point of its position, when trying to move to a greater light-source.

B. Algorithm
The Firefly Algorithm is one of the recent nature-inspired metaheuristics developed by the author [33]- [38].One can find limited articles concerning essentially continuous firefly algorithm [39]- [46].Continuous firefly algorithm was validated on functions optimization in [36].A resolution of chaos with firefly can be found in [47].A hybridisation of the algorithm with genetic was done in [49].The bi-objective version was proposed in [48].The first discrete version was adapted to permutation problem in [50] where authors studied flowshop problem using a binary coding of solution and a probability formula for discretization.We can also find other discretization for economic problem such as [32], [51]- [52].
The main firefly algorithm distinctive feature is that it simulates an independent and parallel optimization strategy, where a population or swarm, in each iteration, has generated a number of fireflies.Each one works roughly independently and as a result, the metaheuristic will converge quickly with the fireflies aggregating closely to the optimal solution.The Firefly Algorithm was based on the idealized fireflies behaviour of flashing characteristics.These flashing characteristics were idealized as the three rules below: 1) All fireflies are from the same gender so that one firefly is attracted to another despite their genders.
2) The light intensity or brightness of a firefly is determined by the landscape of the objective function to be optimized.
3) Brightness is proportional to their attractiveness, thus for any two flashing fireflies, the less brighter one will move towards the brighter one.The brightness of both will decrease as their distance increases.If there is not the brightest one than a firefly moves randomly.
According to these three hypotheses, pseudo-code of the Firefly Algorithm (FF) may seem as follows: There are four important principles in the Firefly Algorithm: 1) Light Intensity In the simplest situation for minimum optimization problems, the brightness I of a firefly at a particular location x can be chosen as I(x) ∝ 1/f(x).

2) Attractiveness
The principal form of attractiveness function in the firefly optimization can be any monotonically decreasing function such as the generalized form in (1): r is the distance between positions x i and x j of two fireflies i and j  is the attractiveness at r = 0 and γ is a light absorption factor.www.ijacsa.thesai.org

3) Distance
The distance between two positions x i and x j of two fireflies i and j can be the Cartesian distance: Where x i,k is the k th part of the i th firefly.

4) Movement
The attraction of a firefly i toward another brighter firefly j, is determined by where the first and second terms are due to the attraction while the third term is randomization with α being the randomization parameter and "rand" is a random number generator uniformly distributed in [0, 1].

III. TWO STAGE HYBRID FLOW SHOP PROBLEM (HFS)
The Hybrid flow shop scheduling problem will be described in this section.

A. Presentation
A Hybrid Flow Shop (HFS) also called flexible flow shop is a structure composed of a set of stages, where each stage combines one or more parallel machines.The different tasks visit the stages in the same sequence.On each stage, a job is treated by only one machine.A machine can treat only one job at once.Between each stage, the jobs can wait or not in limited or unlimited buffers.
Moreover, all jobs are assumed to be available at the system entry at date 0 (their release date).
Scheduling in the HFS consists to choose an assignment of the tasks to the range of resources at the various steps and an appropriate sequencing.The purpose is the optimization of one criterion or several performance criteria in case of multipurpose optimization.One can quote the max flow time abbreviated as Fmax, the completion time of the last job on the last stage also called Makespan or Cmax, and due date related purpose.

B. Notation
Number of stages scheduled is M. Number of tasks scheduled is N. l k is the number of machines in stage k.
Fig. 1 is an example of a hybrid flow shop with 2 stages and 3 machines on the first stage and 2 machines on the second one.One buffer of infinite capacity is incorporated between stages of the system.The processing time of job i in stage j if machines are identical is noted t ij .

C. Application
One can quote as the example of surgeries scheduling in an operating theatre (Fig. 2).

A. Solution Notation
An integer significant solution coding is adapted to the HSF scheduling.The coding contains two parts: the sequence part s and the assignments part a as one can find in (4).

B. Distance
In this work and since it is a discrete version the distance is replaced by Hamming's distance.The Hamming distance is defined as the number of non-corresponding elements in the sequence or in the assignments (5).

C. Random Movement and Other Parameters
The movement of a firefly i to another j follows (3) cited earlier.For the alpha coefficient, we choose α=N for the sequence part of the firefly and α=lk k= ..M for the assignments part of the firefly.
The random movement of the best firefly uses a neighborhood system based on both sequence permutation and assignment change.

D. Fireflies Discretization
When the firefly i moves toward firefly j, the position of To correct sequence, we sort jobs of s per their s' values.To correct assignments a, we adjust a' to unsigned integers in the domain 0 . .l k -1.

E. Particle Swarm Optimization for HFS Problem
In this sub-section, we describe briefly the particles swarm optimization to compare it with the firefly algorithm.
The Particle Swarm Optimization algorithm (PSO) [53] is initialized with a population of random solutions which is similar in all the evolutionary algorithms.Each individual solution flies in the problem space with a velocity which is adjusted depending on the experiences of the individual and the population The pseudo code of PSO is given in Algorithm 2. In this study, we retain the principles below:

Procedure
Fitness.The fitness can be simply the objective function.
Velocity.We keep the equation of velocity v i of a solution p i as shown in (7).
Position.The new position is calculated by (8).
We use the same codification and discretization principles as our Firefly algorithm.We add velocity constriction.

A. Hybrid Flow Shop Data
As a typical sample for experimental comparison, the choice was directed on mono processors two stages hybrid flow shop with related machines that admits that the processing duration of a task do not depend on machine in a stage.A buffer of infinite capacity is integrated between the two stages for each machine.Moreover N tasks are assumed to be available at the manufacturing shop entrance.The system has l 1 recourses in the stage one and l 2 in the second one.

Three categories of instances of two-stage HFS have been randomly generated:
 Category A: These samples were generated in a way similar as in [24].The number of tasks n is taken from the set{20, 30, 40, 50 , 100}.The numbers of resources (l1, l2) are (2, 2), (2, 4) and (4, 2).The processing durations noted 2:4, 4:2, 4:4 are drawn randomly from a discrete uniform distribution either on [1,40] or [1,20].These instances characteristics are combined to acquire nine different problem samples for each unchanging N.For each combination, 20 instances were produced which results in 900 instances for the Category A. The category A represents a diversified mix of shop and size setting.
 Category B: It is produced in the same way as in [25].
The number of resources l 1 and l 2 were drawn randomly from the discrete uniform distribution on [2,6].The processing durations on stage j were generated randomly from a discrete uniform distribution on [1, 5*l j ](j= 1, 2).The number of task N was taken equal to 20, 30, 40, 50 and 100.For each fixed N, 50 instances were generated.Hence, Category B contains a total number of 250 instances.
 Category C: In this set, the processing durations on both stages were drawn randomly from the discrete uniform distribution on [1,20] [25].Their 250 instances were generated in a similar way as those of category B. www.ijacsa.thesai.org For the set C, the workloads are typically unbalanced while for the set B, the workloads at the two stages lean to be well balanced.The population size of particles or fireflies is set to 10.
The proposed algorithms were implemented in C++ 32 on an Intel Core 2 Duo 2,53 Giga Hz with aRAM capacity of 6 Giga Byte.If any optimal scheduling was found within the maximum CPU time limit of 15 seconds, the exploration is exited and the best scheduling and it evaluations are output.In order to get good comparison, the choice of the limit criteria lies on the computer setting similarity with these in [28].

B. Comparison Criteria
In order to compare the proposed discretized algorithms, the measures below can assess their efficiencies: 1) Lower bound LB.Lower Bound indicates the lower makespan can be reached for the HFS scheduling instance.The two stage hybrid flow shop LB retained in this work were presented first time in [24] = ma ∑ ∑ Where spt(l 1 ) is the minimum sum of completion times, on Stage 2, of the l 1 tasks whose processing times on the second stage are the shortest.

2) Average Percentage Deviation (APD).
The deviation of a scheduling makespan from the LB is specified in (10): 3) Improvement Rate.Improvement of the final best scheduling from the initial best population is given in (11): 4) Others.We use two other analysis measures:  TGB that is the average Time to Get the global Best (optimum) when Average Percentage Deviation =0.
 NS that is the number of instances for which optimality was proved (Number of Solved).In [28], authors used UnSolved instances (US) factor which is the number of instances not solved.

C. Results and Discussion
First, we compare the firefly algorithms with Particle Swarm Optimization.Table I shows Average Deviations, average improvements and Makespan, min and max criteria values.We observe that Firefly algorithm solved to optimally all of instances in 86.67% of the problems (39 per 45).The most of Firefly Algorithm unsolved instances are with unbalanced workload from classes where there are less resources in the first stage.The problems are easier for 2x2 and 4x2 cases.
We try to compare our results (Table II) with those found in:  [24] using Tabu search.
 [25] using Branch and Bound method (CPU time limit for the Backward or Forward problems was set equal to 600s.)  [28] using Climbing Depth-bounded Discrepancy Search (CDDS 2 ) (maximum time limit was 15s and the number of instances for each class was 20).
The experiments on the first Category A as revealed in Table II match the previous conclusion and lend further confirmation.Remarkably, the proposed firefly metaheuristic provides the optimum makespans.It doesn't deviate from lower bound in most of cases and their worst deviation are less than 0.1 while the average APD of all instances for respectively tabu search and B&B algorithm as examples are 0.51 and 0.28.Indeed, we observe from Table III when comparing numbers of solved instances and times to get optimum that FF algorithm yields optimal or very near optimal solutions in most Instances (887 per 900) in 0.0331 second while PSO yields optimal solution in only 499 instances within 75.38 hs and respectively CDDS2 and CCDSL yield optimal solution in 829 and 638 instances.
The worst firefly TGB times can be noticed in the 2x4 problems but do not exceed 40.63 hs while PSO ones reach 86.29 and 1237 hs.
In order to investigate the method on other workload categories, 50 instances were generated for each case either on set B or C. The results of sets B and C for N from 20 to 100 are represented in Table IV.The global efficiency of the discretized firefly algorithm is corroborated by the computational results that were reported on the sets B and C. Table IV approves that the FF algorithm with only 10 fireflies can give an improvement from 11.74% to 25.51% and a deviation from 0.07 % to 0 face to PSO improvement which cannot exceed 20.74% and PSO deviation that can reach 0.43%.
The most striking result to emerge from Table V is that 63.2 % of the Set B (balanced instances) and 82.2 % of the Set C (unbalanced instances) were significantly solved to optimality.Face to only 12.8% of set B and 36 % of set C solved by PSO.The average firefly algorithm TGB is only 131 hundredth second while it is exceed 166 hundredth second by particles swarm algorithm.And even if the B&B has more solved instances especially for unbalanced hybrid flow shops, our Firefly Algorithm outperforms it in term of deviation in all of instances.Furthermore, the deviation from the best makespan is approximately null.Overall, our algorithm produced proven optimal solutions.www.ijacsa.thesai.org
) www.ijacsa.thesai.orgfirefly i changes from a binary number x to a real number x'

TABLE I .
SET A, AVERAGE IMPROVEMENT, APD, CMAX, MIN AND MAX CMAX OF DIFFERENT METHODS 56 www.ijacsa.thesai.org

TABLE II .
SET A, COMPARISON OF AVERAGE DEVIATION OF DIFFERENT METHODS* * "NA" means that the value is not available.www.ijacsa.thesai.org

TABLE III .
SET A, COMPARISON OF THE AVERAGE TGB AND THE NUMBER OF SOLVED INSTANCES

TABLE IV .
SET B AND C. AVERAGE CRITERIA OF DIFFERENT METHODS WITH 10 PARTICLES