MPSolver Interface

Google's open source software suite for optimization, OR-Tools, provides the MPSolver wrapper for solving linear programming and mixed integer programming problems.

To solve pure integer programming problems you can also use the CP-SAT solver.

Examples

The following pages provide examples that illustrate MPSolver usage:

Common tasks

The following section demonstrates common tasks related to solving LPs and MIPs.

Time limits

The example below shows how to set a search time limit of 15 seconds when using Glop.

Python

solver.set_time_limit(15)

C++

solver->set_time_limit(15);

Java

solver.setTimeLimit(15)

C#

solver.SetTimeLimit(15);

See Solving an LP problem for a full example that sets a time limit.