# What is the purpose of libraries like Pyomo and Google OR tools?

I'm new to the OR world, and trying to learn the various tools available. I originally thought that Pyomo and Google OR tools were open source alternatives to commercial solvers like Gurobi or CPLEX.

But now I'm discovering more and more that they are used more as a sort of interface to those solvers, not as an alternative to them.

Why is this the case? What purpose do these libraries serve? Gurobi for example already has a Python interface, why would I need Pyomo to interface with it?

• You don't need Pyomo to interface with Gurobi from Python. But Pyomo lets you easily switch among several solvers without having to reenter the model for each solver. Sep 10 '19 at 18:18

Pyomo is an algebraic modeling language and allows users to easily represent optimization problems at a high-level (by defining variables, constraints, objective, etc.). Pyomo then provides interfaces to a variety of optimization solvers including Gurobi and CPLEX. This allows an optimization model to be formulated once and then a user can experiment with using different solvers to actually solve the problem. Pyomo also provides several modeling extensions for representing high-level modeling constructs (e.g. differential equations or disjunctions) and general implementations of transformations for converting these constructs to a form that off-the-shelf optimization solvers can solve.

• I would just add that it also provides interfaces to free and open source solvers, and is therefore an alternative to commercial solvers with their API. Jan 16 at 9:39

OR-Tools is a set of solver:

• A very popular Routing Library built on top of a traditional constraint programming solver
• An award winning CP-SAT solver that combines Constraint Programming techniques, SAT solver search and Boolean centric approach, MIP solver techniques like cuts and linear relaxation, and Large Neighborhood search
• A Simplex solver: GLOP
• A Boolean linear solver (BOP) geared towards finding good solutions fast
• A Linear solver interface that offers a unified API for GLOP, BOP, and third_party solvers like Coin OR, SCIP, CPLEX, Gurobi, and XPRESS MP.
• Graph and Flow algorithms

OR-Tools is implemented in C++ and offers interfaces in Python, Java, and .NET.

As you can see, Linear and MIP solver are just one tool among many.

Now, to answer you questions, the goal of OR-Tools is to interact with the scientific community and the OR community. This being said, we are very pleased to see a large community of commercial users relying on it for their business, and we do our best to support them.

These tools are just what we use internally to optimize Google.

• Thanks Laurent. I'm trying to look for resources on running Constrained Optimization solvers on GCP - and so far I can't find any cloud native ways of doing so. The best I can come up with is containerize a solver like Gurobi and then run it on GKE. Do you have any resources or papers on running constrained optimization on the cloud? Sep 11 '19 at 21:57

Different solvers have their own interfaces (for example Cplex studio by IBM). You can use the specific syntax for those IDE or interfaces to input your model and then use the solver to solve it. Although the logic behind them all is the same but those languages or syntaxes are usually differing from one solver to the other. If you need to solve your problem by using more than one solver you will need a general form of problem which can be converted to the solver specific problems. This conversion is done using some Algebraic Modeling Languages (AML). Pyomo is an AML that extends Python to include objects for mathematical modeling. After generating your problem in Pyomo you will be able to use many solvers to solve it. Some of those are glpk(open source), CPLEX, Gurobi, BARON and many more.

When you use interfaces of specific solver in python you may won't have the ability to solve the same problem with other solvers.

Google created OR-Tools in C++, but you can also use it with Python, Java, or C#. So Pyomo and Google OR-tools are packages that can be called by python (in case of Google or: some other platforms) and are including many classes (for example ConcreteModel() in Pyomo) with many attributes (for example Objective in ConcreteModel class).