Abstract
This paper presents an improved genetic algorithm (GA) with gene recombination for bus crewscheduling problem in bus company. Unlike existing methods that rely on designing a fixed potential shift set by software, our new method does not need such a potential shift set information. In our method, satisfied shifts are generated through gene recombination in genetic algorithm. We conduct extensive studies based on reallife instances from Beijing Bus Group. Compared with results generated by the current manual method, ant colony algorithm, and CPLEX, computational results show that our algorithms demonstrated very good computational performances. In our tests, the number of the maximum reducing shifts can be beyond 30, especially when trip number is very large. The high relative percentage deviation demonstrated the effectiveness of the algorithm proposed.
1. Introduction
It has been known for more than 50 years [1] that the crewscheduling problem for bus drivers (CSPBD) is one of the most important operationalplanning problems in a bus company, because, from the transit agencies’ perspective, the largest cost of providing service is generated by drivers’ wages and fringe benefits [2]. The CSPBD is aimed at assigning vehicle trips to crews in such a way that each trip is covered by a shift, while guaranteeing that all other duty functions are feasible and the total cost of all duties is minimized [2–6].
CSPBD has attracted the interest of many researchers since the 1960s, and research in this area has become very active since the 1990s. Most of the methods in the existing studies are based on mathematical programming or on hybrid approaches, which are combination of heuristics and Integer Linear Programming (ILP) [7–10]; the success and limitations of these methods have been discussed in Kwan et al. [11, 12] and Li and Kwan [13]. In the mathematical programmingbased approach, CSPBD is formulated as covering/partition problems that aimed at generating a subset of shifts to cover all pieces of trips, with the objective of minimizing total costs or total number of shifts [13]. In recent years, metaheuristics have been widely used for searching practical nearoptimal solutions to NPhard problems. Metaheuristics offer three main advantages: (a) they are usually very efficient in searching through very large solution space; (b) they can result in a feasible solution; (c) each class of metaheuristics has its own methodical and strategic structure. Until now, much effort has been made in exploring metaheuristics, such as tabu searches (TS) [9, 14, 15], ant system [16–18], and simulated annealing [19].
Genetic algorithms (GAs), one of the most important metaheuristics, form another major class for crew scheduling. In general, structure of GA for CSPBD could be divided into two classes: one is the shiftbased chromosome structure and the other is called the piecebased chromosome structure. In the shiftbased structure, the chromosome length is not fixed. By changing the gene in chromosomes repeatedly through genetic operators, a feasible solution can be obtained [20, 21]. In the piecebased chromosome structure [22], a gene usually represents each piece. If a gene is chosen during the genetic operation, the corresponding shift covering the chosen gene will also be selected. Therefore, the simple crossover operation may be infeasible based on the units of shifts, let alone mutation. Furthermore, once a shift unit existed in a chromosome, no new shift units were produced except for exchanging the parent chromosomes. Thus, the efficiency of algorithm largely depends on initial parent chromosomes.
Most of researches mentioned above were based on a pregenerated set of potential fixed shifts. Through adding or removing shift units during genetic operations, an optimum solution with the least shifts is obtained. Different from the above generated method, this work introduces a new method without using the potential shift set; instead, satisfied shifts generated from process of gene recombination in genetic algorithm are employed. A different piecebased structure is taken into account and the optimal solution is generated by repeated recombination process.
The rest of paper is organized as follows. Section 2 introduces the crewscheduling problem for bus drivers (CSPBD) in general terms and elaborates the construction of the objective function and model. Section 3 describes the proposed genetic algorithm with gene recombination (GAGR) approach involving representation of chromosomes followed by gene recombination method. The genetic process of this section contains initialization of population, crossover, and mutation operators. In the last part of this section, an overall framework summarizes the whole process of GAGR. Section 4 provides the experiments with different parameters based on GAGR. Finally, Section 5 gives conclusion remarks and suggestions for future research.
2. CrewScheduling Problem for Bus Drivers
A vehicle block may be considered as a unit of work, which starts and ends at a relief opportunity (RO) that means a time and place at which a change of drivers is possible, for a vehicle in the course of one day. A driver’s shift (or duty) is a set of pieces of work that can be assigned from the driver’s signing on until his/her signing off at the depot. A piece of work denotes a shorter work between two consecutive ROs completed by the same vehicle. There are often some constraints on shifts, such as laboragreement rules that limit work hours or the time of a break at the relief points. Several successive units (called spells) of a block form a portion of a shift. The concepts of block, RO, shift, spell, and piece of work are illustrated in Figure 1. In it, the process of generating two shifts on four blocks corresponding to four vehicles is illustrated. A shift typically starts from the crew signing on depot to a signing off depot. For shift 1, two spells combining a part of Block 1 and Block 2 are involved. For shift 2 three spells are used. There is a spell that contains only a piece of work in Block 3.
The crewscheduling problem for bus drivers (CSPBD) aims at finding a set of feasible shifts or duties that can cover all trips or vehicle blocks in a particular scheduling horizon. Each trip is a scheduled activity with specific starting and ending times and locations. The feasibility of a solution mainly depends on many constraints, for example, if there is enough time to enable the connection of two successive trips. Generally speaking, CSPBD involves both a vehiclescheduling problem and a bus driverscheduling problem.
3. Objective Function of CSPBD
Let be the set of feasible shifts, represented by obtained from pieces. Pieces set can be formulated as ; that is, . Let binary variable equal 1 if shift is selected and equal 0 otherwise. Let be the basic minimum payment for a shift , including the fixed salary, routine maintenance, and petrol cost. Note that bus purchase cost is not considered in this research. Let binary variable be 1 if shift covers piece and 0 otherwise. Let denote the total driving time for shift . Let be the maximum driving time stipulated by bus group. Let denote the driving time for one way. Let be the idle time between pieces and in shift , ranging between the stipulated minimum idle time and maximum idle time . Let denote the working time limit, say 8 h, according to the laboragreement rules for a shift. It includes the total driving time, the total idle time, and another time for having a meal and signing on or signing off. is a large constant to penalize the number of shifts in a final schedule. In addition, each bus must start and end its workday at the same depot. The crewscheduling problem is usually formulated as the following ILP set partitioning model:
Objective (1) is to minimize the total number of shifts so as to reduce a bus company’s total costs while maintaining almost the same service levels. All the constraints (2)–(8) strictly limit the range of solution. Constraint (2) ensures that each piece is served once; constraint (3) guarantees that the total driving time has to be satisfied in a proper range; constraint (5) imposes upper and lower bounds on the idle time between two successive pieces.
To depict CSPBD more clearly, we construct it on a graph. ROs are expressed as nodes and the connecting edges are according to the constraints between two consecutive driving pieces. Table 1 gives the example of a part of the Beijing Bus Group’s #26 bus timetable and also shows the feasible connectingnode set with constraints of , , and .
4. GAGR Approach
Genetic algorithm (GA) is a global search algorithm based on the evolutionary ideas of natural selection and evolution. Except for the classical procedures crossover, selection, and mutation in GAs, the main design for GAGR is presented in this section. Piecebased chromosome representation is firstly defined. Secondly, recombination method with or without deadheads in each chromosome is illustrated in detail. Then the initial population is obtained by greedy algorithm. Next, the genetic operators of selection, crossover, and mutation are devised to generate new offspring chromosomes for the next iteration. In the end, the framework of GAGR method is presented.
4.1. Chromosome Representation
This section adopts the idea of Wren [22] that constructs a chromosome considering the pieces as genes. As displayed in Figure 2, are genes (pieces for short in schedule) and shifts are identified as . The whole chromosome represents a solution and the quality of this solution is evaluated by the number of shifts or cost.
The number below represents each gene position (locus) and the number underlined is the last position for each shift. It may be noted that the genes are not in chronological order here as each shift is independent of the other. For example, shift 1 and shift 2 may exchange their positions and have no effect on the final solution in an iteration.
4.2. Gene Recombination
Gene recombination method starts using such generated chromosome mentioned above. In this process, several old shifts are merged into a new shift; thus, the number of shifts reduces effectively. Gene recombination could be decomposed into two main methods. In one method, no deadhead is permitted in the middle of the generated shifts; in the other method, one or two deadheads could be added to the new shift if regulations and recombination conditions meet. We set start or end points to be the joinable points. More details are depicted in Figure 3.
(a)
(b)
(c)
(1) No Deadhead in Recombination. In Figure 3(a), shift 1 and shift 3 may have no chance to merge into a new shift based on the total working time constraint. Moreover, other constraints like the maximum and minimum idle time limit must be considered. Then the remaining combination is shown as C1, C2, C3, and C4. The first or last node in shift 1 may join with shift 2 and the potential new shifts in the above picture after combination may be 123 or 312 as well as 3456 or 4563 as another two generated new shifts in a schedule.
(2) One Deadhead in Recombination. Obviously, in the process mentioned above, there are no repeated pieces in new solution. Sometimes, it may be proper to add some pieces to construct new shifts and thus reduce shifts efficiently when conditions are satisfied between two shifts after first recombination. In fact, because of the inexistence, those repeated pieces are replaced by deadheads. Figure 3(b) illustrates the recombination procedure. Four pieces , , , and in original piece set prepare to bridge two shifts. If the connectivity between shift 1 and shift 2 is available, it means , , , and must satisfy all the necessary constraints like the total driving time and depot. In addition, the idle time limitations also confine those corresponding pieces:
(3) Two Deadheads in Recombination. This procedure performs if two methods mentioned above are even not helpful to decrease the shift count. Two pieces from original piece set are selected to bridge two shifts. The feasible connection between shift 1 and shift 2 may construct two potential shifts. Take connection C1 as an example, shift 1 and shift 2 are connected by pieces , . The idle time constraints for those pieces are
4.3. Initialization
An initial population can be easily built by constructing individuals. Each individual is a solution generated by selecting pieces from its initial piece set. Length of an initial individual, , is the same as the number of pieces (genes) in a schedule. And denotes the population size. The process for initial population construction includes six stages.(1)Randomly select pieces into start pieces set . Length of is equal to .(2)Put the start pieces into tabu list, a pieces set containing used pieces. Set , the first node in tabu list.(3)Find a feasible piece in nontabu list, a point set with unused pieces to connect the last piece in tabu list.(4)If existing, put the satisfied piece into tabu list and update nontabu list, and then go to step . Otherwise, one shift is generated and go to step .(5)If nontabu list is not empty, randomly select one piece from nontabu list and put it into tabu list, and then go to step . Otherwise, go to step .(6)Replicate all pieces in tabu list into chromosome , and then empty tabu list.(7)Repeat , , , , and until .
4.4. Crossover with Duplicate Gene Removal and Repairing Strategies
The standard roulette wheel method is adopted to select promising individuals according to the fitness function, an inverse relationship with cost function, from the current population , , where represents generation iterations. And each chromosome may be corresponding to each individual.
A simple twopoint crossover method is employed in GAGR. In view of convergence and integrity for a schedule, the duplicate genes should be removed and the lost genes in a chromosome should be readded to the crossover chromosome. Two chromosomes and are chosen from population and their cross point positions are and , where . Therefore, both chromosomes are divided into three parts: , , and for and , , and for . Let , , , and denote the relative shifts at and in the two exchanged chromosomes. Then, new chromosomes after crossover procedure turn into and . However, simple crossover leads to multiple duplicate genes and losing genes in respective exchanged chromosome. Therefore, removal and repairing strategies are applied in GAGR.
(1) Duplicate Gene Removal Strategy. This strategy is composed of two steps: (a) seek for the duplicate genes and the corresponding shifts in the whole chromosome and (b) split those shifts and remove the duplicate genes. The most difficult part occurs in dealing with shifts at the start and end points in each exchanged part. Thus, four cases are taken into account: (1) , where it states that shifts in the two exchanged parts are all intact; thus no split exists; (2) , where the shift at the start point has to be divided into two segments and ; (3) , where the shift at the end point has to be divided into two segments and ; (4) , where both shifts at start and end points should be split into two parts and as well as and . See more details in Figures 4(a), 4(b), and 4(c).
(a)
(b)
(c)
(d)
Seek for the duplicate genes in exchanged part and nonexchanged parts, and then pick the duplicate genes and the corresponding shifts out. Delete those genes in nonexchanged parts and move the remaining genes to the end of chromosome. If remaining genes are joinable, then they combine into a new shift. Otherwise, the single gene itself constructs a new shift. The process of gene removal strategy is illustrated in Figure 4(d).
(2) Losing Gene Repairing Strategy. Genes not existing in their exchanged part are the losing genes to replenish. Let , denote the difference set of two exchanged parts, and : Put the losing genes in (or ) into the end of new chromosome (or ). Each losing gene constructs a new shift.
4.5. Mutation with Removal and Repairing Strategies
The mutation procedure is devised as follows: (1) Define some parameters such as mutation rate () and a small constant (say 2 or 3) denoting the number of positions to be mutated in a chromosome; (2) randomly choose a number for each individual; (3) compare mutation rate and the random number . If , randomly choose positions. Then the shifts on these positions are selected and split into several segments according to the specific positions. (4) These segments are constructed into new shifts, then previous selected shifts are deleted at the meanwhile.
The final result in each chromosome may contain many piece shifts, that is, only one piece in a shift. Therefore, the recombination method mentioned above plays a significant role in decreasing objection.
4.6. Framework of GAGR
The framework of GAGR approach is outlined as follows:(1)Initialize parameters such as the global target shifts ( is a large constant), maximum generations , crossover rate , mutation rate , and generation gap .(2)Set , and construct an initial population containing individuals. Then transform into by gene recombination methods with no deadhead. Update if a less global target appears.(3)For each individual in , calculate its fitness value according to the objective function presented in formula (1).(4)By using roulette wheel, select a set of promising individuals according to the generation gap. And the size in is denoted as .(5)If the random number () satisfies , pair individuals randomly in . Then through crossover, the initial pair turns into a children pair. And the target shift number may also decrease adaptively. The new offspring population is denoted by .(6)Mutate each individual in according to the operator .(7)Construct a new population . Its individuals consist of all individuals from and the best individuals from . Update if a better global target appears.(8)Set . If the termination is not met, that is, perform procedures from (2) to (7) mentioned above.
5. Computational Results
5.1. Comparison with CPLEX
To testify the accuracy for the results of GAGR, two simple examples with 36 and 72 pieces of work on single depot are tested on CPLEX, a useful tool on mathematical programming problems. The maximum iteration was set for 100 and the corresponding parameters were set for , , and , respectively. The results are listed in Table 2 and the minimum results in each iteration are also depicted in Figure 5. From Table 2, little difference of the minimum results in both methods is shown, especially when problem size is small. Both of the running times are maintained within an acceptable range. The minimum shift for each iteration is displayed in Figure 5. Though the best result in GAGR for this example fails to reach the correct answer, the whole descending process presents the convergence of GAGR. Besides, the first result close to the correct answer shows the effectiveness for reducing shifts at the beginning of iteration.
In order to test the performance of GAGR, experiments on 10 lines in Beijing have been done. The lines information is showed in Table 3. Manual results are also listed in the table, regarded as the best results. The computational experiments were carried out by programming in MATLAB. We set the population size to be 100 and iterations to be 20. To simplify the computation difficulty, other experimental parameters were as follows:
Experiments were firstly carried out on the initial chromosomes by the gene recombination. We tried to apply different parameters in order to achieve the best result. Finally, the gene recombination method with one or two deadheads is also applied to the last experiment.
5.2. Experiments on the Initial Population with Gene Recombination (GR) Method
From Table 4, we can see a large gap between results with GR and the ones without. The maximum reducing shifts are more than one hundred shifts on Line #322. An interesting discovery shows that more pieces of work on a line may lead to larger reducing shifts, except for #348 and #34. The reason may be that more pieces of work lead to more chances to choose randomly, thus generating large shifts. This paper also applied the relative percentage deviation (RPD) according to Li and Kwan [23] over the best known schedule to measure the quality of a heuristic schedule shown below. In Table 3, we noted that all the RPD results are positive; thus, it may not achieve ideal results if just using GR method.
5.3. Experiments on the GAGR with Different Parameters
Although GAGR approach presents its advantage on exploring new shifts and thus decreases the number of shifts, different parameters may influence its performance. These parameters consist of two types: one is called the computational parameters; parameter combinations considered in GAGR include (i) crossover rate (), (ii) the mutation rate (), and (iii) generation gap (); the other one is the objective parameters shown in the objective function, while in this paper, the objective parameter is , a large constant in formula (1). Therefore, we set from 0.1 to 1.0 stepped by 0.1, from 0.05 to 0.3 stepped by 0.05, and gap from 0.5 to 0.9 stepped by 0.1 according to the classical GA method. The large constant is set to be 10, 100, and 1000. Each line with each parameter combination runs for 10 times and each run iterates for 20 times.
(1) Experiments on GAGR with Different . We set , , and as default values when . Table 5(a) presents the minimum and average results of experiments for each bus line, and the last row displays their average relative percentage deviation (RPD).
We can see that most of the minimum results are better than the manual results (MR), especially #322, for all the results are much lower. It is testified to improve quality of solutions considering the negative values of average RPD. And tables also show something different from the classical GA; that is, a higher value of may not achieve the anticipated results. The reason may be that it is likely to produce more piece shifts after crossover operation if no more short shifts can be linked with others to generate new shifts. ranging from 0.2 to 0.4 is more favorable to obtain optimum results especially when for there are 5 optimum results and the lowest average RPD shown in tables. So we may set in the following tests.
(2) Experiments on GAGR with Different . From Table 5(b), we obtain that all the average RPD is negative and the deviation in the same line is small. It demonstrates that different may not change much. The reason is likely to be that the mutation operator can raise the possibility to generate a better solution, but not necessary. When , optimal results for this value take up 70% and the average RPD is obviously lower than other values. Therefore, we determine to set .
(3) Experiments on GAGR with Different . As described in Table 5(c), average RPD for different values are also close. The minimum results equally distribute in various values, while, as seen from the average RPD of minimum and average results in Table 5(c), the suitable generation gap is set to 0.8 ultimately.
(4) Experiments on GAGR with Different . In this section, we run all the programs again and compare the results in different . From Table 5(d), we can see that almost all the results are better than the manual ones. However, all the best results may not appear in the largest when shifts are in a large number, for example, #345 and #322. In other words, the large constant constraint may have little effect on largescale problems using GAGR. In addition, we discover that the results on a large approximate the minimum results. The reason may be the randomness in GAGR and fewer tests in this paper. To test the validity, more experiments will be made in our future work. To keep accuracy, we set in our following experiments.
In the process of seeking for the suitable parameter combinations, we may discover that some optimal values appear in different parameter combinations. For example, in #306, the optimal value 26 is presented in different parameter combinations. In addition, even if the selected excellent parameters are set to experiments, sometimes the optimum results cannot be achieved. We may guess that (a) the composition of optimum shifts may be different from each other; (b) the randomness of GRGA may lead to the same result in different parameter combinations; and (c) as most of the metaheuristic algorithm the chosen parameter combinations only raise the possibility to generate a better solution but may not guarantee the certainty.
5.4. Experiments on the Final Population with GRD Method
Based on the previous experiments on the initial population, this method tends to obtain a better solution based on the final population considering deadhead; that is, after GA the whole population is recombined with one deadhead. 20 tests are performed with the selected parameter combinations and the minimum and average results before and after this method are also presented to testify the quality of this method.
As Table 6 shows, the results are improved after the combination method with one deadhead. It is interesting to find that the maximum reducing shifts reach 13; that is, 13 shifts are saved by adding one deadhead. In our tests, results in most lines are much better than the obtained optimal results except for some lines, for example, #348 and #345. Thus, the combination method with one deadhead is quite effective in reducing shifts.
5.5. Comparison with Ant Colony Algorithm (ACA)
To further test the performance of GAGR, it is necessary to compare it with other metaheuristics methods. Though different GA methods [21] with shiftbased chromosome structure for CSPBD have been provided, it is difficult to completely restore these methods because of lacking a set of potential shifts in such a huge problem. Therefore, a similar selecting piece method, ant colony method, is proposed to compare the effectiveness and efficiency of the presented GAGR method. The computational testing of GAGR was carried out by applying the code and comparing the results to the ant colony algorithm (ACA) running under the identical experimental conditions. The parameters of the proposed GAGR are set as follows: , , and , . Meanwhile, the parameters for ant colony algorithm are as follows: (1) exploration threshold ; (2) the relative importance of pheromone trails versus heuristic function α : β = 1 : 2; (3) trace persistence coefficient . The process of ACA is illustrated in Figure 6 and its steps are outlined below.
Step 1. Initialize the necessary variables and parameters and define the heuristic function and initial pheromone density.
Step 2. If the iteration number is less than the original maximum number, then judge the ant number, or else go to Step 6.
Step 3. Initialize the tabu list that contains the visited nodes and generate a new shift if the tabu list is not full. Before generating a new shift, feasible connectingnode set with constraints like GAGR for each node is also built. The rule of choosing next node depends on the heuristic function that defines the closeness between two nodes and the pheromone density in each iteration. Besides randomness comparison with exploration threshold is also reflected in the process of choosing node.
Step 4. Put an unselected node for a new shift into tabu list until the tabu list is full. If all ants finish their routes, estimate all solutions by calculating the total cost and store the best one. Otherwise, return to Step 3.
Step 5. Update the pheromone density in the pheromone matrix according to the updating rules. Then continue implementing the algorithm and searching for the obtained best solution.
Step 6. Stop.
The criterion used to terminate the iterative search process of GAGR and ACA is that when a maximum number of iterations have been exceeded or when no improvements are observed over a number of iterations (Algorithm 1). Then the algorithm can be considered to have converged. Each line runs for 20 times.

From the comparison results, the minimum results show a large gap between GAGR and ACA and the gap is larger on large pieces number (Table 7). The results on GAGR improve much more than ACA results, since all the ACA results are not better than the manual results seen from the positive RPD values. However, the running time in ACA is obviously shorter than GAGR for its simplicity.
6. Conclusion
This paper presents a GAbased evolutionary approach with gene recombination about crewscheduling problem for bus drivers. Unlike existing methods with a potential shift set for crew scheduling, a new piecebased chromosome method associating with decomposition and recombination is proposed. Shifts in parent chromosomes are divided into several piece shifts and offspring shifts are combined into new shifts during the genetic iterative process. The global solution is achieved by the repeated removal and replenished procedures. In view of the effect of different parameters, hundreds of experiments of ten bus lines from Beijing Bus Group were tested to select the optimal parameters. What is more, the gene recombination methods with or without deadhead were also employed into the initial and final populations. First, two simple examples are applied on both GAGR and CPLEX. The performance shows little difference between the correct answers and the obtained results. Compared with the current manual results, the results obtained by our approach are better on both solution quality and speed, no more than 11 minutes, even for the schedule with large pieces such as 1108 for #322 in our test. Almost all the results improve in the tested ten lines especially the one achieving 36 reducing shifts, a very large number, and all the negative RPD values reflecting the solution quality. From the results, it is also found that the effectiveness becomes more significant while there are more pieces in a schedule. In addition, the comparison with ant colony algorithm also shows the validity of GAGR for a large gap in results under the identical conditions. For the future work, we will add more constraints stipulated in Bus Group to approximate the current need and apply this approach to more similar set covering problems.
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
Acknowledgment
This paper is sponsored by National Basic Research Program of China (no. 2012CB7254035).