25
$\begingroup$

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?

$\endgroup$
1
  • 9
    $\begingroup$ 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. $\endgroup$ Commented Sep 10, 2019 at 18:18

3 Answers 3

22
$\begingroup$

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.

$\endgroup$
3
  • 2
    $\begingroup$ 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. $\endgroup$
    – Kuifje
    Commented Jan 16, 2021 at 9:39
  • $\begingroup$ @Kuifje, could you name drop one or more of these open source solvers? $\endgroup$
    – jbuddy_13
    Commented Sep 5, 2022 at 14:58
  • $\begingroup$ CBC, GLPK, CHOCO,...see the docs here for the complete list: coin-or.github.io/pulp/technical/solvers.html $\endgroup$
    – Kuifje
    Commented Sep 5, 2022 at 15:05
20
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ 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? $\endgroup$
    – Skander H.
    Commented Sep 11, 2019 at 21:57
  • $\begingroup$ Hey @Laurent , Do you know if we can use Google-OR with Pyomo ? $\endgroup$ Commented Jul 8, 2022 at 14:36
  • $\begingroup$ No. It provides its own simple python layer. $\endgroup$ Commented Jul 8, 2022 at 15:17
  • $\begingroup$ I'm 90% certain that OR-tools is completely free; it's implemented in C++ from the ground up, so it doesn't call commercial libraries on the backend, like Pyomo to CPLEX (not free!). So as an operations researcher, you wouldn't need your company to fork over $$ for CPLEX or <insert solver>. If I'm wrong here, please advise! This was part of OP's question :) $\endgroup$
    – jbuddy_13
    Commented Sep 5, 2022 at 14:55
10
$\begingroup$

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

$\endgroup$
1
  • 1
    $\begingroup$ I'm curious if the devs behind Pyomo will ever build a wrapper for Google's OR-tools? I posit that there are a medium number of researchers who are highly familiar w/ Pyomo's API design (read as "don't want to learn OR-tools API") but are tired of paying out of pocket for CPLEX, Gurobi, etc. $\endgroup$
    – jbuddy_13
    Commented Sep 5, 2022 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.