## MathOpt

MathOpt is a library for modeling and solving mathematical optimization
problems, for example, linear programming problems (LPs) or mixed integer
programming problems (MIPs). MathOpt separates modeling from solving, allowing
users to switch between solution methods by changing an enum (and a build
dependency) to select their solver.

Watch this [video](https://www.youtube.com/watch?v=L5b4YQowXBg) for brief
introduction to MathOpt from the 2023 JuMP Conference Presentation.

## MathOpt Features

MathOpt models can contain:

- integer or continuous variables
- linear or quadratic constraints
- linear or quadratic objectives
- multiple hierarchical objectives
- specialized MIP constraints (SOS, indicator, more to come)
- some conic constraints (second order cone, more to come)

Models are defined independently of any solver and solvers can be swapped
interchangeably. MathOpt supports the following solvers:

- [GLOP](https://developers.google.com/optimization/lp/lp_advanced)
- [PDLP](https://developers.google.com/optimization/lp/pdlp_math)
- [CP-SAT](https://developers.google.com/optimization/cp/cp_solver)
- [SCIP](https://www.scipopt.org/)
- [GLPK](https://www.gnu.org/software/glpk/)
- [Gurobi](https://www.gurobi.com) (requires licence)
- [FICO Xpress](https://www.fico.com/en/products/fico-xpress-optimization) (requires licence)
- [HiGHS](https://highs.dev/)

MathOpt provides client libraries in [C++](https://github.com/google/or-tools/tree/stable/ortools/math_opt/cpp) and [Python](https://github.com/google/or-tools/tree/stable/ortools/math_opt/python) to build your
optimization model. [Examples](https://github.com/google/or-tools/tree/stable/ortools/math_opt/samples) for both libraries are also available on
GitHub.

> [!NOTE]
> **Note:** Check out the [MathOpt service](https://developers.google.com/optimization/service/math_opt/overview) for remote solves.

MathOpt supports many advanced features, including:

- Infeasibility Analysis (Irreducible Infeasible Set or IIS), Gurobi only
- Incremental Solving
- Callbacks
- Duality
- Primal and Dual rays
- Suboptimal primal and dual solutions
- Variable and constraint deletions
- Warm starts (by solution or basis)
- Detailed termination reason
- Branching priority
- Interruption
- Many solver independent parameters