
Beginner-friendly Python walkthrough: solving a binary quadratic problem with gurobipy
I created a practical Python walkthrough for programmers interested in mathematical optimization with gurobipy.
The example formulates Max-Cut as a quadratic binary optimization problem and covers:
- creating a Gurobi model;
- adding binary decision variables;
- constructing a quadratic objective from a matrix;
- calling optimize();
- extracting the binary solution and objective value;
- benchmarking randomly generated problem instances;
- and understanding how MIPGap affects runtime.
It assumes familiarity with Python, and Jupyter notebooks, but no previous optimization experience.
Video: https://youtu.be/TB1ny8o4ImQ
Code: https://github.com/supreethmv/Quantum-Algorithms-and-Applications
I’d particularly appreciate feedback on whether the gurobipy implementation and explanation are approachable for Python developers encountering quadratic optimization for the first time.