A study of different metaheuristics to solve the urban transit crew scheduling problem

This paper explores different local search methods associated with the metaheuristic Iterated Local Search (ILS) to solve the Crew Scheduling Problem (CSP) of a Public Transportation System. The results from ILS were compared to those obtained in a previous work from the same authors that used the Variable Neighborhood Search (VNS). Initially, both metaheuristics were implemented using, as local search, the classical First Improvement Method, performing “guided” reallocation and exchange of crew tasks. The guided reallocation/exchange replaces random components from the classical method by searching the best position to insert the task. Further, the Very Large-scale Neighborhood Search (VLNS) technique was used as a local search procedure in the metaheuristics. This technique has substantially more neighbors than the 2-opt neighborhoods, since it performs a chain exchange of tasks from different crews. Both versions of metaheuristics were applied to a set of real data from a company operating in the city of Belo Horizonte, producing more economical schedules than those adopted by the company. The results are presented and discussed in this work. www.journal-of-transport-literature.org JTL|RELIT ISSN 2238-1031 B T P S Brazilian Transportation Planning Society


Introduction
Currently, companies in all sectors of our economy are interested in technological innovations as a possibility to improve their performances.However, companies in the Brazilian public transportation system make little use of optimization software to schedule their equipment and workers, that is, vehicles and crews.This normally happens because the use of optimization models requires gathering of precise data, compliance with specified rules and flexibility of the system operation, among other practices still not very disseminated in the sector.On the other hand, in more demanding systems such as air transportation, the use of optimization models to schedule their crews is almost mandatory.Besides enabling the generation of possible schedules, the models can decrease the costs with crews, which in the case of air transportation, are very high.Thus, the study and implementation of effective methods to solve the problem of scheduling the crews in the public transport system, as well as the dissemination of the use of the software, are important tasks not only to reduce the operational costs but also to increase the use of computational support systems by the management of companies which work in this sector.
The task of developing a programming of an event is an activity that gradually becomes more and more difficult as the quantity of items to be programmed and the restrictions of the problem both increase.Likewise, the scheduling of the urban transport crews becomes a problem gradually harder to be solved due to the labor and operational constraints involved.
Thus, an efficient scheduling must have as minimum cost as possible, increasing productivity and the satisfaction of employees and users of the system.
In this paper the crew scheduling problem of an urban bus company is modeled and solved through the ILS metaheuristic, exploring two different local search procedures.The most significant cost component of a transportation company is due to crew remuneration.
Therefore, defining a crew scheduling with minimal cost leads to a great economy for the company.The crew schedule is built from a previously defined vehicle scheduling.So, once vehicle schedule is previously defined, operational rules and labor laws are input data to the problem.Computational tests were performed with real data from a week of operation and the results are presented in this work.This work is divided as follows: in the following section the CSP tackled in this paper is presented.In Section 2 the most important works about the problem are presented.In Section 3, the local search procedures are presented, in detail.In Section 4 it is described how metaheuristic ILS was implemented to solve the problem.Section 5 shows the results and, in Section 6, these results are discussed.The last section contains the conclusions of this work.

The Crew Scheduling Problem
The Crew Scheduling Problem (CSP) consists in determining the minimum number of crews to cover entirely a vehicle schedule previously made.The solution of this problem involves sequencing drivers' activities in order to generate a set of work duties, that is, the crew scheduling.The duties must meet several requirements due to labor laws, union agreements and also the operational rules of a company.This way, the problem becomes NP-hard, for which there has been no polynomial algorithm to obtain its optimal solutions so far (Fischetti et al., 1987).
A single crew scheduling is made up of a set of tasks and it is called a duty, or crew daily duty.A task is a set of trips, of the same vehicle, which must be performed by the same crew.
Each task has deterministic starting and ending times, and also starting and ending point.The set of all tasks, provided by vehicle scheduling, must be assigned to a set of duties with minimum cost.The set of all duties composes a complete crew scheduling, or for short, a crew scheduling.Duties can be classified into two groups: single duty or split duty.In the single duty the tasks are done straight and the time intervals between the tasks are less than a given value.In this case, the idle time between tasks is counted for remuneration.If a single interval longer than the given value occurs, the duty is classified as split duty.This kind of duty is associated to busses operating only during the peaks hours existing on workdays timetable and the interval between two pieces of duty is not counted for remuneration.On the other hand, split duties must appear in reduced amount in the solution, limited to 20% of the total of duties.
In order to assign the tasks and build the duties, several operational constraints and labor rules must be taken into account.In this case, the following restrictions were considered: i) each task must be assigned to one duty; ii) each duty is a sequence of tasks that can be performed by a single crew, without overlapping; iii) the normal work time of a duty is of 6 hours and 40 minutes; iv) the single duties must have a break of at least 20 minutes for rest and meal; v) the duties cannot do more than two hours overtime; vi) the time interval between the end of a duty and its start on the next day must have at least 11 hours; vii) the change of crews, during operation, can happen only at predetermined places and times; viii) a duty can do a maximum number of vehicle changes during the day.
The main goal of a solution to the problem is to reduce the total number of duties, and the total of overtime payment.At the same time, the number of split duties must be kept to a lower level, being limited to 20% of the number of duties.This problem can be placed as a multiobjective optimization, since it brings two conflicting objectives: to minimize the number of duties and the amount of overtime payment.In this work the cost function for the CSP was defined as a linear combination of the fixed cost, representing crew wage, and variable costs, given by overtime payment and the number of split duties.Therefore, the CSP is treated as a mono objective minimization, while satisfying all the constraints mentioned above.

Literature Review
The most widely used approach to deal with this problem models it as a set covering or a set partitioning problem.The strategy of column generation is largely used to solve the problem, as can be seen in the works of Smith and Wren (1988), Desrochers andSoumis (1989), Fores et al. (1999) and Barnhart et al. (1998).However, exact models are limited in practical applications, since they are unable to solve very large problems.So, it is necessary to use heuristic methods to solve problems that appear in real life, which are large.
One of the pioneer groups in this area, named Scheduling and Constraint Management Group of Leeds University, carried out a set of heuristic implementations using Genetic Algorithms (Kwan et al., 1999;Li and Kwan, 2003), Tabu Search (Shen and Kwan, 2001), Ant System (Forsyth and Wren, 1997) among others.The models developed by this group are widely used in the United Kingdom to build crew scheduling as well as the scheduling of the operational fleet (Wren, 2004).
Although the Crew Scheduling Problem has been widely studied and applied in more developed countries, its solving techniques are not disseminated and rarely applied to the Brazilian reality.Partially, this happens because the companies do not have the necessary input data and organization, and also because there is a lack of models and commercial systems that represent the Brazilian operational reality.
Among the studies concerning the CSP solved in the Brazilian reality, we can highlight metaheuristic models that use Simulated Annealing, Tabu Search, GRASP and VNS (Silva et al., 2002;Soares et al., 2006;Souza et al., 2004;Reis and Silva 2012).These models have been tested with data of companies operating in Brazilian public transport system and the results show that there are great possibilities to reduce costs in relation to the solutions adopted by the companies.On the other hand, new rules for the problem and modern search techniques have appeared in the past few years, which can be employed to solve this problem.
Thus, this work explores the use of a recent local search technique based on a graph representation of the problem and the use of network flow algorithms to carry out more complex local search than those inherent to the classic local search procedures.
The local search technique named Very Large-scale Neighborhood Search (VLNS) (Ahuja, 2000) was first employed to solve CSP by Silva and Cunha (2010).In this work, VLNS was used as local search procedure of GRASP metaheuristic.It was observed by the authors that the performance of VLNS search is strongly dependent on the initial solution.Therefore, further works propose to adopt single-solution-based metaheuristics that make periodical perturbations in the current solution through different movements.In this class of metaheuristics, the Variable Neighborhood Search (VNS) (Mladenović and Hansen, 1997) and Iterated Local Search (ILS) (Lourenço et al., 2010) can be pointed out.The VNS metaheuristic consists in exploring the space of solutions through systematic changes of neighborhood structures, while the main idea of ILS is iteratively to perturb the obtained local optimal and to apply a local search to this perturbed solution.The metaheuristic VNS was already implemented making use of VLNS to solve the CSP.The details and results can be found in the work from Reis and Silva (2012).
In this context, this work aims to solve the Crew Scheduling Problem using the metaheuristic ILS combined with the VLNS search technique.In order to verify the efficiency of the proposed combinations, the ILS was also implemented in their classical version, using First Improvement Method as local search.Both ILS versions were tested with real data from a company that operates in a public transportation system, and the results were compared with the results obtained by VNS using the code developed by Reis and Silva (2012).

Local Search Procedures
The ILS metaheuristic was implemented in the classical version, which uses the First Improvement Method as local search.The ILS-VLNS, version uses the Very Large-scale Neighborhood Search as local search procedure.Both versions from ILS were tested by solving large scale problems of Brazilian reality.

Evaluation Function
The cost Cs associated with a solution s of the CSP is computed by means of a linear combination of the fixed cost and the variable costs.The fixed cost represents the wage of a crew, and the variable cost is the total of overtime payment.Finally, the split duty crew is weighted so that the user may have a control on the number of duties of this type into the solution.The final expression for the cost of a solution is: (1) In Expression (1), Fix_Cost represent the fixed remuneration of a crew, w1 is the weight per minutes of overtime and overtimei is the total of overtime into duty i, expressed in minutes.
And w2 is the weight for split duty and split_dutyi is equals 1 if crew i is a split duty and 0 otherwise.The weight w2 is calibrated to control the number of split duties in the solution, since this kind of duty is not desirable in large amount.

Initial Solution
The initial solution was built according to the manual procedure, which can be seen as a greedy method of tasks allocation.In the procedure, the first duty is initialized with the first task of a bus.The procedure goes on allocating the next task from the same bus which does not superpose the previous one and that generates the shortest idle time.The duty is completed as soon as it presents overtime and does not exceed maximum working time allowed.This procedure is repeated while there is a task not assigned.Algorithm 1 presents the logic employed to build an initial solution for the CSP.from neighbor to neighbor according to the adopted neighborhood structure, keeping the best solution visited during the procedure.

Relocation-Exchange neighborhood structure
Once the maximum number of tasks involved in a move is defined, it is necessary to establish different kinds of moves which characterize a neighbor of a solution.Two kinds of moves were adopted: task relocation and task exchange, both between two duties and without superposing.These moves are performed to find the best neighbor of a current solution.As an example, for a given k ≤ 3, consider two duties i and j, randomly obtained.Then, k consecutive tasks are randomly picked out of duty i to be introduced into duty j.Thus, one of the following situations may occur: 1) the k tasks of i can be introduced in j, without the necessity of removing any task of j.In this case the movement is accepted and the new solution will be evaluated.
2) The introduction of k tasks in j demands the removal of one or more tasks from this duty.In this case, if the tasks removed from j can be inserted in duty i, without any superposing with the remaining tasks in i, the movement is accepted, otherwise it is rejected.In both cases, the changes are considered if and only if the resulting duties are feasible, i.e. if the duties do not violate any constraints of the problem.
In this paper, the classical descend method called Random Descent Method (Mladenović and Hansen, 1997) was adopted, which besides avoiding exhaustive exploitation of the neighborhood, analyzes the duties in a random order, renewed at each iteration.It prevents the first duties of the schedule from present higher quality in detriment to the quality of the last duties.

Very Large-scale Neighborhood Search to solve the CSP
A critical aspect in neighborhood search algorithms is the choice of the neighborhood structure, that is, the way it is defined.This choice largely defines whether the search strategy will lead to solutions of good quality or not.In general, the larger the neighborhood the better the quality of the local optimal solution shall be.However, large-scale neighborhoods require a long research time.For this reason, a larger neighborhood does not imply in a better heuristic, unless the neighborhood is explored efficiently.
Such algorithms are called Very Large-scale Neighborhood Search Methods, applicable to Set Partitioning Problems -SPP (Ahuja et al., 2000).These algorithms enable to explore very large neighborhoods, while keeping the processing time at very low levels.One way to achieve such efficiency is using network flow algorithms to enumerate implicitly a neighborhood, in order to find better solutions.
A cyclic exchange may be defined as a    The classical neighborhood search methods are based on relocation and two-exchange moves of elements between the two subsets to which they belong.Observe that the neighborhood of cyclic exchange and path exchange contemplates the two-exchange and still explore an infinity of other solutions unreachable by the classical relocation and two-exchange moves.
Therefore, it is expected that the local optimal solutions obtained by multiple exchanges are, on average, superior to those obtained by two-exchange moves.However, once the size of the neighborhood in multiple exchanges increases exponentially with the size of the problem, it is necessary to have an efficient method to find a solution of lower cost in the neighborhood.
This problem can be overcome using the concept of improvement graph and network flow algorithms to explore efficiently a given neighborhood.
An improvement graph for a neighborhood with multiple exchanges is defined for a feasible problem.This is an efficient way to search solutions that improve the objective function through multiple exchange movements.Therefore it is necessary to find valid cycles in the improvement graph G(S).A well known modified label-correcting algorithm that finds the minimum path from a given node source to all others nodes of the network was implemented to identify a valid cycle in this work.More details about this algorithm can be found in Ahuja et al. (1993).
The idea of VLNS-type algorithms consists in constructing a graph G(S) for a given solution

Metaheuristic ILS to solve the CSP
The ILS is based on the idea that a local search procedure can be improved generating new initial solution, perturbing the current solution.In order to use an ILS algorithm, four components are needed: a) Generate_Initial_Solution -procedure that generates an initial solution s0 to the problem; b) Local_Search -procedure that reaches a local optimal solution, called s'', which is compared to the best current solution s; c) Perturbation -procedure that modifies the current solution s reaching to an intermediary solution s' and d) Acceptance_Criterion -procedure that decides from which solution the next perturbation will be applied.The Algorithm 3 shows the Basic ILS's pseudo-code.

Perturbation and Acceptance Criterion
The perturbation procedure applied to the current solution in ILS metaheuristic was implemented following the Relocation-Exchange neighborhood previously presented, which depends on the value of k.The same function, Relocation-Exchange, was adopted to perform both the local search and the perturbation procedure.In order to avoid the ILS entering a loop visiting the same neighbors, the perturbation is executed with the number of tasks to be relocated larger than the number of tasks considered into the local search procedure.
Into the perturbation procedure, in line 4 from Algorithm 3, the value of k is at least one unit larger than that one used into the Local_Search() on the next line.The parameter k is incremented as soon as the local search fails looking for a better solution.When it reaches a maximum value kmax, previously defined, k receives the value 2 and the procedure continues until the termination condition is reached.The value for k used by the local search is always equal to 1.
In this implementation, a solution is accepted if and only if its cost is less than the cost of the best solution previously found.Moreover, no infeasible solution is accepted during the process. Algorithm

Computational Results
The algorithms were tested by solving a set of seven problems concerning one week of work of a Brazilian company that operates in the public transportations system in the city of Belo Horizonte.The metaheuristics were implemented in C/C++ language and the tests were carried out in a PC with an Intel Core i7 processor and 8 GB RAM.The metaheuristics were performed for one hour and 10 runs were done for each problem.Despite the VNS being tested in a previous work, Reis and Silva (2012), this metaheuristic was once again executed, aiming to guarantee a best comparison with the ILS.
Table 1 contains the characteristics of the solutions adopted by the company and that are used as reference for the solutions obtained.In the following Tables, the line "OT" refers to the total of overtime (hours and minutes), "Crews" refers to the total of duties (units), "SD" refers to the total of split duties contained in the solution (units), "St.Dev." refers to the standard deviation and "EF" refers to the total cost of a solution, given by Expression (1).The value of EF can be seen as the monetary cost of a solution implemented in practice, since the weights represent the cost per unit of each component of the Expression (1).
The set of tests were performed taking into account the following weights: 10,000 for Fix_Cost, 4 for w1, with the overtime expressed in minutes.The weight w2, which refers to the split duties, received the value 600.These weights were empirically obtained aiming to produce solutions with few drivers, a low amount of overtime hours and the number of split duties within the limit set by the company.
The weights used in the metaheuristics were applied to compute the cost from solutions adopted by the company.The main goal of the company is to reduce the total number of duties, and the total of overtime.At the same time, the number of split duties must be kept to a lower level, being limited to 20% of the number of duties and the crews could not do more than one vehicle change during the operation.Thus, it was possible to compare the solutions produced by the metaheuristics with those adopted by the company.Furthermore, the averages of all solutions obtained are presented, the AVG EF, as well as the average deviation given by (AVG EF -Best EF)/AVG EF.As much lower this percentage is, the more robust the method is (Talbi, 2009).That is, the difference among several solutions found, which count on a random factor, is not significant and the heuristic tends to produce very similar solutions.The improvements were calculated using Expression (2).Thus, negative values mean that the result obtained by the company is better than the one achieved by the metaheuristic.

Solutions obtained by VNS
Although the VNS heuristic had been previously tested in Reis and Silva (2012), in this paper its results had a little modification in relation to the first test, due to the better configuration of the PC used.Table 2 gives details of the best solutions for the Classical VNS method, and Table 3 gives the characteristics of the best solution provided by VNS-VLNS.9,297.32 12,713.04 7,828.61 11,706.13 8,213.34 13,484.30 6,074.10Table 4 contains a summary of the improvements reached by VNS solutions in relation to the solution adopted by the company (Table 1), calculated using Expression (2).The improvements are presented for each component from EF, and for its final value.Analyzing the final value, it is possible to conclude that the Classical VNS has more economical solutions than the VNS-VLNS.That occurs because normally the Classical VNS uses a larger number of split duties than VNS-VLNS does, then the Classical VNS gets a lower amount of overtime and crews.

Solutions obtained by ILS
The ILS metaheuristic generated results similar to those produced by VNS, as shown in Tables 5 and 6.However, comparing the Classical ILS and ILS-VLNS, the best solutions were obtained by the second method, according to the data presented in Table 7.In this case, ILS-VLNS produced solutions that usually have a lower number of crews and split duties, keeping the total of overtime at the same level as Classical ILS.Therefore, the value of EF was better for all solutions, losing only on Saturday.

Analysis of Results
The results obtained in these tests have a fewer number of split duties than those presented by Reis and Silva (2012), mainly in the case of the Classical versions.As in the previous work, the use of VLNS as local search produced solutions with fewer split duties.This behavior is observed both in VNS and in ILS metaheuristic.The algorithms produced solutions with similar characteristics and costs, despite the random features.On the order hand, metaheuristics were able to produce solutions with lower cost than the solutions adopted by the company.
Comparing the two versions from ILS, the ILS-VLNS produced better solutions, according to EF, and yet maintained the number of split duties lower than the Classical ILS.This kind of solutions is the most desirable in practice.
The comparison between the two metaheuristics, in their best version, shows that the difference in the EF value is insignificant.In this case, ILS-VLNS produces solutions with the smallest number of split duties, therefore it is the most indicated to be adopted by the company, as can be seen below.

Comparing VNS versus ILS performance
Although the Classical VNS produced better improvements than ILS-VLNS, the difference between them is very small, being insignificant in terms of percentages.The values in Table 8 were obtained by Expression (3) with data from respective rows.Negative values show the superiority of the Classical VNS over ILS-VLNS.By analyzing these results, it is possible to see that the difference between the Best EF for the two methods is at most 1.26% for workdays and 3.38% for the weekend.Hence, it is clear that both methods are competitive and generate close solutions for this problem.The difference between them concerns the total overtime for the workdays, which is lower for the Classical VNS.However, an important operational characteristic for the problem is the total number of split duties.Looking at this item, ILS-VLNS is superior in six out of seven days (except on Tuesday).The average deviation of split duties on workdays is 1.58 for ILS-VLNS against 7.4 for Classical VNS.An elevated number of split duties makes it hard to elaborate the monthly crew scheduling, thus this kind of duty is avoided by the company.

Statistical Inferences
Based on the results of each instance, the average, the standard deviation, the upper and lower bounds for different confidence intervals were computed.The confidence interval gives the range of values where a new result will be inside within a percentage of confidence.They were obtained using the Expression (4).
In the expression (4), we have: (1-α) = 100(1-α)% of confidence;  ̅ is the average of each problem (each day); t(n-1,α/2) is the value obtained on the t-Student distribution table, according to the n-1 degree of freedom and the value α/2 is the desired confidence degree; S is the Standard Deviation of the solutions and n is the sample length.The t-Student distribution was used because the variance and the mean of the results are unknown.

Figure 2 -
Figure 2 -Path exchange (t6-t8) before (a) and after the exchange (b) on the Lower Bounds values for the three different confidence intervals (CI), it is possible to infer that the VNS produces best lower bounds in its Classical version and the best lower bounds of ILS are associated with its VLNS version, despite the CI, and moreover, comparing Classical VNS with ILS-VLNS, the Classical VNS still has the best lower bounds to the problem.Figures3 and 4present a graphic comparison of lower and upper bounds, for 95% confidence interval, among the heuristics of four problems: Monday, Tuesday, Thursday and Friday.Analyzing the graphic, it is possible to reinforce the statements above.

Figure 3 -
Figure 3 -Lower bounds considering 95% confidence interval of Monday and Tuesday problems S, and finding a valid cycle W in G(S) which provides a better neighbor solution of S. After making the cyclic exchange, inherent to the valid cycle, the graph is updated and a new valid cycle is sought.The search ends when the improvement graph does not present any valid cycle.The pseudo-code presented in Algorithm 2 summarizes the method.
Algorithm 2 -Pseudo-code of VLNS Procedure Procedure VLNS (solution s) begin 1. construct the improvement graph G(s) for s;

4 -Upper bounds considering 95% confidence interval of Thursday and Friday problems
ConclusionThis paper presents an implementation of ILS metaheuristic to solve the Crew Scheduling Problem of a Public Transportation System.Initially, the ILS was implemented using, as local search, the classical First Improvement method.Next, the Very Large-scale Neighborhood Search (VLNS) technique was used as local search procedure in the metaheuristics.The two versions were tested with real data from a Brazilian company that operates in the city of Belo Horizonte, Brazil, and the results were compared with those obtained by metaheuristic VNS in the classical version, and also using the VLNS local search technique.Based on the analysis of results, it is possible to state that the use of the VLNS technique was able to outperform the classical First Improvement implementation in the ILS.It is important to point out that the VLNS version produced a smaller number of split duties than the classical local search method, showing that this search method does not cause drastic changes in the initial solution, built with the same philosophy as the company's.The combination ILS-VLNS is the one which best fits this criterion.On the other hand, the VNS with First Improvement was the best one, when comparing the value of objective function.Further studies can be carried out including new practical restrictions in the optimization model such as limiting the number of split duties in the solution and exploring other metaheuristics with the local search technique presented in this work.