Sei sulla pagina 1di 5

Genetic Algorithms in solving railway traffic control conflicts

Ioana Vidrasan, Tiberiu Letia supervizor Technical University of Cluj-Napoca Automatics Department

Abstract: The railway traffic control is a complex problem even with the current technical progress. The usage of genetic algorithms is perfect in dealing with resource conflicts and optimization of the time resource because they provide the best routes for the train with every new generation. The first step in developing the algorithm is encoding the resources such as parts of the railway into chromosomes. These form the current population. The next populations are obtained by mutation or crossover. The selection of the individuals for the next generation is based on a fitness function and on the elitism method. After 100 generations the process stops if the solutions fit the imposed expectation. The results obtained through simulations show the best solution for the train routes and the eligibility of the genetic algorithm. I. INTRODUCTION The railway traffic control remains a problem even with the progress registered in the train manufacturing technologies. Therefore the developing of new, better, optimal algorithms is an important issue. Genetic algorithms are based on the evolutionist theory and medical genetics. In the IT field these algorithms are used in the evolution of programs or in optimizations. The basic components of a railway track are: lines, semaphores, train detectors, switches and stations platforms. In order to control the train traffic there must be a fixed trains schedule. This schedule is usually made by the train dispatcher or by trains itself, if they are controlled using collaborative algorithms. Switches are used to change the line. The portion in which the switch decision must be made is an interlocking. The railway structure proposed for solving contains 2 train stations with 4 platforms each, 12 sensors, 24semaphores. The stations are connected by 2 lines. The four trains are displayed like in fig. 1. The resources used by the trains are the lines R1R10, platforms from P11-P14 and P21-P24, interlocking I0, I1, I2, I3, train detectors D1-D10. The control is realized throw the semaphores S1-S20 and the switches. But still the most important resource remains time, which will be the factor that will be determining the validation of a solution. The simulation time will be 100 time units corresponding to an hour. Each train has specifications and a task. The specifications referring to speed are the same for each train. The time needed by a train to cross a resource is posted in fig.1 on each corresponding resource and there are also train detectors, semaphores for both ways of the line, platforms and interlocking.

Figure 1. Railway station structure.

The train tasks are enumerated below: a) T1 leaves from station1 P11 to station2 P23. b) T2 leaves from station1 P13 to station2 P22. c) T3 leaves from station2 P22 to station1 P14. d) T4 leaves from station2 P23 to station1 P13. The train specifications are: a) T1 leaves at 0 time units, arrives at 23. b) T2 leaves at 23 time units, arrives at 65. c) T3 leaves at 10 time units, arrives at 40. d) T4 leaves at 30 time units, arrives at 50. II. STATE OF ART The problem of generating a safe, effective and optimum solution for controlling a train railway was in the attention of many researchers. In the book Railway Operation and Control, Joern Pachl comprehends the basic principles of train traffic control and railway operations. Also he describes the components of the railways and their optimum usage, like switches, semaphores, interlocking and others. There are plenty articles relating to the optimization of the railway in the presence of disturbances, like in [6] where the solution are formed in such a manner in which even if disturbances appear, the overall process remains constant. The optimization algorithms used by them are Simulated Annealing and Tabu Search. P.J. Fleming [2] talks in his studies about the complexity of genetic algorithms and their usage in combinational problems.

In his work GA are providing a multiple, Pareto-optimal solutions for controlling off-line systems. The problem of finding a suitable route for trains is similar with the problem of The Travelling Salesman using Genetic algorithms. This problem is discussed and solved by K. Bryant, in his article [7] and by Randy L. Haupt, Sue Ellen Haupt in their book [8]. The salesmen travel into a specific number of cities and the GA searches for the shortest route in which they can stop by once in every city.
Thread +run()

There are a few routes from which the salesman can choose from. The optimum solutions seem to be given by applying genetic algorithms after 300 generation if the number of cities is 5 so that the chromosome is formed by 5 genes, one for each city. The information contained in the genes can be in the format of bites 0 and 1 or the a value which can represent the order in which they go in the cities.

MainClass +ArrayList Pop; +Simulator S; +main(String[] args)

Simulator +ArrayList popUrm; +run() +showResults() TrainGUI + +showResults() +initGUI() Structure N extPopulation +ArrayList popUrm +setPopUrm() +getPopUrm() +NextPopulation()

Chromosome +ArrayList Pop +setCr() +getCr() +getCrTrain()

Interlocking +Switch S1; +getRoute() +int fit +Fitness(Chromosome Cr) Semaphore Switch +getPosition() +state +getState() Fitness

Figure 2. The UML Class Diagram.

III. THE GENETIC ALGHORITHM In G.A the basic unit is the chromosome. The chromosome is composed by genes and each gene contains specific information about one feature of the individual. The initial population contains 40 individuals coded in chromosomes. In each new population the weakest chromosomes will be left out. The algorithm is implemented like in fig. 2; it will implement the railway structure and simulate it by using the future population class and by having the confirmation from the Fitness class. The steps of elaborating the algorithm are: encoding of the chromosome, selection of individuals for generating offspring, forming the new generations by crossover and mutation, usage of the fitness function to determine the strength of a population to form a solution. A. Encoding As specified by M. Obitko [5], there are 4 ways in encoding a chromosome: binary encoding, encoding by permutations, encoding by value or tree encoding. The most common method is binary encoding, in which the chromosome is just a string of bites. But for this problem the information needed for generating a train route is very difficult to implement in one bit. Therefore the encoding method used will be value encoding.

The chromosome contains information regarding the route of all the trains. It will be composed of 0-9 digits which represent the additional time a train needs to cross a resource, line or platform. The interlocking will be implemented in the chromosome because it will be useful in simulating a train route. The interlocking introduces a delay of 1 period of time, if used.
TABLE I EXAMPLE OF A CHROMOSOME Chromosome1 Values of the resources P11, .., P24, (Ch.1) Parts R1, R2, R3, , R10, I1,I2,I3,I4 Ch.1 T1 10000101101010001212 Ch.1 T2 00101000000010101112 Ch.1 T3 00010100000101122211 Ch.1 T4 00100100050010001121

As a result the chromosome will be formed of 4 string values, each containing the resource allocation for a train. Even if one train doesnt use a resource the chromosome will still contain a gene for that resource. They will be like recessive genes, genes which dont contain useful information for the current solution, but after mutation or crossover maybe they will be forming a solution for the problem. The delays that compose the chromosome are justified by the fact that in a real context the train needs to decrease the speed when they switch resources.

B. Selection There a four selection methods: Roulette selection, Rank selection, Steady-State selection and Elitism selection. The Roulette selection picks the chromosomes with the higher Fitness function and orders the descending so that the first chromosome is the one with the higher fit. The rank selection is somehow similar with the previous method but now the chromosomes receive a rank. The chromosome with the higher fit will be first rank and the second fitted for the solution will be rank two, and so on. Steady-State selection is a method in which a part of the weak chromosomes are replaces by the ones that have the higher Fitness function. In the Elitism selection some of the best and fittest chromosomes are copied in the next population. The selection of the chromosomes is important because it prevents weak chromosomes to be selected for the next generation. The methods used are Selection by rank and by elitism. The method used for selecting the best train route will be Elitism selection combined with rank selection. So the best solutions wont be lost in the new generation, they will be copied as they are. For creating the offspring only the highest rank chromosomes will be selected for mutation and crossover. So the resulting population should be better with each new generation, like in nature only the strongest survive.

Also if the gene corresponds to a train resource cant have a negative value and if the value is bigger than 9 the program will throw exceptions because by default the maximum value for a delay shouldnt be more then 9. The algorithm has the following steps: 1. get current population as ArrayList; 2. initialize random=Random_Number, mutPt; 3. initialize a new chromosome ch1,newPop; 4. for (i=every chromosome) 5. mutPt=1+random(ch_length); 6. val=mutPt; 7. if (mutPt is interlocking) 8. if(mutPt in [1,3]) 9. val-=val; 10 else val+=val; 11. else // point corresponds to a resource 12. if(mutPt in [3,9]) 13. val-=val 14. else val+=val; 15. end if; 16. ch1=chromosome[i-1].substring(1,mutPt-1) + val + chromosome[i-1].substring(mutPt+1,ch_length); 17. nexPop.add(ch1); 18. end for; 19. return newPopulation 2. Crossover This process requires 3 individuals from the current population. The birth of a new individual is done by combining the information in 3 consecutive chromosomes. The selection of the information for the offspring is provided random in 2 crossover points.

Figure 3. The weight of chromosomes after selection by rank. [5]

C. Crossover and Mutation In genetics there are 2 ways of obtaining new individuals: crossover and mutation. Mutation appears when an individual suffers a transformation which alters one of its genes, making him a new individual with a new genetic inheritance. Crossover is a process that involves 2 individuals. By mixing their genes they give birth to new individual with a new genetic inheritance. The survival of the new individual depends of the strength of their characteristics. So the algorithm will try to simulate the natural behavior of life, creating new and better solutions for our problem. 1. Mutation This process requires one individual and the used method will be One point mutation. Only one gene of the chromosome will be altered. The selection of the characteristic that will be changed is done random. In the random mutation point we increase or decrease the value of that bit. But there are a lot of limitations that need to be taken into account. If the respective gene is corresponding to the interlocking then the value isnt allowed to be outside the interval [1, 3], because there arent other solutions for a train route.

Figure 4. Example of two point Crossover.

The conditions that result from the chromosome type refer to positions of the crossover points. These points need to be distinct and ordered ascending so that there wont be any problems in selecting the part of the chromosome for creating a new solution. The algorithm has the following steps: 1. get current population as ArrayList; 2. initialize random=Random_Number, crossPt1, CrossPt2; 3. initialize a new chromosome ch1,nextPop; 4. for (i=every chromosome) 5. crossPt1=1+random(ch_length/3); 6. crossPt1=ch_length/3+random(2*ch_length/3); 7. ch1=chromosome[i-1].substring(1,crossPt1) + chromosome[i].substring(crossPt1,crossPt2) + chromosome[i-1].substring(crossPt2,ch_length); 8. nexPop.add(ch1); 9 . end for; 10. return nextPopulation

D. Fitness Function The fitness function is the mechanism used for determine the strength of a solution based on a mathematical model like in formula (1). This function will be applied to each new generation in the selection process in order to separate the weak solution from the better ones. So the fastest route will be considered as the best solution. Each branch of the chromosome contains the cost of using a ( ) There are 4 trains in our system and 20 reresource sources represented in the chromosomes. The cost represents time in this case. The Fitness function accumulates all these costs for each train. Only the Fitness function isnt enough for determine if an individual is solution for controlling the trains. By simulating the route generated by the algorithm it becomes more obvious if the trains are in collision at a moment of time. If two train routes are in collision then the value of the Fitness function will be increased by 100 which represent penalties for a solution as the collision cost: ( ). If one train doesnt accomplish its task and specification there will be more penalties added to the Fitness function. As an example, if one train arrives 2 time units later then its specific time then the value of the Fitness function is increased by ( ). 2 as in the delay cost The formula for the Fitness function used in implementation is: ( ) ( ) ( ) ( ) (1) IV. RESULTS The results of applying the genetic algorithm are established by simulating the train behavior. In this purpose the simulator will determine the train behavior in a time stamp of 1 minute, in a total simulation time of 50 time units, not 100 as planned and expected. Each train must respect its specifications and task. But if there isnt any solution for the required specifications then the best fitting solution will be accepted as a solution for the problem. After 100 new generations the best result for scheduling the trains is the individual with the genes: 100001001101010000101000010010000010100101010000101 000000101010101001000100000101011100. The Fitness function for the solution is 30, there are no delays for any train and there are no routes in conflict. So the only parameters in the function were the resource delays with the maximum value of 1. That means that the trains will have to switch relay fast between lines and platforms, without reducing to much the speed. The total time that trains need in order be reach their destination is total 73 and for each train: a) b) c) d) T1 needs 28 minutes to reach P22 T2 needs 25 minutes to reach P23 T3 needs 26 minutes to reach P14 T4 needs 24 minutes to reach P13

never used, they are recessive genes. The most used resource is the line R4.
TABLE 2
THE OCUPATION OF THE RESOUCE WITH THE CURRENT SOLUTION resource s / Trains T1 T2 T3 T4

P 1 1 2 0 0 0

P 1 3 0 2 0 2

P 1 4 0 0 2 0

P 2 2 2 0 2 0

P 2 3 0 2 0 2

R 1

R 2

R 4

R 5

R 6

R 7

R 9

R 1 0 0 0 3 3

I 0

I 1

I 2

I 3

3 0 0 0

3 0 0 0

6 6 0 6

0 0 5 0

8 8 0 0

0 0 7 7

0 3 3 0

2 2 0 2

0 0 2 2

2 2 0 0

0 0 2 0

The train schedule can be adjusted so that even if the train has some minor delays due to perturbations, weather forecast or some unpredictable events that can take place in real life, it will still reach its destination in time.

Figure 5. The resultant train routes.

As in fig. 4 the each train has one unique route. There are no collisions between trains, the resultant intersection figured above represent parallel resources. V. CONCLUSIONS Even if the algorithm continues after 100 generations the probability that the solution fits better the specifications remains constant. The fitness function remains constant. There are enough 48 time units of time to determine a route with these specifications. So we can double the time a train reaches its destination, in order to prevent further delays which can cause all the other trains to miss their destination or to wait for a resource to be released. In some cases there isnt enough to generate 100 new generations in in GA, because the processes require more precision. So the algorithm can continue to generate new individual solutions for infinity, depending on the computational power of the equipment. It is proven that the probability of a solution with better fitness function increases insignificant after approximately 300 generations.

As a result each train respects its specifications and accomplishes its task. The resources P12, P21, P24, R3 and R8 are

REFERENCES
[1] [2] [3] [4] [5] Joern Pachl, Railway Operation and Control, VDT Rail Publishing Mounthlake Terrace USA, Rochester WA, April 2002. P.J. Fleming, R.C. Purshouse, Genetic algorithms in control systems engineering, Shefield UK, 2001. A. Haxthausen, J. Peleska, Formal Development and Verification of a Distributed Railway Control System, 2000 IEEE. R. BORNDO RFER, THOMAS SCHLECHTE, Solving Railway Track Allocation Problems, 2007. Marek Obitko, Introduction to Genetic Algorithms, 1998.

[6]

[7] [8]

J. Trnquist, J. A. Persson, Train Traffic Deviation Handling Using Tabu Search and Simulated Annealing, Hawaii International Conference on System Science,2005. K. Bryant, A. Benjamin, Genetic Algorithms and the Traveling Salesman Problem, December 2000, department of Mathematics. Randy L. Haupt, Sue Ellen Haupt, Practical Genetic Algorithms, second edition, jul 2004

Potrebbero piacerti anche