Files
ortools-clone/ortools/linear_solver
..
2025-07-23 23:12:34 +02:00
2025-08-11 10:38:33 +02:00
2025-08-06 10:57:31 +02:00
2025-01-10 11:35:44 +01:00
2025-08-22 14:21:26 +00:00
2025-01-10 11:35:44 +01:00
2025-08-22 14:21:26 +00:00
2025-07-23 23:12:34 +02:00
2025-03-13 15:56:35 +01:00
2023-08-25 03:51:16 +02:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-07-23 23:12:34 +02:00
2025-07-23 23:12:34 +02:00
2025-07-23 23:12:34 +02:00
2025-07-23 23:12:34 +02:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-03-04 21:09:32 +01:00
2025-03-04 21:09:32 +01:00
2025-01-10 11:35:44 +01:00
2025-06-16 18:03:59 +02:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2023-12-08 14:57:53 +01:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-07-23 23:12:34 +02:00
2025-01-10 11:35:44 +01:00
2025-01-10 11:35:44 +01:00
2025-08-22 14:24:48 +02:00
2025-07-23 23:12:34 +02:00
2025-07-23 23:12:34 +02:00

Linear Programming (LP) and Integer Programming (IP) Solver

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 A\in\mathbb{R}^{m\times n}, l,u,c\in\mathbb{R}^n, L,U\in\mathbb{R}^m, n,m\in\mathbb{N}^+ and I\subseteq\{1,\ldots,n\}.

This module provides:

  • The MPModelRequest Proto API (in linear_solver.proto) for modeling an optimization problem.
  • The function SolveMPModel() (in solve_mp_model.h) for solving an optimization problem with a solver (Glop, Bop, Sat, SCIP, Gurobi etc.)
  • ModelBuilder (in model_builder.h) and similar classes in Python and Java to help construct an MPModelRequest (e.g. to provide linear expressions).
  • MPSolver which is no longer in development. MPSolver is largely interoperable with the MPModelRequest 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.

Available solvers

Each *_interface.cc file corresponds to one of the solver accessible through the wrapper.

Wrappers

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

Samples

You can find some canonical examples in samples