Sie sind auf Seite 1von 8

XIII INTERNATIONAL CONFERENCE - SYSTEM MODELLING and CONTROL SMC2009

OCTOBER 12-14, 2009, Zakopane, Poland

A NEW GENETIC ALGORITHM FOR OPTIMAL ROUTES GENERATION IN PUBLIC TRANSPORT NETWORK
Jolanta Koszelew, Anna Piwo ska
Bialystok Technical University, Wiejska 45A, 15-351 Bialystok, Poland jolka@wi.pb.edu.pl, amzs@wi.pb.edu.pl Abstract - This paper presents a new genetic algorithm, called Routes Generation Genetic Algorithm (RGGA), for determining routes with optimal travel time. The algorithm is illustrated on the simple example of transportation network. The method was implemented and tested on the real transport network in Bialystok city. Effectiveness of the method was compared with another algorithm Routes Generation Matrix Algorithm (RGMA) which is based on special transfer matrices.

1. Introduction
There are many economic and ecological arguments for using public transport in modern cities. Therefore portals with journey planners are very popular. Users of such system determine source and destination point of the travel, the start time, their preferences and system returns as a result, information about optimal routes. In practice, public transport users preferences may be various, but the most important of them are: a minimal number of transfers and a minimal travel time. Finding routes with minimal number of transfers is not a difficult problem, but generating routes with minimal time of realization is much more complexity task. Standard shortest path algorithms [3] find the shortest paths in networks with static and deterministic links, meanwhile algorithms for a scheduled transportation network are timedependent. Moreover, standard algorithms considered graphs with one kind of links. Graph which models a public transport network includes two kinds of edges: directed links which represent connections between bus stops and undirected edges correspond to the travel between each pair of neighboring nodes (bus stops) on foot. Additionally, with each node in graphs that represent transportation network, is concerned detail information about: timetables, coordinates of bus stops, etc. This information is necessarily to determine weights of links during realization of the algorithm. Those three differences between graphs in standard shortest paths problem and public transportation networks cause that complexity of algorithms which solve routing problem in such original network representation, increase. Special approximation methods have to be compiled for a construction of optimal paths in this model. There are only few methods which solve this special kind of routing problem. Some of them are based on KSP problem (K-shortest paths problem) [1] and label-setting technique [10]. Another use transfer matrix [5-6]. Authors present a new original genetic algorithm, called RGGA for determination routes with optimal travel time. The method was implemented and tested on the real public transport network in Bialystok city. Effectiveness of the method was compared with another solution, called RGMA, which is described in [5]. RGMA uses two special matrices, called transfer matrix and minimal distance matrix and realizes the following assumption: routes with minimal (or close to minimal)

number of transfers or with minimal length (number of bus stops on the route) have probably optimal time of realization. Next section includes definition of optimal routes generation problem and description of public transport network model. In the third section authors present RGGA and illustrates it by a simple example. Section 4 is concerned on the comparison of effectiveness of both methods (RGGA and RGMA) in two aspects: time complexity and quality of results. This comparison is based on experimental results which were performed on realistic data. The paper ends section with some remarks about future work on improving of RGGA.

2. Network Model and Problem Definition


A public transportation network in our model is represented as a bimodal weighted graph [7] G = V , E, t , where V is a set of nodes, E is a set of edges and t is a function of the weights. Each node in G corresponds to a certain transport station. We assume, for simplification, that there is only one kind of public transportation the bus, so each node corresponds to a bus stop. This assumption does not limit the applications of the presented methods. We also assume that bus stops are represented with numbers from 1 to n. The directed edge (i, j , l ) E is an element of the set E, the bus line number l connects the stop number i as a source point and the stop number j as a destination. One directed edge called bus link corresponds to one possibility of the connection between two stops. Each edge has a weight tij which is equal to the travel time (in minutes) between nodes i and j which can be determined on the base of timetables. A set of edges is bimodal because it includes, besides directed links, undirected walk links. The undirected edge {i, j} E is an element of the set E, if walk time in minutes between i and j stops is not greater then limitw parameter. The value of limitw parameter has a big influence on the number of network links (density of graph). The tij value for undirected edge {i, j} called walk link is equal to walk time in minutes between i and j stops. We assume, for simplification, that a walk time is determine as an Euclidian distance between bus stops. It is very important to take the walk links into consideration, because public transportation network is very rare in small cities or peripherals districts of big cities, and walk links increases chance of finding at least one route between bus stops, which are located in such regions. A graph representation of public transportation network is shown in Fig. 1. It is a very simple example of the network which includes only nine bus stops. In the real world the number of nodes is equal to 1500 for the city with 250 ts. citizens. Formal definition of our problem is the following. At the input we have: graph of transportation network, timetables times of departures for each stops and each line, source point of the travel, destination point of the travel, starting time of the travel, number of the resulting paths (k), maximum number of transfers (maxt) and limit for walk links. maxt parameter is required only for RGMA method. At the output we want to have the set of resulting routes, contains at most k quasioptimal paths with minimal time of realization (in minutes), with at most maxt transfers assumption important only for RGMA. The tij values are marked in Fig. 1 only for walk links, because only this kind of links is time independent. Weights for bus links are strongly dependent on the starting time parameter and can be compute only during the realization of algorithm. We can determine tij values for bus links using timetables. We assume, for simplification, that each bus line has the same timetables for each weekday.

Fig. 1. Representation of a simple transportation network (different styles of bus links mark different bus lines)

3. The Routes Generation Genetic Algorithm


The RGGA starts with a population of P randomly generated initial solutions of our problem. Each solution is a valid route and is generated in a special way, taking into account the graph of transportation network. Starting from source point of the travel, we randomly choose the number of bus line (or walk link if presented) and the next bus stop, from all possible edges coming out from this node with equal probability. The bus stop at the end of selected edge is then considered as the starting node, from which we again randomly choose the edge and so on. This process continues until we reach destination point and the whole route is completed. Additional assumption is that every bus stop can be included to the route only once (there are no loops). Note that in this problem, unlike in TSP problem [4-8], chromosomes lengths are not equal. Fig. 2 presents example of two individuals for network illustrated in Fig. 1. Source point of the travel is bus stop 1, destination point of the travel is bus stop 9 and starting time of the travel is 6 a.m. Each rectangle represents one gene. The first field of a gene denotes a number of bus stop, the second arrival time at this bus stop, the third departure time from this bus stop.
1 6:00 6:10
1 6:00 6:01 6 6:03 6:03

2 6:13 6:20
7 6:04 6:04

8 6:23 6:23
8 6:05 6:05

5 6:26 6:26
4 6:07 6:20

9 6:28

5 6:23 6:26

9 6:28

Fig. 2. Example of two individuals in the RGGA

The next step is to evaluate individuals in the initial population by means of the fitness function. It measures the quality of the represented solution - the time of realization of the tour, in minutes. Since we have minimalization problem, the smaller fitness value, the fitter individual is. Once we have the genetic representation and the fitness function defined, the RGGA starts to improve initial population through repetitive application of selection and crossover. In our experiments we used tournament selection with elite strategy [9]: E best solutions are copied to the next population and the remaining individuals are selected through P-E tournaments. Since chromosomes lengths are different, we presented a new heuristic crossover operator, adjusted to our problem. In the first step, individuals, except the elite, are randomly coupled. Then, each couple is tested if crossover can take place. If two parents do not have at least one common bus stop, crossover can not be done and parents remain unchanged. Crossover is implemented in the following way. First we randomly choose one common bus stop, it will we the crossing point. Then we exchange fragments of tours from the crossing point to the end bus stop in two parent individuals. The example is presented in Fig. 3. In this figure numbers in squares denote bus stop numbers and numbers above lines denote bus line numbers. Each bus line is drawn with different line.

1 4

1 2

2 2
parents

1 2

3 5

4 1

2 1

2 2

1 2

3 5

offsprings

Fig. 3. Crossover operator (bus stop number 2 is the crossing point)

After crossover, we must correct offspring individuals in two ways. First we eliminate so called bus stop loops. An individual contains a bus stop loop if a given bus stop is presented twice in a tour. Elimination of such loop is simply deleting all bus stops between repeating bus stop. The second step is to eliminate so called line loops. A line loop is presented when series of one bus line is separated by another bus line. In this situation we simply replace appearance of another bus line by original one. The last step of RGGA is mutation operator. It can take place for each individual in the population, except the elite, with the probability p m . When a given individual is to be mutated, the algorithm first randomly choose two bus stops between which more then one edge exists. Then the edge between bus stops is replaced by another one, randomly chosen with equal probability. These steps are repeated a predefined number of generations and as the result we obtain the population from the last generation, sorted by the time of realization of tours.

4. Experimental Results
The number of computer tests was conducted on real data of transportation network in Bialystok city. This network consists of about 700 bus stops, connected by about 30 bus lines. There was assumption about length of walk links they were limited to 15 minutes. The parameters of RGGA was: P=100, E=2, pm=0.1.

The first experiment was conducted on the route from Pulaskiego street (bus stop Kindergarten) to Warszawska street (bus stop Piastowska). This case is an example of the set of routes (labeled A) in which the source point and the destination point of travel are connected with at least one direct bus line. Another feature of this kind of routes is their length: they are relatively long. The input parameters of both algorithms were: start time was equal to 7:00 a.m., kind of day of week: weekday, length of walk links was equal to 5 minutes. The RGGA returned as a result the rout with time realization equal to 14 minutes (route without transfers, one bus line nr 2), the RGMA returned the rout with time realization equal to 25 minutes (route with one transfer, bus lines nr 26 and 28). These results are illustrated on the below picture.

Fig 4. The best results found by the RGGA (on the top) and the RGMA (on the bottom) the first experiment

The second experiment was conducted on the route from the Church of Saint Jadwiga bus stop to Moniuszki street bus stop. This case is an example of the set of routes (labeled B) with many possibilities of reaching from the source point to the destination point of travel. Another feature of this kind of routes is relatively large number of required transfers. The input parameters of both algorithms were: start time was equal to 4:00 p.m., kind of day of week: weekday, length of walk links was equal to 10 minutes. The RGGA returned as a result the rout with time realization equal

to 29 minutes (route with one transfer, bus lines nr 20 and 6), the RGMA returned the rout with time realization equal to 36 minutes (route with one transfer, bus lines nr 21 and 13). These results are illustrated on the below picture.

Fig 5. The best results found by the RGGA (on the top) and the RGMA (on the bottom) the second experiment

For the purpose of comparison of two algorithms, we carried out two kinds of experiments, first for investigating the time complexity of algorithms, second for examining quality of returned routes (time of realization). The comparison of the time complexity of RGGA and RGMA is presented in Fig. 6.

Fig. 6 The comparison of the time complexity of RGGA and RGMA

On the horizontal axis there are points representing the minimal number of bus stops on a route. These vaules were computed as a result of standard BFS graph search method [2] and they are correlated with difficulty of the route. On the vertical axis there is marked time of execution in ms (processor Pentium 3.0 GHz). Each possible route with a given number of the minimal number of bu-stops was tested by two algorithms at starting time equal to 7:00 a.m., weekday. The executing time of algorithms was averaged over every tested routes. We can see that RGGA performes in shorter time than RGMA. For the purpose of comparison of quality of algorithms, we performed another set of tests. We performed 20 experiments, 10 for routes from set A and 10 for routes from set B. On the vertical axis we marked time of the reazlization of the routes, averaged over 20 test cases, for starting time of the journey from 5:00 a.m. to 10:00 p.m. during weekday (horizontal axis).

Fig. 7 The comparison of the quality of RGMA (on the top) and RGGA (on the bottom)

Observing above Fig. 7 one can see that both algorithms return results with comparable quality. We can conclude on the base of our experiments that RGGA returns results as good as RGMA, but is significantly faster.

5. Conclusions
The reason of developing a new heuristic algorithm was high complexity of matrix based algorithms [5-6]. The time of computing sub-optimal routes in matrix algorithm was not acceptable for big and dense transportation networks. Computer experiments have shown that genetic algorithm (RGGA) generates routes as good as matrix based algorithms (RGMA), but significantly faster. The problem with RGGA is its premature convergence which can be solved by including to the algorithm additional mechanisms [4-8]. Another method of improving RGGA can be based on special heuristics of generation of initial population, taking into account geographical location of bus stops on routes. The future work will be focused on testing RGGA on bigger and more dense transportation networks, for example for Warsaw city. We also plan to test algorithm on country-wide bus network (PKS in Poland).

References [1] R. K. Ahuja, R. Orlin, J.B. Pallotino, S. & Scutella, M.G. Dynamic shortest path minimizing travel times and costs, Networks, vol. 41(4), pp. 197-205, 2003 [2]T. H. Cormen, C. E. Leiserson, Ronald L. Rivest, and C. Stein, Introduction to Algorithms (Second Edition), MIT Press, 2001 [3] E. Dijkstra, A note on two problems in connection with graphs, Mumerische Mathematik 1, pp 269-271, 1959 [4] D. E. Goldberg, Algorytmy genetyczne i ich zastosowania. WNT, Warsaw, 1995 [5] J. Koszelew, Two methods of quasi-optimal routes generation in public transportation network, IEEE. Computer Society, pp 231-236, 2008 [6] J. Koszelew, Approximation method to route generation in public transportation network, Polish Journal Environment Studies - Vol.17, nr 4C, pp 418-422, 2008 [7] J. Koszelew, The Theoretical Framework of Optimization of Public Transport Travel, 6th International Conference on Computer Information Systems and Industrial Management Applications IEEE-CISIM07, Elk, Poland, eds. Khalid Saeed, Ajith Abraham, Romuald Mosdorf;[org.] Bialystok Technical University [et al.], pp 65-70, 2007 [8] Z. Michalewicz: Algorytmy genetyczne + struktury danych = programy ewolucyjne. WNT, Warsaw, 1996 [9] M. Mitchell: An Introduction to Genetic Algorithms. MIT Press, Cambridge, MA, 1996 [10] Q. WU, J. K. Hartley, Accommodating User Preferences in the Optimization of Public Transport Travel, International Journal of Simulation Systems, Science & Technology: Applied Modeling & Simulation, pp 12-25, 2004

Das könnte Ihnen auch gefallen