Particle Swarm Algorithm for Improved Handling of the Mirrored Traveling Tournament Problem

: In this study, we used a particle swarm optimization (PSO) algorithm to address a variation of the non-deterministic polynomial-time NP-hard traveling tournament problem, which determines the optimal schedule for a double round-robin tournament, for an even number of teams, to minimize the number of trips taken. Our proposed algorithm iteratively explored the search space with a swarm of particles to find near-optimal solutions. We also developed three techniques for updating the particle velocity to move towards optimal points, which randomly select and replace row and column parameters to find candidate positions close to an optimal solution. To further optimize the solution, we calculated the particle cost function, an important consideration within the problem conditions, for team revenues, fans, and media. We compared our computation results with two well-known meta-Heuristics: a genetics algorithm utilizing a swapping method and a Greedy Randomized Adaptive Search Procedure Iterated Local Search algorithm heuristic on a set of 20 teams. Ultimately, the PSO algorithm generated solutions that were comparable, and often superior, to the existing well-known solutions. Our results indicate that our proposed algorithm could aid in reducing the overall budget expenditures of international sports league organizations, which could enable significant monetary savings and increase profit margins.


INTRODUCTION
Traveling tournament problems (TTPs) constitute an important class of non-deterministic polynomial-time (NP)-hard problems that have been thoroughly studied [1][2][3][4]. Generally, TTPs evaluate, and work to reduce, total team travel in league sports tournaments [5,6], which have become a dominant global economic interest. Statistics provided by the Global Sports Market [7,8] in 2018 showed a massive increase in global market revenue, from 46.5 to 90.9 billion USD in 2005 and 2017, respectively, causing a subsequent boost in the sports tourism industry [9]. In sports management, travel budgets are extremely costly, second only to payroll [10]. Thus, it benefits all teams, viewers, fans, leagues, sponsors, and media outlets to minimize travel and the associated costs, which can be done by optimizing game scheduling, especially for tournaments played in multiple locations [11]. Tournament success relies on well-scheduled games, which motivates researchers to find feasible near-optimal solutions for these combinatorial optimization problems.
A variety of tournament formats exist, including single round robin tournaments [12], double round robin tournaments (DRRTs) [13], single elimination tournaments (SETs) [14], and double elimination tournaments [15]. This study focuses primarily on DRRTs, as their NP-Hard nature presents a uniquely motivating challenge that has yet to be fully solved, despite most sports association leagues organizing such tournaments [13,16].
Generally, a DRRT consists of teams that play amongst themselves. The games are usually scheduled as "home" or "away", which indicate games where a team hosts their opponent or plays at the opponent venue, respectively. Sports tournaments also typically include a few breaks, which are defined as three consecutive home or away games. A typical DRRT period is divided equally into halves, with all the first-half games mirrored in the second half so that each pair of teams plays twice during the tournament, once at each venue [17]. The main objective of a TTP, given these constraints, is to find an appropriate home-away assignment that minimizes the total number of trips and/or the total distance travelled for all teams.
The TTP was initially introduced by Easton et al. [18] for scheduling Major League Baseball seasons, and they [19] subsequently proposed a hybrid branch-and-price algorithm, based on lower bounds that were set as the sum of minimum travel distances for each team. Another effective heuristic in sports scheduling was constraint programming, implemented by Henz et al. [20], who used activated propagator libraries to stabilize and perform the required search strategies. Significant improvements in computation time were later achieved by Nemhauser et al. [21]. In addition, Benoist et al. [22] utilized hybridized Lagrange relaxation and constraint programming that expanded to a global bound based on a hierarchical architecture, resulting in improved feasible solutions. Anagnostopoulos et al. [23] presented a simulated annealing heuristic that distinguished and categorized hard and soft constraints. They used a large neighborhood structure, with strategies such as oscillation and reheat, that balanced feasible and infeasible locations within the search space. Additionally, Ribeiro et al. [24] investigated mirrored TTP schedules. Recent advanced heuristic models, such as one developed by Tiago et al. [25], have utilized a novel local search heuristic, whose neighbourhood structure improves its reach within the solution space, compared to other models. Guillermo et al. [26] also designed a solution for the DRRT problem based on an integer programming model, which was successfully adopted by FIFA for its 2018 World Cup qualification process.
In our work, we propose a new TTP variant. Given a set number of teams in a mirrored DRRT, we are tasked with finding an appropriate home and away assignment schedule of play that minimizes the total number of trips taken. Notably, the TTP is a type of geometric graphical problem, similar to the well-studied traveling salesman problem (TSP) and vehicle routing problems, both of which require the total travel distance to be minimized [27] [28]. It can be considered surprising that solving the TTP is more difficult than the TSP [28] because it includes multiple optimization constraints and general objectives regarding issues of fairness, logistics, economics, and organization.
Here, we first introduce the variant TTP and propose a particle swarm optimization (PSO) metaheuristic that searches for a near-optimal TTP solution. This stochastic optimization technique iteratively explores the search space, using a swarm of particles called a population of candidate solutions, according to certain update formulas. Specifically, at each step, individual particles move to their current best known region and swarm position. In this work, we designed three new techniques for updating the velocity of the particle as it moves towards the optimal point. We then further optimize the solution by calculating the particle cost function, an important consideration in the problem conditions. In our opinion, the results presented here may be impactful in reducing overall budget expenditures for organizations associated with international sports leagues, which could save millions of dollars and increase profit margins.
The remainder of this paper is organized as follows. Section 2 describes the detailed problem constraints, while Section 3 thoroughly explains our proposed algorithm. All experimental results are provided and discussed in Section 4. Finally, Section 5 concludes the paper and outlines future work.

PROBLEM FORMULATION
Let T = {1, 2, …, n} be a set of n teams, where n is even. The DRRT structure requires that each team plays every other team both at home and away during the season. Because there are n teams, a total of n(n − 1) games are played by all teams. Notably, this structure is the same as a complete directed graph on n vertices. We set t as the current match day of the tournament, so 1 ≤ t ≤ 2n − 2. Let D = [d ij ] be the symmetric matrix of distances between the home cities of all teams, where d ij represents the distance between the home cities of team t i and team t j .
Over the course of the tournament, each team travels to away games and returns home before their next home game. Let C i (t) be the distance travelled by team i in slot t. To consider travel both before the first game and after the last game, the range of t is extended to include t = 0. Then, the distance travelled by team t i in a complete tournament is: and the total distance travelled by all teams in a complete season is: The TTP objective is minimizing K such that certain constraints are met by the teams. Herein, we formulate and discuss these constraints individually. Let T i, t be an indicator variable, such that T i, t = 1 if team i plays at home against away team X i, t during slot t, and T i, t = 0 if team i plays an away game against team X i, t during slot t. Constraint 1. No team can play against itself, so:

Constraint 3.
Each team can play an opponent at home, or away, only once during the tournament. Therefore, only one game between team i and team j is played at home. From the perspective of the home team, this implies that for each i, j ∈ {1, …, n}:

Constraint 4.
An additional constraint, often used in literature and real-world tournaments alike, is that no team may play more than three consecutive home or away games. For i ∈ {1, …, n} and t∈ {1, …, 2n − 6}: These four constraints limit the solution space. To clarify the objective function, we now formulate functions C i (t), which reflect the distances teams travelled. We consider three situations: 1) travel before the first game is played, 2) travel after the last game is played, and 3) travel occurring between the first and last games. In addition, travel between games t and t + 1 must also be considered. For modelling purposes, we require an additional boundary value, t = 0, to include travel before the first game and after the last game. These endpoints are addressed as follows. For t = 1, we consider team i. If the first game is played at home; then, If the first game is played away, however, the team must travel to the game; hence, Next, we suppose that t = 2n − 2 and consider team i. If the last game is played at home; then, Alternatively, if the last game is played away, the team must travel back home after the game; hence, For t ∈ {1, …, 2n − 4}, travel between games falls into four different categories, outlined here. A team with consecutive home games does not travel: a team with a home game followed by an away game travels to the game: a team with consecutive away games travels from its previous away opponent to the next: (13) and finally, a team with an away game followed by a home game travels home: With the problem thus established, we can now develop and present an algorithm for minimizing K, in accordance with Eq. (2).

ALGORITHM
To develop our algorithm, we divided the TTP into two objectives: 1) to find an appropriate home-away assignment for team schedules and 2) to minimize the collective travel distance of all teams. Here, we introduce the definitions necessary for developing the algorithm. Definition 1. Timetable. A timetable is a matrix with n rows and 2n − 2 columns. Here, we assume that the set of rows is T, which contains values 1 to n, and the set of columns is W, which contains values 1 to 2n − 2. Each entry in a timetable, (t, w), where (t, w) ∈T × W, shows the opponent of team t in week w.
A timetable T should satisfy the following conditions: for each team r ∈ T, the r tℎ row of T is a permutation (⋅) of T⧵{r}; and for any (r, s) ∈ T × S, ((r, s), s) = r. Definition 2. Home-Away Assignment. A homeaway assignment is a matrix M = [m rs ] where m rs ∈ {0, 1}, with rows indexed by T and columns indexed by S. If team r plays at home during slot s, then m rs = 1. Otherwise, m rs = 0. A detailed example is given in Tab. 1.

Particle Swarm Optimization
The PSO algorithm was initially designed by Kennedy and Eberhart [29,30], who were inspired by the natural collective social behaviour of animal groups. This stochastic optimization metaheuristic involves a swarm of particles, initially distributed at random, moving iteratively through a search space. They explore the space based on update formulas, so that each particle moves from its current best-known region toward the best-known position within the entire solution space. Thus, by exploring the space, the particles iteratively converge to an optimal position. When needed, constraint-based PSOs limit the available space in the algorithm.
In our PSO implementation, each particle is influenced by the swarm velocity v. For each algorithm iteration, the particles move within the search space to find their global optimal position. Let pBest be the current best position of a particle, based on its most recent iteration, and let gBest be the best globally known solution among all particles. In each iteration, particles adjust their location by moving toward gBest and redefining the candidate solution. In this way, a history of pBest and gBest locations is stored collectively by the particles, and the space is thus explored. As shown in the Algorithm 1 below, each calculation initiates a particle velocity update, which is discussed in detail in a subsequent section. xi ← xi + vi #Update the particle's position #See Algorithm 3 for Updating process costposition ←Calculate the particle's cost ifcostpositionis better than costpBestthen pBesti ← xi #Update pBest ifcostpositionis better than costgBestthen gBesti ← xi #Update gBest end end end end return gBest

Initialization
Here, we consider a table with N rows and M columns, corresponding to the number of teams and total games played by each team, respectively, so M = 2 ⸱ (N − 1). A table with random entries is referenced as the primitive "particle" in the algorithm. Initially, several of these particles were created using an N × M dynamic table and randomly assigning either 0 or 1 to each position, representing the home or away status of the game and the opponent. Using the mirroring property [31], only the first half of the table, rather than the entire table, needs to be generated. According to the problem definition, the threedimensional table has a depth of 2N − 2, with each depth representing the week in which the teams will play. As described in Section 2, the table has a total of N × N × (2N − 2) cells, which can each be set to 0 or 1. To prepare this table, we define, for each i in the interval 1 ≤ i ≤ n, a Team i set as weeks that have not yet been selected for i th Team. Then, for each Team i and Team j , we randomly select t as the week they should play together, so that tTeam i ∩ Team j , where t is selected randomly with a probability of 1∕ ∥Team i ∩ Team j ∥. We then randomly set the value of X i, j, t to 0 or 1 and X j, i, t = X' i, j, t . It should be noted that the above definition can be approached practically in another way. In this alternate definition, a matrix with n lines and 2N − 2 columns is assumed to contain the rows and columns as the team and the week in which the teams will play, respectively. The X i, t value of the table indicates that the t th Team will play at home or away in t th week, based on a value of 0 or 1, respectively. From the definition of the mirroring problem, it is obvious that for 1 ≤ i ≤ n∕2 X i+n∕2, t = X' i, t . In the following we also constructed a cost function that selects a particle cost value that approaches the global best at each iteration, assigned as gBest. Because our specific discrete problem is a minimization, the particle with the minimum cost is optimal by definition. Algorithm 2 provides the specific procedure for generating a particle and corresponding pBest and setting gBest:

Particle Velocity Update
We calculated the velocity of all particles as they move toward their optimal points, with all initial velocities assumed to be zero. If the initial iteration is i = 1, then at the i th iteration: Accordingly, particle velocities update based on the previous pBest and gBest values. In this study, we considered three sequential velocity updates:  We updated the current position according to the pBest particle. We selected a row and column randomly, as an r 1 parameter, and replaced the c 1 positions in the pBest table from this location with the next value in the position table. Consequently, the parameters w, c 1 , and c 2 tune the algorithm to optimize its results. We use Algorithm 3 to calculate the new positions of current particles.

Particle Cost Calculation
Another integral component for PSO algorithms is cost. To create a cost function, we must consider the problem conditions. According to the problem definition, the traveling cost can be calculated as follows:  For each away game a team travels to, the cost is 1, and this is constant for every trip that every team takes for an away game.  When a team is at an opposing venue for an away game and then returns for a home game, the traveling cost is also 1.  When a team plays an away game, and travels directly to a subsequent away game without returning home in between, the traveling cost is again 1.  When a team plays a home game and is scheduled to host again in their next game, the traveling cost is null.  During the final week of a tournament, if a team plays an away game and then returns home, the traveling cost is 1. Algorithm 4 was used to calculate these travel costs.

pBest and gBest Update
At the end of each particle movement, the pBest and gBest values are updated accordingly. To accomplish this, we decide the costs of the current particle, pBest, and gBest.
If the current cost value is lower than the pBest or gBest costs, the current cost and particle tables should be replaced by the pBest or gBest tables.

Computational Experiments
To evaluate our proposed approach, we implemented it for a TTP using C++ on a personal computer with 3.0 GHz of RAM and 4.0 GB of memory. We set parameters for tournaments with varying numbers of participating teams. For an example four-team tournament, we set the particle number to 4, w, c 1 and c 2 to 3, and the number of rounds to 80. We ran a program with these parameters ten times, to minimize any random effects. Tab. 3 summarizes the corresponding experimental setup.
We then used a set of 20 teams to compare our results with two previous benchmark studies, by Urrutia et al. [32] and by Tinnaluk et al. [33]. The computational results are summarized and compared directly in Table 4. The first column consists of n teams, followed directly by our original results (OR) in the second column. The third column presents the lower bounds (LB) results. The fourth and fifth columns provide the best-known results (BKR) from Tinnaluk et al. [33] and the known results (KR) from Urrutia et al. [32], respectively. Columns 6 to 8 indicate the relative gaps between the OR and LB, OR and KR, and OR and BKR, respectively. Lastly, column 9 denotes the number of Breaks (BS).
The results in Tab. 4 demonstrate that our proposed methods achieve significant improvements over the known results when n is 4, 10, 14, 16, 18, and 20 and over the best known results when n is 4, 10, 14, 16, and 20. In the few remaining cases, our methods generate the same solutions as the known benchmark values. Furthermore, the LB values confirm our solutions as optimal. We also note a large gap when there are 16 teams, which significantly decreases the total travel cost achieved by our method. Thus, in all cases, our proposed PSO algorithm performs as well as, or better than, traditional solution methods. Additionally, we can trace the decreasing cost value of the solution. Fig. 1 shows this decrease for the example of a 20-team tournament.

CONCLUSION AND FUTURE WORK
Given its real-world applications, sports scheduling has become an important area within the international operations research community. In particular, TTPs have attracted significant attention because they are difficult to solve, despite their easy formulation. In this paper, we addressed a TTP that focuses on a mirrored DRRT. In this case, the tournament is divided into two similar halfseasons, where corresponding match pairs are played but they are inverted with respect to the home team. We proposed a PSO metaheuristic for solving this combinatorial optimization problem, which searches for a home-away assignment that reduces the number of trips and subsequently minimizes travel expenditures. To facilitate the search space exploration, we designed three efficient strategies for updating the velocity of particles moving towards global minima. Furthermore, due to the constrained nature of the problem, we developed a cost function to further minimize the travel distance sums.
Computational experiments indicate that our results are comparable, and in some cases superior, to existing solutions for this problem. Notably, this problem remains a challenge to the field despite the significant improvements provided here, and further research is needed to generate high-quality solutions. Although we have proposed PSO metaheuristics here, we additionally plan to investigate other metaheuristics that not only apply to DRRT problems, but also augment and combine multiple tournament graphs within a single season of play. This problem poses a more significant challenge than the DRRT alone but has widespread potential applications and, therefore, warrants more attention. One classic example is the Union of European Football Associations Champions League, wherein the first round of play is a DRRT but the final stage converges to a SET. Finally, we believe that our manuscript makes significant contribution to the field of operation research and sports globally, as it provides quantifiable improvements over previous studies. Thus, our results may impact the overall expenditure budgets of sports league organizations, enabling monetary savings and improved profit margins by significantly reducing traveling costs.