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/.

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes