# Considering the Optimization Design of Urban Bus Network Scheduling
## 3 Model Solving
### Genetic Algorithm  
The genetic algorithm (GA) was proposed by [PERSON] in the 1970s, and is an intelligent optimization algorithm that applies the evolutionary principle of \"survival of the fittest\" from nature to solving optimization problems. It is an iterative algorithm that searches for the optimal solution and is known for its wide applicability, efficiency, and good global performance [39]. Combining the above-mentioned network and scheduling synchronization optimization model, further designing a genetic algorithm for the research problem, the specific design process is as follows:  
1. Encoding of Solutions: The network and synchronization optimization model established in this chapter is mainly for determining the stations, order, and departure intervals of each bus route in the bus network. Therefore, it is necessary to encode the stations, order, and departure intervals of each route as decision variables. The encoding of solutions uses the floating-point encoding method, which is suitable for genetic algorithm encoding with large ranges, high precision requirements, and large genetic search spaces. It is particularly effective for the high-dimensional problem of large-scale network stations in this study. The initial solution construction method in this paper is as follows:  
(1) Determination of Decision Variable Dimensions: When performing encoding operations for solutions, it is necessary to first determine the dimensions of the decision variables. In the case of this study where the network stations and bus route departure intervals are set as decision variables, the dimensions of the decision variables are determined by the number of stations n and the number of routes K (corresponding to the respective departure intervals for each route). The determination of the number of stations on each route is based on factors such as the route length and average distance between stations. Typically, the number of stations on a bus route is set between 15 and 30. The specific number of stations should be set based on the actual design of the route length and average station distance, with n denoting the number of stations. The determination of the number of routes is typically based on the product of the number of stations on each route and is usually within 1 to 2 times the difference between the total number of bus network stations and the number of stations on each route. In this case, the number of routes is denoted as K. Apart from network stations, the decision variables also include the setting of departure intervals for each route, with dimensions consistent with the number of routes K. Therefore, the dimension of decision variables in this study is set as: K * n + K. During the actual optimization process of the network, the final number of stations and routes should be further determined by the transit network designer based on actual requirements. (2) Selection of Route Stations After determining the number of stations and routes in the network, the range of the number of bus routes and corresponding stations is also set. To further improve computational efficiency and facilitate subsequent operations, the stations for each route are selected to construct feasible initial solutions with good fitness. The specific process is as follows: (a) Setting of First and Last Stations: The roulette wheel selection method is used to select the first and last stations of the routes. The passenger demand for each OD station is converted into a proportion of the total passenger demand, and this proportion is used as the probability of setting the OD as the first and last station of a route. K pairs of OD are selected based on these probabilities to serve as the first and last stations of each route. (b) Setting of Intermediate Stations: After determining the first and last stations of the routes, the distances between all other network stations and the first and last stations are calculated. The station with the minimum sum of distances to the first and last stations is set as an intermediate station.