# Considering the Optimization Design of Urban Bus Network Scheduling
## 3 Model Solving
### Genetic Algorithm
Then, the distances between the remaining stations and the selected intermediate station and last station are calculated, and the station with the minimum sum of distances is set as the next intermediate station. This process continues until n-2 intermediate stations are selected for each route. (3) Representation of Public Transit Network: After determining the dimensions of decision variables and selecting route stations, this study represents the solution in two parts to represent the public transit network. The first part consists of determining and ordering the stations for each bus route, and the second part corresponds to the departure intervals for each route. For example, the solution \"12345678959678432518\" represents a network scheme composed of two bus routes with nine stations each. In this representation, the first part \"123456789\" and \"967843251\", respectively, represent the two routes as \"1-2-3-4-5-6-7-8-9\" and \"9-6-7-8-4-3-2-5-1\"; the second part \"5\" and \"8\" represent the departure intervals for the two routes as 5 min and 8 min, respectively. The determination of stations for each route in the network follows the selection process outlined in step (2). Additionally, the departure intervals for each route are randomly generated within the range of 5 min to 15 min. (4) This encoding method first determines the dimensions of the network, the number of bus routes, and the number of stations for each route. By selecting the stations for each route and randomly generating the corresponding departure intervals, it determines the stations and departure intervals for each route in the initial network. As a result, the constructed initial solutions are feasible solutions with relatively good fitness, greatly reducing the complexity of computation. Furthermore, this encoding method ensures the feasibility of solutions throughout the subsequent operations of the genetic algorithm, eliminating the generation of infeasible solutions. 2. Population Initialization: Following the construction format of initial solutions in step I, individuals are randomly generated for the population, with the random generation repeated as per the set population size. The population is represented as \(\mathrm{P}=\left\{\mathrm{x}^{\mathrm{i}}|\mathrm{i}=1,2,\ldots,\mu\right\}\), where \(\mu\) is the population size, and each individual is represented as \(\mathrm{x}^{\mathrm{i}}=\left(\mathrm{x}_{1}^{\mathrm{i}},\mathrm{x}_{2}^{ \mathrm{i}},\ldots,\mathrm{x}_{n}^{\mathrm{i}}\right)\), where \(\mathrm{n}\) is the dimension of decision variables, specifically, the sum of the number of stations for each route and the number of routes in the network. 3. Fitness Evaluation: Take the decision variables determined during initialization and input them into the synchronized optimization model for the network and scheduling. Calculate the passenger time cost and public transportation operating cost under this initial network, obtaining the objective function value. The model constructed in this paper aims to minimize the passenger time cost and public transportation operating cost. The fitness of each individual is evaluated based on the minimum value of the objective function. 4. Selection: In this study, the roulette wheel selection method is used to select individuals in the population. The principle of this selection method is to calculate the probability of an individual appearing in the next generation based on its fitness value. Individuals are then selected to form the offspring population according to this probability. The advantage of this method is that individuals with better fitness values have a higher probability of being selected. 5. Crossover: After the selection operation is performed on the population, single-point crossover is carried out using randomly generated crossover points. 6. Mutation: Individuals in the population are subjected to mutation operations based on the mutation probability \(\mathrm{P}_{\mathrm{m}}\).