Optimization method for subway crew scheduling based on generation-selection two-stage algorithm

Through the generation-selection two-stage algorithm, a spatiotemporal state network and set coverage model are constructed to optimize the subway crew scheduling plan, solving the problem of low crew scheduling optimization efficiency in the existing technology, achieving a significant reduction in the number and time of crew tasks, and improving management efficiency and duty efficiency.

CN119599325BActive Publication Date: 2025-09-19SOUTHWEST JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411602129.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-09-19
Estimated Expiration
2044-11-11

AI Technical Summary

Technical Problem

Existing technologies make it difficult to effectively optimize subway crew scheduling plans, especially when urban rail transit lines are extended and passenger demand increases. Manual compilation methods are difficult to meet actual operational needs, and the solution algorithm is inefficient.

Method used

A two-stage generation-selection algorithm is adopted. In the generation stage, a spatiotemporal state network is constructed and the improved Floyd algorithm is used to generate crew tasks. In the selection stage, a set covering model is constructed and an adaptive genetic algorithm is used to optimize the scheduling plan. The solution efficiency is improved by designing an adaptive genetic algorithm and a set covering model.

Benefits of technology

It effectively reduced the number of crew tasks, on-duty hours and connection time, improved the efficiency of crew management, reduced the total number of tasks by 14.48%, the total on-duty hours by 9.39% and the connection time by 15.79%, and improved the on-duty efficiency of drivers and crew members.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599325B_ABST
    Figure CN119599325B_ABST
Patent Text Reader

Abstract

The purpose of the present invention is to propose a subway crew scheduling optimization based on a two-stage generation-selection algorithm, which relates to the technical field of urban rail transit operation planning. This application divides the preparation of subway crew scheduling into two stages: "generation-selection". For the generation stage, a spatiotemporal state network is constructed, the crew task generation is converted into a path search problem, and an improved Floyd algorithm is designed to generate a large number of alternative crew tasks; for the selection stage, an improved set covering model is constructed, and a greedy algorithm and a genetic algorithm are designed for solving the problem. Finally, the Chengdu Metro Line 5 is used as an example for verification. The results of the example analysis show that compared with the manual preparation scheme, the preparation method proposed in this paper has a significant optimization effect, with the total number of crew tasks reduced by 14.48%, the total on-duty time of crew tasks reduced by 9.39%, and the total connection time reduced by 15.79%.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field related to urban rail transit operation planning, and in particular to subway crew scheduling optimization based on a generation-selection two-stage algorithm. Background Art

[0002] The subway crew plan is a core document guiding the daily work of subway drivers and crew members. It can be divided into crew scheduling plans and crew rotation plans, which are compiled separately. Crew scheduling plans have long been compiled manually. However, with the extension of urban rail transit lines and the increase in passenger demand, manual compilation methods are no longer able to meet actual operational needs.

[0003] Solving algorithms are key to optimizing crew scheduling. Currently, the most widely used algorithms include the "generate-select" algorithm, the column generation method, and intelligent heuristic algorithms. The "generate-select" algorithm decomposes the scheduling problem, first generating a large number of crew tasks and then selecting the optimal crew tasks from them based on a set cover / partition model to obtain a scheduling solution. For the task generation phase, the methods used primarily include linear relaxation, shortest path algorithms, and tree enumeration. For the task selection phase, the methods used primarily include improved branch and bound, Lagrangian relaxation, and intelligent heuristic methods. The column generation method is a solution method based on column generation technology. When solving the crew scheduling optimization problem, the problem is typically divided into a constrained main problem (RMP) and a pricing subproblem (PSP). The key to the column generation method is how to quickly solve the pricing subproblem. Most existing studies have converted the pricing subproblem into a shortest path problem in a directed network graph. Compared with analytical methods, intelligent heuristic methods have wide applicability and can obtain acceptable satisfactory solutions in a shorter time. The intelligent heuristic methods currently used in research mainly include taboo search algorithm, simulated annealing algorithm, genetic algorithm, ant colony algorithm, particle swarm algorithm, etc.

[0004] At present, with the extension of urban rail transit lines and the increase in passenger demand, manual compilation methods can no longer meet actual operational needs. In the selection stage, the solution algorithm is mainly based on large-scale integer programming algorithms such as improved branch and bound algorithm, Lagrangian relaxation, and column generation method. However, the integer programming algorithm has low solution efficiency for large-scale crew scheduling problems. Summary of the Invention

[0005] In view of the shortcomings of the prior art, the present invention provides the following technical solutions:

[0006] The subway crew scheduling optimization based on the two-stage generation-selection algorithm includes a generation phase and a selection phase. The selection phase constructs a set covering model to select crew tasks. The generation phase constructs a spatiotemporal state network and imposes constraints on the spatiotemporal state network. The generation of crew tasks is transformed into a path search problem. The improved Floyd algorithm is used to search for paths to generate crew tasks. The final scheduling plan is generated by solving the set covering model using an adaptive genetic algorithm.

[0007] The specific crew task generation includes the following steps:

[0008] a. Initialize parameters, initialize the total number of crew segments N, and the longest continuous driving time Working hours range for each type of shift Time range for each type of shift Time for handover (T) jb and locomotive preparation time T zb ;

[0009] b. Crew segment division: all crew segments are divided according to shift types;

[0010] c. Constructing a connection matrix: number all the morning crew segments according to their start time from early to late, and constructing a crew segment connection matrix based on spatiotemporal connection constraints;

[0011] d. Filter the starting crew segment and select the earliest attendance time of the morning shift As the lower limit of the screening of the crew segments starting from the morning shift, considering the earliest end time of the morning shift and the longest working time, the upper limit of the segments starting from the morning shift is set to Filter all the morning crew segments p with the starting time t s The set of starting crew segments P that meet the conditions morning ;

[0012] e. Improve the Floyd algorithm to search for the shortest path from any starting point to the end point in the spatiotemporal state network, and obtain the shortest path matrix and shortest path length matrix between any two service segments;

[0013] f. Crew task generation: traverse all the morning shift start crew segments and select the shortest path that meets the requirements as the crew task based on the shortest path matrix and the shortest path length matrix;

[0014] g. Crew task screening: For each crew task, determine whether its continuous driving status at any time satisfies the constraints. If not, delete the crew task. At the same time, some of the generated crew tasks may be subsets of other crew tasks. To reduce the complexity of subsequent crew task selection, consider deleting such crew tasks.

[0015] Furthermore, the improved Floyd algorithm in e includes the following steps:

[0016] e1. Initialize the morning shift's shortest path matrix and shortest path length matrix, with the shortest path length being M and the shortest path being empty. Based on the morning shift continuation matrix, traverse all segments to determine whether segment i can be continuation with segment j. If so, update the shortest path length and shortest path, where the shortest path length is the difference between the end time of segment j and the start time of segment i.

[0017] e2. Iteratively update the shortest path, traverse each service segment as the intermediate point k, and determine whether the shortest path is updated; if short(i, j) > short(i, k) + short(k, j), update the shortest path length and shortest path from segment i to segment j; otherwise, go to e3;

[0018] e3. Update multiple shortest paths. If the lengths of two paths are equal, determine whether the shortest path length is M. If it is M, it means that neither path is the shortest path from segment i to segment j. Otherwise, find a new shortest path from segment i to segment j and add it to the shortest path set.

[0019] e4. Repeat steps e2 and e3 until all segments are used as midpoints of the shortest path to complete the shortest path search and obtain the shortest path matrix and shortest path length matrix between any two segments.

[0020] Furthermore, the subway crew scheduling optimization based on the generation-selection two-stage algorithm is characterized in that the connection matrix is:

[0021]

[0022] The service segment continuation matrix is ​​the basis for judging whether two service segments can be connected. Let the service segment continuation matrix be Connect. If segment i and segment j can be connected, then use C 1,j Indicates the connection time. If the connection is not possible, the connection time is set to infinity M. Each crew segment is numbered from morning to night according to the start time; the number of morning segments is N mor .

[0023] Furthermore, the problem of generating the driver and crew's service tasks is transformed into a problem of planning the driver and crew's duty paths in a spatiotemporal state network. The spatiotemporal state network is represented by G(V, E), where V(i, t, w) represents the set of points in the network, and E(i, t, w; i', t', w') represents the set of directed arcs in the network. The spatiotemporal state network is also subject to flow balance constraints, continuous driving time constraints, on-duty time constraints, break time constraints, meal time constraints, spatial connection constraints, and shift working time constraints.

[0024] The specific steps in the selection phase include:

[0025] S1, add the upper limit constraint of the set covering model, and set the upper limit to 3;

[0026]

[0027] x j ={0,1}j=1,2,…,n

[0028] Where m is the number of crew segments, n is the number of feasible crew tasks, and the decision variable is x j , c j is the cost of crew tasks, a ij The coefficient matrix that constitutes the constraints;

[0029] S2, based on the characteristics of the set covering model, uses 0-1 coding to represent individuals;

[0030] S3, initialization parameters, initialization of genetic algorithm population size pop, setting the maximum number of iterations max_iter, crossover probability Mutation probability p m , the number of candidate crew tasks wait_num, penalty factor Uncovered fragment upper limit y max .

[0031] S4, initialize the population and calculate the population fitness; use the greedy algorithm to generate the initial population and obtain the initial crew scheduling plan; by designing the fitness function, solve the fitness function value of each individual, and record the optimal fitness and optimal scheduling plan;

[0032] S5, selection operation, based on the individual fitness function value, uses the tournament method to screen the population and select the parent generation individuals to enter the offspring generation;

[0033] S6, crossover operation, based on single-point crossover, randomly selects two offspring individuals for crossover operation to generate new individuals;

[0034] Design an adaptive crossover probability strategy:

[0035]

[0036] in, represents the crossover probability of the i-th individual; Respectively represent the maximum and minimum values ​​of the adaptive crossover probability; f i represents the fitness function value of individual i, f avg , f min Represent the average and minimum values ​​of the population fitness function respectively; represents the crossover probability between individual i and individual j, and takes the average of the crossover probabilities of the two;

[0037] S7, mutation operation, set mutation probability p m When is 0.1, a gene locus is randomly selected and its value is flipped;

[0038] S8, update the population. After the offspring individuals go through S6 and S7, a new population is generated and the population fitness is calculated in S4.

[0039] S9, optimization and adjustment, judging whether there are uncovered crew segments in the optimal solution, if so, proceed to the next step; otherwise, go to S11;

[0040] S10, filtering out uncovered crew segment sets, selecting the minimum crew tasks from the feasible crew set to cover them, and adding the newly added crew tasks to the optimal scheduling plan;

[0041] S11, generating a final scheduling plan, integrating the crew tasks corresponding to the optimal solution of the genetic algorithm and the newly added crew tasks after optimization and adjustment of the uncovered segments, to generate the final scheduling plan.

[0042] Furthermore, in S1, x j The value is 0-1, x j =1 means that crew task j is included in the final scheduling plan, otherwise x j =0;c j is the cost of the crew task, with the minimum number of crew tasks as the optimization goal, and the cost value is 1; a ij The coefficient matrix that constitutes the constraint conditions has a value of 0-1, a ij =1 means crew shift j contains crew segment i, otherwise a ij =0.

[0043] Furthermore, in said S4, the specific steps include:

[0044] S4.1, initialize the population parameters, initialize the chromosome genes of each individual to all 0, indicating that no crew tasks are selected; for the coefficient matrix A m×n Sum the rows and columns separately. The row sum represents the number of times each crew segment is covered, recorded as A_row, and the crew task set that specifically covers the segment is recorded; the column sum represents the number of segments covered by each crew task, A_column; set the parameter wait_num to indicate the number of alternative crew tasks;

[0045] S4.2, sorting the crew tasks, sorting A_column in descending order according to the number of crew task coverages, and extracting the first wait_num crew tasks with the most coverages as candidate crew tasks;

[0046] S4.3, crew task selection: randomly select a crew task from the candidate crew tasks and add it to the scheduling plan. The chromosome gene position corresponding to the crew task changes from 0 to 1, indicating that the crew task is selected;

[0047] S4.4, update coefficient matrix A m×n , change the row corresponding to the covered fragment from A m×n Delete and recalculate A_row and A_column;

[0048] S4.5, determine whether all crew segments are covered. If all crew segments are covered by the selected crew tasks, go to S4.6; otherwise, go to S4.2;

[0049] S4.6, duplicate task adjustment, determines whether the selected crew task has duplicates, and if so, deletes the duplicate crew task;

[0050] S4.7, generate the initialization population, traverse all individuals based on S4.1 to S4.6 to generate the initialization population;

[0051] S4.8, by designing the fitness function, solve the fitness function value of each individual, and record the optimal fitness and the optimal scheduling plan. The fitness function is the sum of the objective function Z and the penalty function Z'. At the same time, set the upper limit y of the violation constraint max ;

[0052] The fitness function is:

[0053]

[0054] in, is the penalty factor; num The number of uncovered fragments cannot exceed y max , if it exceeds y max , the penalty function is set to infinity;

[0055] S4.9, determine whether the maximum number of iterations of the algorithm has been reached. If so, go to S9; otherwise, go to S5.

[0056] Compared with the existing technology, the technical solution of this application has the following beneficial effects:

[0057] In the crew task generation stage, the present invention divides the crew segments into morning shift, day shift and evening shift, which can effectively reduce the scale of the spatiotemporal state network and improve the efficiency of the Floyd algorithm in searching for crew tasks. At the same time, it can also effectively control the check-in and check-out times of crew tasks of different shift types, facilitating the management of crew personnel. In the crew task selection stage, compared with the randomly generated initial solution, the initial solution generated by the greedy algorithm can effectively improve the convergence speed of the algorithm while ensuring the quality of the optimal solution, and improve the solution efficiency of the set covering model. Compared with manual compilation, the total number of crew tasks is reduced by 14.48%, the total on-duty time is reduced by approximately 9.39%, and the total connection time is reduced by 15.79%. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 This is a schematic diagram of the median multiplication path in the spatiotemporal state network;

[0059] Figure 2 Construct a schematic diagram for the spatiotemporal state network;

[0060] Figure 3 Generate schematic diagrams for crew operation sections;

[0061] Figure 4 It is a coding diagram;

[0062] Figure 5 This is a simplified map of Chengdu Metro Line 5;

[0063] Figure 6 This is a schematic diagram of the time distribution of crew segments and crew operation segments;

[0064] Figure 7 This is a diagram showing the on-duty time and driving time for the morning shift.

[0065] Figure 8 This is a diagram of the on-duty time and driving time for day shift tasks;

[0066] Figure 9 This is a diagram showing the duration of the night shift and the duration of driving.

[0067] Figure 10 This is a diagram showing the duration of the morning shift tasks and the efficiency of the shift;

[0068] Figure 11 This is a diagram showing the duration of day shift tasks and their efficiency;

[0069] Figure 12 This is a diagram showing the duration of night shift tasks and their efficiency. DETAILED DESCRIPTION

[0070] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0071] Example:

[0072] 1. Crew task generation:

[0073] 1.1. The symbols and meanings of the relevant parameter variables of the crew scheduling model are as follows:

[0074] Table 1 Scheduling model set and index explanation

[0075]

[0076]

[0077] 1.2. Construction of spatiotemporal state network and constraints:

[0078] This application transforms the driver and crew task generation problem into the driver and crew duty path planning problem in a spatiotemporal state network. The spatiotemporal state network is represented by G(V, E), where V(i, t, w) represents the set of points in the network and E(i, t, w; i', t', w') represents the set of directed arcs in the network.

[0079] 1.2.1. Flow balance constraints: Flow balance constraints need to be set for all vertices on the path to ensure that the spatiotemporal state network generates valid value multiplication paths:

[0080]

[0081] 1.2.2. Continuous driving time constraints: To prevent driver and passenger fatigue, an upper limit on the continuous driving time of the driver and passenger should be set.

[0082] 1.2.3. On-duty time constraints. On-duty time includes shift handover time, locomotive preparation time, driving time, break time, and meal time. The calculation formula is as follows:

[0083]

[0084] In order to improve the workload balance of drivers and crew members and avoid the occurrence of "off-duty" situations, the on-duty time of crew members is usually restricted by upper and lower limits.

[0085] 1.2.4. Rest time constraints: To avoid fatigue driving, rest time must meet the maximum and minimum rest time constraints.

[0086] 1.2.5. Meal time constraints: This application only considers arranging meals for day shift drivers and crew members. The constraints are as follows:

[0087]

[0088] 1.2.6. Spatial connection constraint. The spatial connection constraint requires that when a driver or crew member is on duty in adjacent service segments, the terminal station of the previous service segment must be the same as the starting station of the next service segment. If the spatial connection condition is not met, the driver or crew member needs to be arranged to take another train as a passenger to the starting station of the next service segment. The spatial connection constraint is as follows:

[0089]

[0090] 1.2.7. Shift work time constraints. To facilitate driver and crew management, the arrival and departure times of each type of shift must meet the corresponding arrival and departure time constraints. The shift work time constraints are as follows:

[0091]

[0092] 1.3. Crew task generation algorithm:

[0093] In a spatiotemporal state network, the generation of crew tasks can be transformed into driver and crew member routing. This application uses a connection matrix of crew segments and crew operation segments and an improved Floyd shortest path algorithm to search for driver and crew member routing in the spatiotemporal state network. The resulting large-scale crew tasks are then filtered based on the constraints associated with the generation of the relevant crew tasks to obtain the final set of crew tasks.

[0094] 1.3.1. Connection Matrix. The service segment connection matrix is ​​the basis for judging whether two service segments can be connected. Let the service segment connection matrix be Connect. If segments i and j can be connected, then use C i,j Indicates the connection time. If the connection is not possible, the connection time is set to infinite M. Number each crew segment from morning to night according to the start time. Taking the morning shift as an example, assume that the number of morning shift segments is N mor , and its crew segment connection matrix is ​​shown in Table 4.

[0095] Table 4 Morning shift crew segment connection matrix

[0096]

[0097]

[0098] When generating work segments, there are many on-duty crew segments. If the improved Floyd algorithm is used to search for on-duty paths, it is easy to cause a "combination explosion" phenomenon. Therefore, in order to avoid the scale of generated crew tasks being too large and not conducive to solving the subsequent selection model, this application combines the day shift crew segment lines into crew work segments, and generates crew tasks based on the crew work segments. The combination method of crew work segments is as follows:

[0099] a. Grouping of crew segments: Dividing all crew segments into different vehicle types;

[0100] b. Initialize parameters, set the upper limit of continuous driving time, determine the crew operation segment combination strategy, and initialize j = 1 to record the search starting point of the crew operation segment;

[0101] c. Crew operation segment generation: traverse all vehicle bottoms and generate operation segments for all crew segments on the same vehicle bottom according to the numbering sequence and combination strategy. The specific generation steps are as follows:

[0102] c1. Check the fragment p in the fragment set with the same bottom of the car j Is it possible to connect with the subsequent adjacent fragment p j+1 combination, if it cannot be combined, then p j The fragment is regarded as a job segment, j=j+1, if it can be combined, then [p j p j+1 ] as a job segment, j = j + 2;

[0103] c2. Let the total number of segments with the same vehicle bottom be N f , judge j<N f , then return to c1, otherwise go to c3;

[0104] c3. Determine whether the last crew segment is covered. If not, add it to the generated operation segment set.

[0105] c4. Traverse all vehicle bottoms and obtain all complete operation section combination solutions;

[0106] d. Adjustment of crew operation segments. The combination scheme of crew operation segments is not unique. Consider modifying the upper limit of continuous driving time and changing the combination strategy of crew operation segments to obtain multiple crew operation segment schemes. Compared with the combination of crew tasks based on different operation segment schemes, the generation of crew tasks based on different operation segment schemes can reduce the solution space of day shift crew tasks. The generation of crew operation segments is as follows: Figure 3 shown.

[0107] 1.3.2 Algorithm steps: Based on the connection matrix of crew segments and crew operation segments, an improved Floyd shortest path algorithm is designed to search for the shortest path from any starting point to the end point in the spatiotemporal state network. The set of crew segments included in the path is the driver and crew duty task. The task generation method for each shift is similar. Taking the morning shift as an example, the specific algorithm steps are as follows:

[0108] a. Initialize parameters, initialize the total number of crew segments N, and the longest continuous driving time Working hours range for each type of shift Time range for each type of shift Time for handover (T) jb and locomotive preparation time T zb ;

[0109] b. Crew segment division: Considering the time constraints of each shift's mission, all crew segments are divided according to shift type;

[0110] c. Constructing a connection matrix: number all the morning crew segments according to their start time from early to late, and constructing a crew segment connection matrix considering the spatiotemporal connection constraints;

[0111] d. Filter the starting crew segment and select the earliest attendance time of the morning shift As the lower limit of the screening of the crew segments starting from the morning shift, considering the earliest end time of the morning shift and the longest working time, the upper limit of the segments starting from the morning shift is set to Filter all the morning crew segments p with the starting time t s The set of starting crew segments P that meet the conditions morning ;

[0112] e. Improve Floyd algorithm to generate crew tasks:

[0113] e1. Initialize the shortest path. Initialize the morning shift shortest path matrix and the shortest path length matrix. The shortest path length is M and the shortest path is empty. Based on the morning shift continuation matrix, traverse all segments to determine whether segment i can be connected to segment j. If so, update the shortest path length and shortest path. The shortest path length is the difference between the end time of segment j and the start time of segment i.

[0114] e2. Iteratively update the shortest path, traverse each service segment as the intermediate point k, and determine whether the shortest path is updated. If short(i,j)>short(i,k)+short(k,j), update the shortest path length and shortest path from segment i to segment j. Otherwise, go to e3.

[0115] e3. Update multiple shortest paths. If the lengths of the two paths are equal, further determine whether the shortest path length is M. If it is M, it means that neither path is the shortest path from segment i to segment j. Otherwise, find a new shortest path from segment i to segment j and add it to the shortest path set.

[0116] e4. Repeat steps e2 and e3 until all segments are used as midpoints of the shortest path to complete the shortest path search and obtain the shortest path matrix and shortest path length matrix between any two segments;

[0117] f. Crew task generation, traverse all the morning shift starting crew segments p∈P morning Based on the shortest path matrix and the shortest path length matrix, the on-duty time range constraints of the morning shift crew task are considered. The shortest path that meets the requirements is selected as the crew task, taking into account the locomotive preparation time and the time for going on duty and leaving duty. The time for going on duty and leaving duty of the driver and crew is calculated based on the crew task, and the on-duty time of the crew task is updated.

[0118] g. Crew task screening. The shortest path algorithm only considers spatiotemporal connectivity constraints when searching for crew tasks, ignoring the continuous driving time state updates of the path. Therefore, for each crew task, we determine whether its continuous driving state at any time multiplied by the time satisfies the constraints. If not, we delete the crew task. Furthermore, some generated crew tasks may be subsets of other crew tasks. To reduce the complexity of subsequent crew task selection, we also consider deleting these types of crew tasks.

[0119] 2. Crew mission selection:

[0120] 2.1、Set Covering Model:

[0121] For the selection of crew tasks in the second stage, this application constructs a set coverage model to select crew tasks. At the same time, in order to avoid the situation where the same crew segment is covered too many times, which is not conducive to the adjustment and optimization of subsequent crew tasks, this application considers improving the set coverage model and adding a coverage upper limit constraint. The upper limit is set to 3:

[0122]

[0123] x j ={0,1}j=1,2,...,n

[0124] Where m is the number of crew segments; n is the number of feasible crew tasks; the decision variable is x j , with a value of 0-1, x j =1 means that crew task j is included in the final scheduling plan, otherwise x j =0;c jThe cost of the crew task. This application considers the minimum number of crew tasks as the optimization goal, so the cost is 1, a ij The coefficient matrix that constitutes the constraint conditions has a value of 0-1, a ij =1 means crew shift j contains crew segment i, otherwise a ij =0;

[0125] 2.2, Adaptive Genetic Algorithm:

[0126] 2.2.1 Coding. Based on the characteristics of the set covering model, this application uses 0-1 coding to represent individuals. Each individual in the population represents a crew scheduling plan, represented by a chromosome. The length of the chromosome is the number of feasible crew tasks. Each gene on the chromosome corresponds to a crew task, and the value is a 0-1 variable, with the same meaning as x. j Similarly, when the value is 1, it means that the task is selected in the scheduling plan, otherwise the scheduling plan does not select the task. The encoding process of the crew task is as follows: Figure 4 shown.

[0127] 2.2.2. Initialize the population. The initialization population is the starting point for iterative optimization of the genetic algorithm. To improve the efficiency of the genetic algorithm, this application uses a greedy algorithm to generate the initial population. The specific steps are as follows:

[0128] a. Initialization parameters: Initialize all individual chromosome genes to 0, indicating that no crew tasks are selected. For the coefficient matrix A m×n Sum the rows and columns separately. The row sum represents the number of times each crew segment is covered, recorded as A_row, and the crew task set that specifically covers the segment is recorded. The column sum represents the number of segments covered by each crew task, A_column. Set the parameter wait_num to represent the number of alternative crew tasks.

[0129] b. Sort the crew tasks. Arrange A_column in descending order according to the number of crew task coverages, and extract the first wait_num crew tasks with the most coverages as candidate crew tasks.

[0130] c. Crew task selection: randomly select a crew task from the candidate crew tasks and add it to the scheduling plan. The chromosome gene position corresponding to the crew task changes from 0 to 1, indicating that the crew task is selected;

[0131] d. Update coefficient matrix A m×n When adding a new crew task, the crew segments that have been covered are no longer considered, so the coefficient matrix A needs to be updated m×n , change the row corresponding to the covered fragment from A m×n Delete and recalculate A_row and A_column;

[0132] e. Determine whether all crew segments are covered. If all crew segments are covered by the selected crew tasks, go to f; otherwise, go to b.

[0133] f. Adjust duplicate tasks: determine whether the selected crew tasks are duplicated. If so, delete the duplicated crew tasks.

[0134] g. Generate an initialization population. Based on a to f, traverse all individuals to generate an initialization population.

[0135] 2.2.3. Fitness function. The fitness function is used to evaluate the quality of an individual. This application sets the fitness function as the sum of the objective function Z and the penalty function Z′. The smaller the value of the fitness function, the better the individual. The penalty function allows for partial violation of the coverage constraint during the iteration of the genetic algorithm. At the same time, an upper limit y for violation of the constraint needs to be set for the convenience of subsequent adjustments. max :

[0136]

[0137] in, is the penalty factor; num The number of uncovered fragments cannot exceed y max , if it exceeds y max , the penalty function is set to infinity;

[0138] 2.2.4. Selection. In genetic algorithms, the selection step involves selecting individuals from the current population to generate the next generation. This application uses a tournament selection method, which randomly selects two individuals from the population each time, compares their fitness, and selects the individual with the better fitness to enter the next generation. The tournament selection method is simple and efficient to implement, requiring only a small amount of random selection and comparison operations, without requiring the entire population to be sorted. Furthermore, through random selection, this method can maintain population diversity and avoid premature convergence to a local optimal solution.

[0139] 2.2.5 Crossover operation. In genetic algorithms, the crossover process is the process of generating new offspring individuals by exchanging a portion of the genes of two parent individuals. This application uses a single-point crossover method, randomly selecting a crossover point and exchanging the gene sequences of the two parent individuals at this crossover point to generate two new offspring individuals. In addition, to balance the algorithm's early global search capabilities and later local search capabilities, this application designs an adaptive crossover probability strategy as follows:

[0140]

[0141] Among them, p c (i) represents the crossover probability of the i-th individual; Respectively represent the maximum and minimum values ​​of the adaptive crossover probability; f i represents the fitness function value of individual i, f avg ,f min Respectively represent the average and minimum values ​​of the population fitness function; p c (i, j) represents the crossover probability between individual i and individual j, and the average of the crossover probabilities is taken;

[0142] 2.2.6 Mutation operation. In genetic algorithms, the mutation process is to increase the diversity of the population by randomly changing the gene sequence of individuals. The mutation probability is usually set between 0.01 and 0.1. Considering the population size characteristics of the crew scheduling problem, setting a smaller mutation probability may not ensure that the mutation operation enriches the diversity of the population. Therefore, this application sets the mutation probability p m is 0.1. Randomly select a gene locus and flip its value, that is, if the value of the gene locus is 1, it becomes 0; if it is 0, it becomes 1;

[0143] 2.2.7 Optimization and Adjustment: After the genetic algorithm converges to the optimal solution, the number of crew segments not covered by the optimal solution is checked. If the number of uncovered crew segments is 0, the scheduling plan corresponding to the optimal solution is the optimal scheduling plan. Otherwise, the set of uncovered crew segments is screened out, and the minimum number of crew tasks is selected from the feasible crew set to cover them. The newly added crew tasks are added to the optimal scheduling plan to form the final scheduling plan.

[0144] 2.3 Algorithm steps:

[0145] The first step is to initialize the parameters, initialize the genetic algorithm population size pop, set the maximum number of iterations max_iter, and the crossover probability Mutation probability p m , the number of candidate crew tasks wait_num, penalty factor Uncovered fragment upper limit y max ;

[0146] The second step is to initialize the population. Based on the greedy algorithm designed above, the initial population is generated to obtain the initial crew scheduling plan.

[0147] The third step is to calculate the fitness of the population. Based on the fitness function designed above, solve the fitness function value of each individual and record the optimal fitness and optimal scheduling plan.

[0148] Step 4: Determine whether the maximum number of iterations of the algorithm has been reached. If so, go to step 9, otherwise proceed to the next step.

[0149] Step 5: Selection operation: Based on the individual fitness function value, the population is screened using the tournament method to select the parent generation individuals to enter the offspring generation;

[0150] Step 6: Crossover operation: Based on single-point crossover, two offspring individuals are randomly selected for crossover operation to generate new individuals.

[0151] Step 7: Mutation operation: Based on the mutation method described above, mutation operation is performed on the offspring individuals;

[0152] Step 8: Update the population. After the offspring individuals undergo crossover mutation, a new population is generated and the process goes to step 3.

[0153] Step 9: Optimize and adjust to determine whether there are uncovered crew segments in the optimal solution. If so, proceed to the next step; otherwise, go to step 11.

[0154] Step 10: Filter out the uncovered crew segments, select the minimum crew tasks from the feasible crew set to cover them, and add the newly added crew tasks to the optimal scheduling plan;

[0155] Step 11: Generate the final scheduling plan by combining the crew tasks corresponding to the optimal solution of the genetic algorithm and the newly added crew tasks after optimization and adjustment of the uncovered segments;

[0156] 3. Case analysis:

[0157] 3.1、Line data:

[0158] 3.1.1 Line Overview. This case study uses Chengdu Metro Line 5 as an example to optimize the subway crew scheduling plan. The line is 49.02 km long and has a total of 41 stations, including 2 parking lots, 1 vehicle depot, and 5 rotation stations, represented by S1 to S8, representing Dafeng Parking Lot, Huagui Road Station, Shixi Park Station, Funing Road Station, Yuanhua Vehicle Depot, Erjiang Temple Station, Huilong Station, and Huilong Parking Lot. The trains on this line run on large and small routes. The large route is Huagui Road-Huilong, and the small route is Shixi Park-Erjiang Temple. The ratio is 2:1. The line diagram is as follows: Figure 5 As shown;

[0159] 3.1.2 Crew segments. Using the train station, depot, and vehicle depot as the dividing points, the entire day's train lines were divided into 686 crew segments. The segments were arranged in chronological order of departure time. Some of the crew segments are shown in Table 5:

[0160] Table 5 Classification of crew segments

[0161]

[0162] The visual analysis of the 686 crew segment operation times obtained by division is performed, such as Figure 6 As shown in the figure, it can be seen that the operation time of more than 90% of the crew segments is distributed around 30 minutes and 70 minutes, and the operation time of a few crew segments is too short, less than 10 minutes;

[0163] 3.2, Scheduling plan:

[0164] 3.2.1. Parameter Setting. Before preparing a crew scheduling plan, it is necessary to first calibrate parameters such as driver and crew continuous driving time, maximum on-duty time, rest time, handover time, and meal time according to the operating company's crew rules and regulations and laws and regulations. In addition to the parameters related to the scheduling model, the relevant parameters of the designed Floyd shortest path algorithm and adaptive genetic algorithm also need to be calibrated, as shown in Table 6:

[0165] Table 6 Related parameter values

[0166]

[0167] 3.2.2 Results Analysis: Based on the relevant parameter settings of the scheduling model, all crew segments were divided into 185 morning shift crew segments, 283 day shift crew segments, and 218 night shift crew segments. Based on the "generate-select" two-stage scheduling algorithm designed in this paper, 124 crew tasks were obtained, including 45 morning shift crew tasks, 37 day shift crew tasks, and 42 night shift crew tasks. The following is a visual analysis of the relevant indicators of the scheduling plan:

[0168] a. How long are you on duty and how long are you driving? Figure 7 、 Figure 8 、 Figure 9 As shown in the figure, when comparing the three types of crew tasks, the on-duty time and driving time of the day shift are both longer than those of the morning and evening shifts. The workload is the largest and the fluctuation is small, indicating a relatively stable work rhythm. This is mainly related to the subway crew shift system. Subway drivers and crew members generally adopt a "night-morning combined ride" system, that is, after performing the evening shift tasks, the drivers and crew members are arranged to rest in the vehicle depot or parking lot, and continue to perform the morning shift tasks the next morning. In order to avoid excessive work intensity causing fatigue driving of the drivers and crew members, the working hours of the morning and evening shifts are both shorter than those of the day shift. In addition, compared with the day shift tasks, the on-duty time and driving time of some morning and evening shift tasks fluctuate greatly, and the distribution is relatively uneven;

[0169] b. Connection time and value multiplication efficiency Figure 10 、 Figure 11 、 Figure 12As shown in the figure, comparing the three types of crew tasks, the morning shift has the shortest connection time and relatively small fluctuations, but the duty efficiency is lower; the day shift has the longest connection time, indicating the greatest workload intensity, while the duty efficiency is relatively stable; the evening shift has the greatest fluctuations in connection time, but the crew's duty efficiency is higher. Overall, in terms of connection time and duty efficiency, the morning and day shifts are relatively stable, while the evening shift has greater fluctuations;

[0170] 3.3、Scheme comparison:

[0171] Based on the same crew segment data, the optimized crew scheduling plan was compared with the manually compiled scheduling plan by on-site staff. Relevant indicators include the number of crew tasks, on-duty time, connection time, and duty efficiency, as shown in Table 7:

[0172] Table 7 Comparison between optimized scheduling plan and manually compiled scheduling plan

[0173]

[0174] Comparing relevant indicators of the optimized staffing scheme with those of the manual staffing scheme reveals that the optimized scheme reduced the number of crew tasks by 14.48%, the total on-duty time by 9.39%, and the total connection time by 15.79%. Furthermore, the optimization of the connection time of crew segments reduced unnecessary work time for drivers and crew members, resulting in a 13.43% increase in their average efficiency. These data demonstrate that the optimized staffing scheme has significant advantages over the manual staffing scheme in reducing the number of drivers and crew members and improving their on-duty efficiency. The optimized scheme allocates tasks and time more efficiently, reduces unnecessary time waste, and makes resource allocation more rational and efficient, thereby improving overall work efficiency and employee job satisfaction.

[0175] (1) Compared with manual compilation, the model algorithm proposed in this application has significant advantages in scheduling. The total number of crew tasks is reduced by 14.48%, the total on-duty time is reduced by approximately 9.39%, and the total connection time is reduced by 15.79%. It can be seen that the scheduling plan compilation method proposed in this paper can effectively improve the duty efficiency of drivers and crew members and reduce the labor costs of enterprises;

[0176] (2) In the crew task generation stage, the crew segments are divided into morning shift, day shift and evening shift, which can effectively reduce the scale of the spatiotemporal state network and improve the efficiency of the Floyd algorithm in searching for crew tasks. At the same time, it can also effectively control the departure and arrival times of crew tasks of different types, which is convenient for the management of crew members.

[0177] (3) In the crew task selection stage, compared with the randomly generated initial solution, the initial solution generated by the greedy algorithm can effectively improve the convergence speed of the algorithm while ensuring the quality of the optimal solution, and improve the solution efficiency of the set covering model.

[0178] The preferred embodiments of the present invention disclosed above are intended only to help illustrate the present invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the present invention to the specific embodiments described. Obviously, many modifications and variations are possible based on the content of this specification. These embodiments are selected and described in detail in this specification to better explain the principles and practical applications of the present invention, thereby enabling those skilled in the art to better understand and utilize the present invention. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A subway crew scheduling optimization method based on a two-stage generation-selection algorithm includes a generation stage and a selection stage, and is characterized by: In the generation phase, a spatiotemporal state network is constructed and constrained, transforming crew task generation into a path search problem. The improved Floyd algorithm is used to search for paths and generate crew tasks. In the selection phase, a set covering model is constructed to select crew tasks, and the final scheduling plan is generated by solving the set covering model through the design of an adaptive genetic algorithm. The specific steps of the selection phase include: S1, add the upper limit constraint of the set covering model, and set the upper limit to 3; x j [{0,1},j=1,2,...,n; Where m is the number of crew segments, n is the number of feasible crew tasks, and the decision variable is x j , c j is the cost of crew tasks, a ij The coefficient matrix that constitutes the constraints; S2, based on the characteristics of the set covering model, uses 0-1 coding to represent individuals; S3, initialization parameters, initialize the genetic algorithm population size pop, set the maximum number of iterations max_iter, the maximum value of the adaptive crossover probability and minimum value Mutation probability p m , the number of alternative crew tasks wait_num, penalty factor Uncovered fragment upper limit y max ; S4, initialize the population and calculate the population fitness; use the greedy algorithm to generate the initial population and obtain the initial crew scheduling plan; by designing the fitness function, solve the fitness function value of each individual, and record the optimal fitness and optimal scheduling plan; S5, selection operation, based on the individual fitness function value, uses the tournament method to screen the population and select the parent generation individuals to enter the offspring generation; S6, crossover operation, based on single-point crossover, randomly selects two offspring individuals for crossover operation to generate new individuals; Design an adaptive crossover probability strategy: in, represents the crossover probability of the i-th individual; Respectively represent the maximum and minimum values ​​of the adaptive crossover probability; f i represents the fitness function value of individual i, f avg , f min Represent the average and minimum values ​​of the population fitness function respectively; represents the crossover probability between individual i and individual j, and takes the average of the crossover probabilities of the two; S7, mutation operation, set mutation probability p m When is 0.1, a gene locus is randomly selected and its value is flipped; S8, update the population. After the offspring individuals go through S6 and S7, a new population is generated and the population fitness is calculated in S4. S9, optimization and adjustment, judging whether there are uncovered crew segments in the optimal solution, if so, proceed to the next step; otherwise, go to S11; S10, filtering out uncovered crew segment sets, selecting the minimum crew tasks from the feasible crew set to cover them, and adding the newly added crew tasks to the optimal scheduling plan; S11, generating a final scheduling plan, integrating the crew tasks corresponding to the optimal solution of the genetic algorithm and the newly added crew tasks after optimization and adjustment of the uncovered segments, to generate the final scheduling plan; The improved Floyd algorithm comprises the following steps: e1. Initialize the morning shift's shortest path matrix and shortest path length matrix, with the shortest path length being M and the shortest path being empty. Based on the morning shift continuation matrix, traverse all segments to determine whether segment i can be continuation with segment j. If so, update the shortest path length and shortest path, where the shortest path length is the difference between the end time of segment j and the start time of segment i. e2. Iteratively update the shortest path, traverse each service segment as the intermediate point k, and determine whether the shortest path is updated; if short(i,j)>short(i,k)+short(k,j), update the shortest path length and shortest path from segment i to segment j, otherwise go to e3; e3. Update multiple shortest paths. If the lengths of two paths are equal, determine whether the shortest path length is M. If it is M, it means that neither path is the shortest path from segment i to segment j. Otherwise, find a new shortest path from segment i to segment j and add it to the shortest path set. e4. Repeat steps e2 and e3 until all segments are used as midpoints of the shortest path to complete the shortest path search and obtain the shortest path matrix and shortest path length matrix between any two segments.

2. The subway crew scheduling optimization method based on the generation-selection two-stage algorithm according to claim 1 is characterized by: In S1, x j The value is 0-1, x j =1 means that crew task j is included in the final scheduling plan, otherwise x j =0;c j is the cost of the crew task, with the minimum number of crew tasks as the optimization goal, and the cost value is 1; a ij The coefficient matrix that constitutes the constraint conditions has a value of 0-1, a ij =1 means crew shift j contains crew segment i, otherwise a ij =0.

3. The subway crew scheduling optimization method based on the generation-selection two-stage algorithm according to claim 1 is characterized in that: In said S4, the specific steps include: S4.1, initialize the population parameters, initialize each individual chromosome gene to all 0, indicating that no crew task is selected; for the coefficient matrix A m×n Sum the rows and columns separately. The row sum represents the number of times each crew segment is covered, recorded as A_row, and the crew task set that specifically covers the segment is recorded; the column sum represents the number of segments covered by each crew task, A_column; set the parameter wait_num to indicate the number of alternative crew tasks; S4.2, sorting the crew tasks, sorting A_column in descending order according to the number of crew task coverages, and extracting the first wait_num crew tasks with the most coverages as candidate crew tasks; S4.3, crew task selection: randomly select a crew task from the candidate crew tasks and add it to the scheduling plan. The chromosome gene position corresponding to the crew task changes from 0 to 1, indicating that the crew task is selected; S4.4, update coefficient matrix A m×n , change the row corresponding to the covered fragment from A m×n Delete and recalculate A_row and A_column; S4.5, determine whether all crew segments are covered. If all crew segments are covered by the selected crew tasks, go to S4.6; otherwise, go to S4.2; S4.6, duplicate task adjustment, determines whether the selected crew task has duplicates, and if so, deletes the duplicate crew task; S4.7, generate the initialization population, traverse all individuals based on S4.1 to S4.6 to generate the initialization population; S4.8, by designing the fitness function, solve the fitness function value of each individual, and record the optimal fitness and the optimal scheduling plan. The fitness function is the sum of the objective function Z and the penalty function Z'. At the same time, set the upper limit y of the violation constraint max ; The fitness function is: in, is the penalty factor; num The number of uncovered fragments cannot exceed y max , if it exceeds y max , the penalty function is set to infinity; S4.9, determine whether the maximum number of iterations of the algorithm has been reached. If so, go to S9; otherwise, go to S5.

4. The subway crew scheduling optimization method based on the generation-selection two-stage algorithm according to claim 1 is characterized in that: Crew task generation includes the following steps: a. Initialize parameters, initialize the total number of crew segments N, and the longest continuous driving time Working hours range for each type of shift Time range for each type of shift Time for handover (T) jb and locomotive preparation time T zb ; b. Crew segment division: all crew segments are divided according to shift types; c. Constructing a connection matrix: number all the morning crew segments according to their start time from early to late, and constructing a crew segment connection matrix based on spatiotemporal connection constraints; d. Filter the starting crew segment and select the earliest attendance time of the morning shift As the lower limit of the screening of the crew segments starting from the morning shift, considering the earliest end time of the morning shift and the longest working time, the upper limit of the segment starting from the morning shift is set to Filter all the morning crew segments p with the starting time t s The set of starting crew segments P that meet the conditions morning ; e. Improve the Floyd algorithm to search for the shortest path from any starting point to the end point in the spatiotemporal state network, and obtain the shortest path matrix and shortest path length matrix between any two service segments; f. Crew task generation: traverse all the morning shift start crew segments and select the shortest path that meets the requirements as the crew task based on the shortest path matrix and the shortest path length matrix; g. Crew task screening: For each crew task, determine whether its continuous driving status at any time satisfies the constraints. If not, delete the crew task. At the same time, some of the generated crew tasks may be subsets of other crew tasks. To reduce the complexity of subsequent crew task selection, consider deleting such crew tasks.