# Solving the Urban Transit Routing Problem Using a Cat Swarm Optimization-Based Algorithm
## 3 The Proposed CSO-Based Algorithm
### The Proposed CSO-Based Approach
#### 3.1.8 Setting the Algorithm's Parameters Values  
Most parameters' values used by the algorithm (presented in Table 3) are determined based on efficiency requirements, constraints of computational resources and the respective literature [18; 50; 51; 52]. The determination of the rest parameters' values was conducted after exhaustive experiments (by trial and error), and the selected values where the ones that utilize the algorithm's performance. These parameters are the following:  
Figure 3: Pseudocode of the seeking mode process. 1. Create _SMP_ copies of current agent where _SMP_ is the size of seeking memory pool
2. **for** (every copy of current agent)
3. {
4. Pick a random route \(r\) in current copy
5. Pick a random place \(p\) in route \(r\) which is not empty/_i.e., has value # -1_
6. **for** (every node \(n\) of the road network)
7. {
8. Store value _r(p)_ of place \(p\) of route \(r\) to a temporary place _temp_
9. Set node \(n\) in place \(p\) of route _r/i.e., set r(p) equal to \(n\)
10. **if** (connectivity **or** max duration are violated **or** cycles/backtracks are created)
11. Restore route \(r\) to its original state
12. **Else**
13. Finalize substitution of _r(p)_**and** do not step to another node, exiting current for loop
14. } 15. } 16. Set_finit_ equal to \(\infty\) // _finit_ is the minimum fitness value among the copies of current agent
17. Set _finit_ equal to 0 // _finit_ is the maximum fitness value among the copies of current agent
18. **for**every copy of current agent)
19. {
20. **if** (_finit_= fitness value of current copy)
21. Set _finit_ equal to fitness value of current copy
22. **if** (_finit_= fitness value of current copy)
23. Set _finit_ equal to fitness value of current copy
24. } 25. **for** (every copy of current agent)
26. {
27. **if** (_finit_ is equal to _finit_)
28. Set probability of peeking current copy equal to 1.0
29. **Else**
30. Set probability of peeking current copy equal to \(\frac{|\textit{ Fitness}_{copy}-\textit{finit}|}{\textit{finit}-\textit{finit}}\), where \(\textit{Fitness}_{copy}\) is the fitness of current copy
31. } 32. Pick a copy from seeking memory pool according to its probability
33. Set current agent equal to picked copy  
Number of iterations: The number of iterations is determined mainly by constraints related to the execution time of the algorithm. Because the size of the solution space is increasing as the size of the road network increases (see Figures 5 and 6 for example), the number of generations depends on the size of the network and is fixed to 300 + number of nodes of the network, since we noticed that after 300 iterations the improvement in the algorithm's performance, for the tested networks, is insignificant  
Figure 4: Pseudocode of the seeking mode process. Initial number of agents (cats): The number of agents originally created, from which the most robust are selected, is mainly determined by constraints on computing resources (memory). For relatively small networks, this number can be set to a bigger value, and for larger networks, a smaller value should be selected. After many experiments, this number has values from 135 to 1000. Number of active agents (cats): The number of active agents used throughout the execution of the algorithm is mainly determined by the requirement that the algorithm completion time must be limited to acceptable frames. For relatively small networks. this number can be set to a bigger value, and for larger networks, a smaller value should be selected. After many experiments, this number has values from 50 to 500. Coefficients \(\omega_{1}\), \(\omega_{2}\), \(\omega_{3}\): By adjusting the values of \(\omega_{1}\), \(\omega_{2}\)and \(\omega_{3}\), we can control the effect of the terms \(F_{1}\), \(F_{2}\) and \(F_{3}\) on the fitness value (see Section 3.1.3 and Equation (1)). When performing the experimental tests, it was observed that when the number of routes in the route set is small, solutions can be found in which there is a non-zero percentage of unsatisfactory transfer demands.