Skip to content

tmaringgele/streaming-package-comperator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

102 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Griaß eich! 🐄 This solution to the GenDev Challenge 2024 employs ✨Mixed Integer Programming.✨

🚀 Live Demo

Demo: https://streaming-package-comperator.vercel.app/
(Note: This is hosted on a free tier. The first query may take up to one minute because the backend is automatically deactivated when idle.)

💡 Main Idea

At the core of this application lies a mathematical model known as a Mixed Integer Program (MIP), which determines the optimal combination of streaming packages to minimize the cost of watching a given set of games. 📊

This mathematical model is solved using the PuLP solver in Python. 🐍

📽️ Watch this video where I showcase the application and delve deeper into the implementation and future improvements.

📚 For those who want to dive deeper into the mathematical details, see the explanation_for_nerds.ipynb file, which provides a detailed explanation of the underlying math.

🔧 Possible Future Improvements

Frontend 🖥️:

  • 📋 Implement a table view where users can select specific games.
  • 🏆 Add a tournament selection feature.
  • 💰 Create a 'set maximum cost' option: Remove the worst deals iteratively until total_cost < maximum_cost.

Backend 🛠️:

  • 📂 Currently, each query accesses the CSV files as provided in the problem statement. Accessing the data through a merged CSV file or a database could significantly improve speed.
  • 🔄 The backend processes the dataframe in multiple loops. Consolidating operations into fewer loops could enhance performance.
  • ✂️ The pruning logic (removal of the worst deals) is currently implemented on the frontend. Moving this to the backend could further optimize performance.
  • ⏰ Lower time granularity for large queries. Adjusting the timedelta to one week or month instead of daily intervals could dramatically reduce computational complexity.
  • ⚡ Use a more advanced solver like Gurobi or CPLEX for faster and more efficient performance, especially for larger queries or more complex constraints.

Theory/Math 📐:

  • ❓ After pruning, there is no guarantee that the model remains optimal. Implementing methods from Sensitivity Analysis could help verify if re-solving is necessary.
  • 📦 There are alternative ways to model this use case and related scenarios. For example, if users set a maximum monthly or yearly budget, it could be modeled as a Cutting Stock Problem.

🛠️ Local Setup

🔙 Backend

  1. Ensure Python and pip are installed 🐍.

  2. Install the required dependencies:

    cd backend
    pip install -r requirements.txt
  3. Run the Flask application 🚀:

    python app.py

The backend should now be running on http://127.0.0.1:5000.


🌐 Frontend

  1. Ensure Node.js and npm are installed 🌳.

  2. Rename example.env to .env:

    • Linux/macOS 🐧:

      cd frontend
      mv example.env .env
    • Windows 🪟:

      cd frontend
      ren example.env .env
  3. Install the required dependencies:

    npm i
  4. Start the development server 🔥:

    npm run dev

The frontend should now be running on http://localhost:5173/.

About

Repo for the GenDev Hackathon 2024 @ Check24

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors