Linear optimization problems are common throughout Google, and the Operations Research team has a few ways to help with them.
These models have the form: $$\begin{array}{lll} (P) & \max & cx\ & s.t. & L\leq Ax\leq U\ & & l\leq x\leq u\ & &x_i\in\mathbb{Z}\quad\forall i\in I \end{array}$$
Where
This module provides:
- The
MPModelRequest
Proto API (inlinear_solver.proto
) for modeling an optimization problem. - The function
SolveMPModel()
(insolve_mp_model.h
) for solving an optimization problem with a solver (Glop, Bop, Sat, SCIP, Gurobi etc.) ModelBuilder
(inmodel_builder.h
) and similar classes in Python and Java to help construct anMPModelRequest
(e.g. to provide linear expressions).MPSolver
which is no longer in development.MPSolver
is largely interoperable with theMPModelRequest
API, although the features supported are not identical.
To begin, skim
-
linear_solver.proto: Specifically, look at
MPModelProto
. This gives a succinct description of what problems can be solved. -
solve_mp_model.h: This file contains the key functions to run various solvers.
Each *_interface.cc file corresponds to one of the solver accessible through the wrapper.
-
Google's BOP (boolean) solver: bop_interface.cc
-
Google's GLOP (lp) solver: glop_interface.cc
-
Gurobi (MIP) solver: gurobi_interface.cc
-
Google's PLDP solver: pdlp_interface.cc
-
SCIP (MIP) solver: scip_interface.cc
-
Google's CP-SAT solver: sat_interface.cc
-
Coin-OR Cbc (MIP) solver: cbc_interface.cc
-
Coin-OR Clp (LP) solver: clp_interface.cc
-
CPLEX (MIP) solver: cplex_interface.cc
-
GLPK (MIP) solver: glpk_interface.cc
-
Xpress (MIP) solver: xpress_interface.cc
-
python: the SWIG code that makes the wrapper available in Python, and its unit tests.
-
java: the SWIG code that makes the wrapper available in Java, and its unit tests.
-
csharp: the SWIG code that makes the wrapper available in C#, and its unit tests.
You can find some canonical examples in samples