Skip to content

Ahmed-Idani/Optimization-of-Football-Player-Rotations-Using-Gurobi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚽ Optimization of Football Player Rotations Using Gurobi

📋 Table of Contents


🏗️ About the Project

This project demonstrates how to optimize football player rotations across multiple matches using Gurobi, a mathematical optimization solver. Coaches must consider factors such as:

  • Player fatigue and physicality.
  • Match difficulty.
  • Goals per game.

The app ensures optimal performance over a season by using mathematical modeling to generate the best possible team lineup for each game.


✨ Features

  • Frontend:

    • Choose your favorite team from a visually appealing UI.
    • Setup matches with opponent names and difficulty levels.
    • View optimized results for player rotations.
  • Backend:

    • Solve optimization problems using Gurobi.
    • APIs to manage teams, players, and match setups.
    • Scalable architecture for advanced features.

🚀 Getting Started

Prerequisites

Before running the project, ensure you have the following installed:

  • Python 3.8+
  • Node.js (v16+ recommended)
  • Gurobi Optimizer
  • A modern web browser

Installation

  1. Clone the Repository:

    git clone https://github.com/HIJOdelIDANII/Optimization-of-Football-Player-Rotations-Using-Gurobi.git
    cd Optimization-of-Football-Player-Rotations-Using-Gurobi
  2. Backend Setup:

    • Navigate to the backend folder:
      cd backend
    • Install dependencies:
      pip install -r requirements.txt
    • Run the backend server:
      python main.py
  3. Frontend Setup:

    • Navigate to the frontend folder:
      cd ../frontend
    • Install dependencies:
      npm install
    • Start the development server:
      npm run dev

🛠️ Usage

Backend API

Available Routes

Route Method Description
/api/teams/ GET Fetch all teams.
/api/teams/<team_name>/players/ GET Fetch players of a specific team.
/api/optimise/<team_name>/ POST Get optimized player rotations for matches.

Example POST to /api/optimise/<team_name>/

Request Body:

{
  "numberMatches": 5,
  "matchesChosen": {
    "1": {"opponent": "Everton", "difficulty": 1.0},
    "2": {"opponent": "Chelsea", "difficulty": 1.5},
    "3": {"opponent": "Arsenal", "difficulty": 0.5}
  }
}

Response:

{
  "lineups": [
    {"match": 1, "players": ["Player A", "Player B", "Player C"], "goals": 2.7, "opponent": "Everton"},
    {"match": 2, "players": ["Player A", "Player D", "Player E"], "goals": 1.8, "opponent": "Chelsea"}
  ],
  "player_statistics": [
    {"player": "Player A", "matches_played": 2},
    {"player": "Player B", "matches_played": 1}
  ],
  "total_goals": 4.5
}

Frontend Interface

  1. Choose Your Favorite Team:

    • Select a team from the home page.
  2. Set Up Matches:

    • Add matches by specifying the opponent and difficulty level.
  3. View Results:

    • See the optimal player rotations and statistics.

📁 Directory Structure

📦 Optimization-of-Football-Player-Rotations-Using-Gurobi
├── backend
│   ├── instance/
│   ├── __pycache__/
│   ├── BackendLogic.py
│   ├── config.py
│   ├── main.py
│   ├── models.py
│   ├── requirements.txt
├── frontend
│   ├── node_modules/
│   ├── public/
│   ├── src/
│   │   ├── components/
│   │   ├── pages/
│   │   └── App.jsx
│   ├── package.json
│   ├── vite.config.js
└── .gitignore

💻 Technologies Used

  • Backend: Python, Flask, Gurobi
  • Frontend: React, Vite
  • Database: SQLite
  • Styling: CSS

🔮 Future Improvements

  • Integrate player injury data into the optimization model.
  • Visualize player statistics with interactive charts.
  • Expand support to more leagues and teams.

👨‍💻 Author

HIJOdelIDANII

About

Optimize football player rotations with this tool, balancing fatigue, physicality and match difficulty to maximize team performance over a season while avoiding overuse of key players.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors