Skip to content

Dev-Toledo/ttp-serie-b-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚽ Optimization of Brazilian Serie B Logistics (TTP)

Python Algorithm Problem

An Advanced Operations Research project solving the Traveling Tournament Problem (TTP) for the Brazilian Football Championship (Serie B). The solution utilizes Genetic Algorithms (GA) to minimize the total travel distance of 20 teams across a continental-sized country.

📌 Context & Challenge

The Brazilian Serie B involves 20 teams playing a double round-robin tournament (380 matches total). Due to Brazil's continental dimensions, logistics are a critical cost driver and performance factor.

  • The Goal: Construct a schedule that minimizes total travel distance while satisfying strict CBF (Brazilian Football Confederation) constraints.
  • Complexity: The problem is modeled as a variation of the TTP, known to be NP-Hard.

🧠 Solution Approach: Genetic Algorithm

Unlike standard scheduling, this project separates the problem into two layers:

  1. Opponent Sequencing: Generated via the Polygon Method (Canonical 1-factorization).
  2. Home/Away Assignment: Optimized via a Genetic Algorithm to find the best travel patterns.

Algorithm Parameters

  • Population: 200 Chromosomes
  • Generations: 1000
  • Crossover Rate: 80%
  • Mutation Rate: 5%
  • Selection: Tournament Method
  • Fitness Function: Total Distance + Penalties (for rule violations)

📊 Key Results

The model was benchmarked against the official CBF schedule and historical data.

Metric Official Schedule Optimized Model (GA) Improvement
Total Distance ~880,515 km ~777,721 km -10.91%
Logistics Efficiency Low High Verified

Impact: The solution achieved a reduction of approximately 102,794 Km in total travel distance compared to the official table, demonstrating significant potential for cost savings and player fatigue reduction.

🛠️ Tech Stack

  • Language: Python
  • Libraries: NumPy (Matrix operations), Math (Haversine distance).
  • Logic: Evolutionary Computation, Combinatorial Optimization.

🚀 How to Run

  1. Clone the repo:
    git clone [https://github.com/SeuUsuario/ttp-serie-b-solver.git](https://github.com/SeuUsuario/ttp-serie-b-solver.git)
  2. Run the Optimizer:
    python src/genetic_algorithm.py
  3. Output: The script prints the best schedule found, the total distance, and validation of constraints.

👨‍💻 Author

Caio Toledo

Academic Advisor: Júnior César Bonafim - FATEC Ribeirão Preto

About

Solving the Traveling Tournament Problem (TTP) for the Brazilian Championship (Serie B). Genetic Algorithm optimization achieving 10.9% reduction in total travel distance.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages