optimax is a comprehensive optimization toolkit designed for the SF2812 Applied Linear Optimization course at KTH. It provides a web-based interface to visualize and solve problems covering the core syllabus topics, including Linear Programming, Integer Programming, Column Generation, Lagrangian Relaxation, and Stochastic Programming.
This project implements solvers and visualizations for the following course modules:
-
Module:
api/solvers/lp.py -
Features: Solves LP problems using
scipy.optimize.linprog(Highs method, which includes Simplex/Interior Point). Visualizes 2D feasible regions and objective functions.
-
Module:
api/solvers/ip.py -
Features: Custom Branch-and-Bound implementation for integer programming. Visualizes the search tree, showing branching decisions, bounds, and pruning.
- Module:
api/solvers/colgen.py - Features: Solves the Cutting Stock Problem using Column Generation. Iteratively solves the Master Problem (LP) and Subproblem (Knapsack) to generate improving patterns.
-
Module:
api/solvers/lagrangian.py -
Features: Solves the Generalized Assignment Problem (GAP) using Lagrangian Relaxation. Visualizes the convergence of the Lower Bound using subgradient optimization.
-
Module:
api/solvers/stochastic.py -
Features: Solves the Two-Stage Stochastic Farmer's Problem (Deterministic Equivalent). Visualizes the optimal first-stage decision (planting) and second-stage profit distribution across scenarios.
- Backend: Python (FastAPI, Scipy, Numpy, Pulp, NetworkX, Matplotlib)
- Frontend: React (Vite)
- Deployment: Vercel (Serverless Python Functions)
-
Clone the repository:
git clone https://github.com/dhruvhaldar/optimax.git cd optimax -
Create and Activate Virtual Environment:
- Windows:
python -m venv venv .\venv\Scripts\activate
- macOS/Linux:
python -m venv venv source venv/bin/activate
- Windows:
-
Install Backend Dependencies:
pip install -r requirements.txt
-
Run the API Server:
python -m uvicorn api.index:app --reload
The API will be available at
http://localhost:8000/api. -
Run the Frontend:
cd frontend npm install npm run devThe frontend will run at
http://localhost:5173.
This project is configured for deployment on Vercel.
The vercel.json file handles routing for the FastAPI backend (api/index.py) and the static React frontend.
MIT License. See LICENSE for details.



