AI-generated Key Takeaways
-
Google's OR-Tools provides the MPSolver for solving linear programming (LP) and mixed integer programming (MIP) problems.
-
The CP-SAT solver can be used for pure integer programming problems.
-
OR-Tools offers various examples demonstrating MPSolver usage with different solvers like Glop and SCIP for LP, MIP, bin packing, and assignment problems.
-
Developers can control the search time limit for solvers using the
set_time_limit
function across different programming languages like Python, C++, Java, and C#.
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:
- Solving the Stigler diet problem using Glop
- Solving an LP problem using Glop
- Solving a MIP problem using SCIP
- Solving a bin packing problem using SCIP
- Solving an assignment problem using CP-SAT
- Using arrays to define a model
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 milliseconds when using Glop.
Python
solver.set_time_limit(15)
C++
solver->set_time_limit(15);
Java
solver.setTimeLimit(15)
C#
solver.SetTimeLimit(15);