Heuristic constructive algorithm for work-shift scheduling in bus rapid transit systems

. ing Science, Canada 2018 by the authors; licensee Grow ©


Introduction
The crew scheduling problem (CSP), or driver scheduling problem (DSP), is part of the operational planning of public transport systems and refers to the daily tasks assigned to the drivers required to cover a set of trips assigned to a set of vehicles (i.e., the vehicle scheduling problem (VSP)). That is, given a set of trips within a fixed period, the problem is to generate the schedule of feasible work shifts, including start and end times and various types of driver task for a series of trips. The work shifts must completely cover the operation schedules of all the vehicles to be used (Edmonds, 2965).
The creation of work shifts for the subsequent assignment of drivers is one of the most complex tasks faced by transport companies and requires a large amount of time to manage. This task is a problem of substantial interest because the worker payroll represents one of the highest costs in the budget of a public transport system (Ceder, 2007).
The importance of the CSP to public passenger transport companies motivates the development of new variants that fit the particular environment of each company. However, regardless of the different variables that each company confronts, the objective is always the fulfillment of scheduled itineraries and the reduction of human resources-related costs through optimization processes. Extensive review of the CSP problem could be consulted in Ernst et al. (2004a), Ernst et al. (2004b) and Xie et al. (2015). In addition real cases application of the CSP could be checked in Ma et al. (2016).
Each itinerary is a description of trips that must be executed within specific time periods and geographic sections (i.e., routes). The frequency with which an itinerary is operated corresponds to service conditions and mass transit public service needs as determined by the tactical planning of the entity that manages the massive public transport system. The combination of route and departure time is termed a service, and a group of services in the same section is defined as a timetable. The routes of public transport systems are determined by their strategic planners and typically do not undergo substantial change in the short or medium term.
Each route must be served by a vehicle with a certain frequency at a defined average speed. That is, a route must be defined in the tactical planning of a transport system given that all route requirements are based on the design of the network service (i.e., network route design) and precisely designed to meet needs identified in strategic planning.
During recent decades, the problem of scheduling driver work shifts has been extensively addressed to reduce costs, improve the distribution of duties and decrease the number of shifts. Several of the first studies of this type are presented by Assad (1983), (Alefragis P. G., 1998) and (Alefragis P. S., 2000). The CSP becomes increasingly difficult to solve as constraints or variables are added to the problem, even when the constraints or variables requirements are simple (Ibarra-Rojas, 2015).
One study on the DSP was performed in (Fores, 2002). The authors discuss the assignment of drivers and propose a method that combines overall linear scheduling with a heuristic technique to solve the problem without requiring prohibitive computing time. The method is successfully applied in planning scenarios of large-scale public transport systems.
In (Zhao, 2006), a heuristic method termed ZEST for ESTimator is used to analyze the DSP. The author divides the problem into two time periods (i.e., afternoon and morning) according to each day's hours of maximum demand. Each sub-problem is solved separately, and the solutions are only united at the end of the process to provide a general solution. The described method uses three sequential steps to examine the structure of a bus schedule created through a manual scheduling process used in the United Kingdom by expert programmers.
In the doctoral thesis presented in (Weider, 2007), a method is proposed based on an algorithm known as IS-OPT that integrates the problems of vehicle and driver assignment in passenger public transport in Germany. The author demonstrates how to replace a linear scheduling (LS) method with an inaccurate, proximal one in the context of the generation of columns. Through Lagrangian relaxation, a new set of activities is presented that approximates a large-scale set partitioning problem (SPP). Finally, a two-phase algorithm to solve the pricing problem is proposed, which is modeled as a shorter path problem with additional constraints and a nonlinear objective function. The method can solve real medium-size cases.
In (Steinzen, 2007), the author describes a hybrid evolutionary algorithm with different column generation methods to evaluate the objective function of each individual. This strategy facilitates solving an integrated vehicle and driver assignment problem while considering multiple public transport hubs. The algorithm is based on a decomposition problem that first assigns trips to each hub and thus resolves an integrated problem for each hub. Each sub-problem can be solved in polynomial time. This method is capable of resolving problems of medium size.
A method that combines the algorithms of iterative local search, descending variable neighborhood search and tabu search with adaptive relaxation to solve an integrated vehicle and driver assignment problem in mass public transport is presented in (Souza, 2010). To investigate the solution space, the authors propose six movements of relocation and exchange, both for a VSP and a DSP. Tests were performed with real data from a transport system of a Brazilian city. The results reflect the method's effectiveness.
In (Mesquita, 2011) is presented a new mathematical expression to describe a joint vehicle-crewrostering problem (VCRP). The authors propose a sequential algorithm that facilitates solving a nonlinear multi-objective optimization model. The algorithm awards high priority to the objectives framed within the combined VCRP, while the difficulties presented by the driver rostering problem are awarded low priority. Within the methodology, the authors develop a heuristic procedure that facilitates decision-making concerning vehicle, driver and roster scheduling while attempting to comply as closely as possible with company interests and policies as well as driver preferences. The method is validated using real data from a bus company in Portugal.
A new mathematical expression to solve the CSP under a set of special constraints according to the labor and transport laws of Italy is presented in (De Leone, 2011). The proposed model can accurately solve small and medium-size problems. For real size problems, the authors propose a greedy randomized adaptive search procedure (GRASP). The method is applied to a set of real problems, and the results are compared with the current operation of the system under study.
Chen and Niu present in (Chen, 2012) a design of a binary linear scheduling model to solve a DSP considering various task types, which differ according to the time they are performed. To this end, the authors divide the duties of each driver by time period (i.e., morning, afternoon and evening) according to the hours of maximum demand. With this model, the authors seek to minimize the break time of drivers under a set of complicated constraints that correspond to work regulations. The objective function has direct implications for operating costs. The model is solved using a tabu search metaheuristic algorithm with a neighborhood structure that enables the search space to be adequately investigated.
A flexible and efficient method based on cutting and joining (CAJ) to solve a CSP is presented in (Tóth, 2013). This algorithm enables initial solutions to be quickly generated. Because of the flexibility of the proposed approach, it is possible to develop an iterative heuristic method with which a more robust algorithm is obtained to solve the DSP in real instances. Using several methods such as ant colony optimization, simulated annealing, and tabu search methods solves the problem. Ma et al. (2017) propose a model considering fairness in the problem of crew scheduling for bus drivers (CSP-BD). The considered problem is solved by using a hybrid ant-colony optimization approach. Xie & Suhl (2015) proposed a method for generating a personalized roster for each driver/group of drivers in a Bus System Transit. The problem is formulated as a multi-commodity network flow problem.
Finally, in this paper, a constructive two-phase heuristic algorithm is proposed. In the first stage, the division of the shift schedule (i.e., timetable) based on a dynamic scheduling algorithm is performed. In the second phase, a matching algorithm is implemented (i.e., matching) to construct the work shifts of drivers at Integra SA, which operates the Megabus system of the Central Western Metropolitan Area (AMCO). The approach consists of minimizing the scheduling time of driver work shifts, maximizing compliance with labor considerations and ensuring compliance with all constraints. A final result is presented that is viable in terms of actual operations.

Problem description and formulation
The problem of work-shift generation considered here can be formulated in a general way using graph G = (V, A), where V = {0,1,2, … , n, n + 1} represents the nodes of graph G. Node 0 and node n + 1 represents the same location, which is where the set of available drivers is to start the various trips required. In this way, set V = 1,2, … , n represents the set of tasks or services that must be performed. Each task must be performed by a driver between start time and final time . The set of arcs contains all the pairs ( , ) such that task ∈ can be performed after task ∈ . Each arc has an associated travel time ≤ (s − e ) and a travel cost , which is the time a driver spends traveling from where task ends to where task begins. R = (0, i , i , … , i , n + 1) is defined as a path in , which starts at node 0, traverses a set of tasks i ∈ V and ends at node + 1. Thus, represents the first node visited after leaving node 0, and represents the last visited node before reaching node + 1. Therefore, is a feasible path of , which represents a work shift to be worked by a driver. Each path must meet the following constraints: Eq.
(1) refers to the real time a driver requires to execute a work timetable, that is, the time that elapses from the start of the driver's workday, including the departure of the vehicle from the depot (that is, from node 0) until the vehicle reaches node + 1, where the timetable ends (which is not necessarily a hub) and whose duration must be less than maximum elapsed time . This is because a driver can perform part of a shift in the morning and another part in the afternoon or evening. This constraint avoids shifts that require all the driver's time and avoids forcing a driver who ends a shift late at night to wake up early (and vice versa).

Constraint
(2) refers to the maximum work time a driver must perform in a workday.
In contrast, in the literature, different objectives have been considered when solving the CSP, such as minimizing driver break time, minimizing the number of drivers and maximizing work time. In this study, we seek to distribute the work time of each driver uniformly. To this end, the difference between the regulated daily working time and the actual working time of each driver is minimized, as expressed in the following equation: Where corresponds to the regulated daily working time and is the actual work time performed by driver ∈ .
The objective function presented in (3) seeks similar working times for all drivers, which ensures that human resources are used appropriately (i.e., the time worked approaches the regulated working time) and endeavors to eliminate the driver cost associated with overtime pay.

Method
Based on the various service tables of (i.e., timetables) offered by the managing entity (here, Megabus), the problem consists of determining the set of work shifts that must be performed by the drivers. The tables assigned by Megabus to the operating company Integra S.A. vary in size (in time and number of trips) and normally cannot be assigned to a single driver, either because the cumulative time of all trips exceeds the regulated number of work hours (in terms of the time that a driver may work continuously and in terms of the regulated daily working time). Therefore, each service table must be appropriately partitioned such that each partition coincides with the regulations concerning continuous work and such that the daily shift does not exceed the maximum allowed working time, for which it is necessary to pair one or more partitions. In Figure 1, the proposed method is described in a general way. Thus, Figure 1a shows that the process starts with a set of schedules (i.e., timetables), each of which contains a set of trips or services. Figure 1b illustrates the process of dividing the tables into sub-tables (i.e., sub-paths in G), which comply with a set of technical working constraints. Finally, Figure 1c shows the pairing process according to which two or more sub-paths can be joined to form one path ∈ that represents a task or work shift for a driver.

Table division algorithm
Because of the technical and labor constraints included in the optimization process, it is necessary to perform a division process for each timetable. Because of the number of possible ways to divide the tables and because there is a set of strict operational constraints, this process is combinatorial: Fig. 1. The first trip of the work shift generated by the division must start at the depot (node 0).  It is clear that a timetable can be divided in several ways and into several sub-tables . Therefore, in this paper, we propose a recursive algorithm based on dynamic scheduling to find the best set of subdivisions for each timetable. To determine if division is better than another division (for the  same table  ), the following comparison measure is used in the recursive process: As an example, suppose that there are two different divisions for the same timetables and and each of them has the time of each service (Fig. 2). Assuming = 45, the algorithm will determine the best division from the expression presented in 5) as follows: In this manner, it can be determined that the best division of the service table is that which occurs in partition of the Fig. 2, which includes the set of sub-paths { , , }.

Matching algorithm
With the set of sub-tables or sub-paths obtained in the division process of section 3.1, graph = ( , ) is formed (see Fig. 3).

Fig. 3. Graph of sub-tables $r$
Each node in set represents a partition or sub-path . The set of edges is formed by the pair ( , ) with , ∈ if the union of two sub-tables ∪ generates a feasible work shift. That is, each shift $R$ that is generated must meet the following set of constraints: ri rj Ti 1. The total work time of shift = ∪ must be less than or equal to the maximum work time , as indicated by the set of constraints imposed in Eq. (2).
2. The number of mixed shifts (which arise by joining a sub-table of schedules pertaining to a feeder line with a sub-table of a main line) must be less than or equal to a parameter . This constraint is due to the fact that not all drivers are licensed to operate articulated buses.
3. The amount of time required to perform a shift must be less than or equal to , as stipulated in constraint (1), which ensures that a driver who works late must not wake up early (and vice versa).
4. The time between the completion of one partition and the beginning of another must be greater than rest time plus the time of travel between the locations where travel ends and begins, which ensures a break for each driver after having worked consecutively for a period of time .
The second phase of the proposed method is based on graph , for which a matching algorithm is developed based on the algorithm proposed by Jack Edmonds in (Edmonds, 1965).
The method consists of making different pairings recursively on the same graph, as described in the following:  A simple pairing of nodes is performed according to graph considering probability . Each shift formed can only contain trips from up to two different original tables, and mixed shifts are not allowed. Fig. 4 shows a general matching process.

Fig. 4. Matching
 From the previous pairing, "super nodes" are created. That is, the edge used in a pairing is contracted and considered the union of r with r as a single node (see Figure 5). Again, the previous step is repeated with probability ρ . The new shifts may contain services from up to three different original tables, and mixed shifts are not allowed. ri rj ri rj ri rj U  The previous process is repeated recursively eight times with probabilities ρ , ρ , ρ and ρ . In some of the recursive calls, mixed tables are allowed. Algorithm 3 shows the pseudocode of the pairing process.

Perturbation mechanism
To further examine the solution space, a perturbation mechanism is applied to the solution found. This mechanism consists of separating the shifts found. For this purpose, the probability is ρ. The process is inverse to the super nodes. That is, a super node is adopted, and the original nodes of graph are recovered, which provides the possibility that these nodes are paired differently. Figure 6 illustrates the perturbation process.

Results
The proposed algorithm was implemented in Java 1.8 on an Intel Core i5 CPU with 2.4 GHz and 4 GB RAM in the Yosemite 10.10 operating system. The proposed method was validated by application to the work shift schedule of the AMCO mass transportation system operated by Integra SA. The system has 11 routes between feeders and main lines. The managing entity designs and delivers 47 scheduling tables, 26 of which correspond to feeder lines and 21 to main lines, for a total of 2899 services and a ri rj ri rj ri rj U total programmed time of 692 hours and 20 minutes. The tests were performed during 10 simulation processes, and the following set of parameters was used in each execution of the proposed algorithm: ρ = 0.30, : ρ = 0.25, : ρ = 0.50, : ρ = 1.00, : ρ = 0.10, T = 5.50 h, = 10 h, = 40 min, = 13 h, = 40, and = 1000.
For each simulation, 1000 iterations of the algorithm were performed. Table 1 reports the results of the 10 simulations, including the number of final shifts. The final shifts are divided into double and triple shifts, which correspond to shifts consisting of trips from two and three different original tables, respectively. Mixed shifts correspond to those shifts in which the final table consists of trips on a feeder line and trips on a main line. Shifts shorter than eight hours correspond to the tables that do not exceed the minimum daily work time. Finally, the execution time of each simulation is presented. The best solution found by the algorithm corresponds to simulation number 5, which reports a total of 78 work shifts. That is, 78 drivers are required to perform all the trips scheduled by the managing entity.
Although there are other solutions with the same number of shifts, this solution is better because the number of shifts of fewer than eight hours of work is four, which is a good indicator of efficient crew use.  Fig. 7 shows the evolution of work shifts in the best solution. The graph shows that before starting the pairing process the number of shifts is high (161). As the algorithm progresses in each of the recursive calls according to the parameters used, the number of shifts begins to decrease until the obtaining the best solution reported in simulation 5 of Table 1. It should be noted that the Integra SA shift schedule was manually created by the company's operations department, which consists of an expert team. These manual results are compared with the results obtained in terms of the number of shifts found and in the time required to complete the shift schedule. Thus, the manual scheduling has a total of 82 work shifts, and the operations team required approximately 24 hours to create the schedule. However, through the proposed method, a total of 78 work shifts are obtained. This outcome indicates that the company can save 4.878% of the cost of the drivers. In addition, the answer is obtained in 6.38 seconds. Thus, scheduling changes can be made without affecting the operations of the transport system. Previously, updating a route involved several hours of manual changes. Thus, driver scheduling efficiency is improved.
For illustrative purposes, company savings are calculated based on a reduction of four drivers under normal company operations after the application of the proposed method. Therefore, if the method had been implemented in 2015, the average monthly cost of a driver was $ 1'978,949 COP, and the calculated salary increases with the average rates of legal wage increases of the last three years in Colombia were as shown in Table 2. The remaining operation time of the company is eight years, and the opportunity rate is 6%.  Table 3 shows in detail the increase in the salary of each driver projected over the subsequent eight years based on the average annual increase in the minimum wage in Colombia for the last three years. The table also shows the net value of the four drivers who were eliminated and the value saved in the period = 8. In this manner, a savings of $ 1'083,109.607 COP over the next eight years for Integra SA in terms of driver payroll in year 8 is determined.

Conclusion
In this article, a constructive heuristic algorithm with two phases was presented that facilitates solving the problem of generating work shifts in the AMCO Bus Rapid Transit System. The algorithm's first stage is based on dynamic scheduling. In its second phase, a pairing algorithm and a perturbation mechanism enable the investigation of the solution space. The proposed method enables work shifts to be generated for the drivers of the operator Integra SA, finding as a solution a total of 78 work shifts for a total of 2,899 services. The payroll cost of drivers is reduced compared to the manual method used by the company, which generated 82 work shifts. That is, previously, the company required 82 drivers, while with the implementation of this method, 78 are required. The algorithm can find a solution in less than seven seconds. Thus, schedule changes to the routes can be made quickly and without affecting transport system operations.
Future research on this topic should focus on the implementation of evolutionary metaheuristic algorithms with local improvement mechanisms that facilitate maintaining sub-optimal solutions.