AnswerBun.com

Are Python and Julia used for optimization in industry?

Operations Research Asked on August 19, 2021

I am giving a small computer exercise that aims at teaching students the basics of a modelling language to model small optimization problems. So far I have been using the modelling language GAMS as this is used in many companies in industry.

To be totally honest, I have never been a big fan of GAMS mainly because I’d prefer to use a general-purpose programming language for optimization instead of a pure modelling language. Now I am thinking about using either Python or Julia for teaching.

The problem is that I really do not know if Julia or Python are used in the industry for optimization. So the question is not if those programming languages are generally used (of course, I know about the Python hype), it is about whether those languages are also used for operations research in industry. In fact on the webpage of Julia several case studies are listed, however I could not find many case studies from industry for Python.

What is your opinion towards this and what experience have you made? If I choose to use Python or Julia, can I tell students that they are (strongly) used in industry to motivate them? Which of those would you choose (or just proceed with GAMS)?

15 Answers

The latest JuMP.jl website gives a few examples of its use in industry:

I personally find JuMP.jl, by far, the most user-friendly and flexible optimization interface I ever used. By far.

Answered by Albert Zevelev on August 19, 2021

The main reason why Pyomo is being used in industry and JuMP is not is that JuMP is a version 0.21.6 package whereas Pyomo is v5.7.3. Naturally, most businesses are not going to use a package with version less than 1.

Also, according to the following discussion, first-class nonlinear optimization support is something for v2.0 (two or three years away): https://github.com/jump-dev/JuMP.jl/issues/2355 This (and other related links) provide excellent and open discussion that in and of itself is a testament to JuMP's potential.

V1.0 and solid support for Conic and Linear-Quadratic problems should be on the cards for the near future. It seems like they are preparing the documentation for its release. https://arxiv.org/pdf/2002.03447.pdf

But the OP is concerned with teaching students who will go into industry. In the future when JuMP reaches v1.0, it will be competitive with Pyomo because: Julia is beautiful.

The students will probably enjoy Julia more than Python (at least I did when I started).

Answered by user1211719 on August 19, 2021

Since Python is dominant in the industry, pyomo gained its popularity. I personally prefer the JuMP's implementation. Check these Constrction Speed R and Python Modeling.

For R users, I recently used a package OMPR with CBC solver in the production environment.

It works well if your model is relatively small. The author is trying to make it faster.

Answered by janicebaratheon on August 19, 2021

We work in OR since 20 years and have observed the huge rise of Python in industry the last 10 years. A lot of engineers but also some analysts have moved to Python, especially the ones working in scientific fields like data science and operations research.

At LocalSolver, we observe that 90% of industrial clients use the LocalSolver Python API to develop optimization solutions. Especially during the early, prototyping phases, but also more and more for deployment as well.

Until now, the preferred languages of our clients were Java and C# because corresponding to the main stacks used by IT services to build the business applications that embed optimization engines. C++ is still used in some companies, particularly software editors, but becomes very rare.

Until now, we have observed no demand for Julia in industry.

Answered by LocalSolver on August 19, 2021

Interesting that you ask - I've actually seen both julia and python used in industry. On the python side, I'd highly recommend cvxpy (for convex optimization). It was pretty easy to get started with, and it integrates well with other popular python numerical libraries. The stuff I've seen in julia was custom work, so I can't really comment on ease of use.

edit: I will say, though, that Julia makes linear algebra easy and, dare I say even beautiful :)

Answered by jeg on August 19, 2021

Our, KLM, current optimizer products' codebases are all in python. The main reason for this is python is extremely powerful for fast prototyping. However, when it comes to the necessity of implementing more advanced techniques such as column generation and own branch-and-price algorithm, then python start lacking the performance you're looking for. In that case, python is again powerful since that part of your code can then well be implemented in c++ still within your codebase. Last but not least, the immense support with packages from the community makes it extremely handy.

Regarding Julia, I personally started experimenting and it seems quite nice. However, having no community support as much as python is an important fallback. Moreover, most commercial solvers do not have an official API for it. Maybe not a showstopper but certainly an issue to be thoroughly discussed.

Answered by Serkan Kalay on August 19, 2021

Python is well ahead of specific modelling languages. Many of solvers such as Gurobi, Cplex etc. have python interface. You can encounter small problems. For example for modelling problems, which package you will teach. You will have alternatives pyomo, pulp, python-mip or solver interface. I prefer pyomo which can be used with lots of commercial or free solvers. Also you can find heuristic and constraint programming packages for python such as google OR tools.

Additionally, you should examine following links, they will give idea.

  1. python wiki for OR packages: https://wiki.python.org/moin/PythonForOperationsResearch
  2. Famous scipy package optimization module: https://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html
  3. Python PSO package: https://pyswarms.readthedocs.io/en/latest/

Answered by kur ag on August 19, 2021

We use Julia in production for optimization at Invenia.

We use Convex.jl, and JuMP.jl, and have found them to be excellent.

Answered by npr on August 19, 2021

Despite being a great fan of Julia (and JuMP) I must admit that Python is most widely adopted in industry. I won't recommend PuLP however, which tends to be too slow. As alternatives, I would consider

  • Pyomo is a great package, with various interesting extensions (for stochastic programming, MPEC, bilevel optimization, ...).
  • Cvxpy is a game changer if you are dealing with convex problems, and is fast. As cvxpy is still actively maintained by some students of Boyd, you could expect using state-of-the-art code when using this package (e.g. https://github.com/cvxgrp/cvxpylayers)
  • Most optimization solvers come with a Python interface.

My experience in Artelys, a firm specialized in optimization, is that most people are using Python nowadays, and prefer to stick to this language. We have some prototypes in Julia, but none of them have been industrialized. However, they do provide support for the Julia interface of the solver Knitro (but mostly used by academics so far).

I won't be so definitive as others about Julia, though. JuMP is really a game changer. For non-linear programming, the performance of JuMP AD backend is closed to those of AMPL (between 3x and 5x slower in my experience, which is way better than Pyomo). My bet is that the gap will close in the next years, with the current focus on AD in Julia. That's the reason why I prefer to use Julia for my teachings so far (having built-in linear algebra is gold to me). Also if you choose to use Julia, you could experiment cutting-edge packages developed by the JuliaOpt community. For instance, I do not know any equivalent of Dualization.jl (a package computing automatically the dual of an optimization problem) in other languages.

Nearly no-one outside academia uses Julia in production

I beg to differ on this one. PSR, another firm specialized in optimization, is using Julia extensively for their studies, with success so far.

Answered by fpacaud on August 19, 2021

My answer will be focused on teaching, and I'll give you my perspective from Georgia Tech ISyE.

Yes, you should teach your students optimization using Python. For simple models, one simple open-source platform you could introduce is PuLP. It is solver-agnostic, and will work both with commercial solvers as well as open source (including COIN-OR stuff). For more complex stuff, you could teach the gurobipy interface.

Julia is also useful, but I would suggest for now that it is best for research students like those pursuing a Ph.D.

Answered by alerera on August 19, 2021

Although I personally think Julia is glorious, nearly no-one outside academia uses it for numerous reasons, including:

  1. Missing out on all the Python packages
  2. Julia programmers being much harder to find than Python programmers, and
  3. Julia being much harder than Python to integrate to other things.

JuMP can offer performance benefits, but for commercial use that's rarely an issue as most companies will simply buy an AMPL license if that's a bottleneck and use its Python interface.

When it comes to interfacing, Python is the king, and that is true of optimisation solvers as well.

Apart from our personal experience at Octeract, this is also reflected by the languages' popularities:

the 2019 index ranks Julia 50th, and Python 3rd

Answered by Nikos Kazazakis on August 19, 2021

Staffjoy was an early user of Julia and JuMP for their start up providing workforce scheduling. They also release all of their internal software as open-source after they shut-down. See for example the autoscheduler based on JuMP.

Answered by Robert Schwarz on August 19, 2021

Yes, Python is used in the industry is the simple answer.

We are Optimeering Aqua and our sister company Optimeering use Python and the (Fico) Xpress Python- API. We were alpha and beta users. For us this has been working well. We very early on used Fico's Mosel language, but found moving to a general programming language to have lots of advantages, with few disadvantages. I think there has been many debates on general purpose languages vs domain specific languages, so will not repeat that here.

Answered by Erlend Torgnes on August 19, 2021

The feed back we get from our customers at Mosek is Python is used extensively in the financial industry for doing portfolio optimization and lot of other operations.

Those customers like to use Cvxpy or Mosek Fusion to interface the optimizer. You can see some Python notebooks at our Github tutorial page. This portfolio construction framework also provides a good example of what the financial industry are doing with Python and optimization

Our feeling regarding Julia which we also have an interface for is it much less used than Python in industry at this moment time. It is very popular among academics though.

Answered by ErlingMOSEK on August 19, 2021

I personnaly use Python for optimizing industrial problems every day.

I know Polymathian also use Python for their Tropofy platform.

GUROBI has a python API, which I think is quite popular (although I cannot prove it).

I think that since Python is one of the most popular languages out there, mechanically it is used for optimization. However, I think it also depends on what you mean by optimization. Are you talking about software development, an industrial study, consulting, etc ? I think for software development, Python is often used with other low level languages such as C. For consulting or studies, Python is very appropriate in my experience.

I think Julia is promising, but too young to be compared to Python or any other language in fact. This being said, Atoptima solve their optimization problems with a branch and price framework implemented in Julia. I would not be surprised if in the coming years, Julia becomes more and more popular in the optimization community.

So to sum up, I would say that YES, Python is appropriate for what you need. And if someone learns Python, the learning curve for Julia should not be too steep.

PS : this is a personal opinion and I am curious to see some other answers :)

Answered by Kuifje on August 19, 2021

Add your own answers!

Related Questions

Free solver for MINP problems

1  Asked on February 18, 2021 by dspinfinity

     

Flexible Job Shop with Preemption

0  Asked on January 15, 2021 by robert-hildebrand

         

Constraint programming resources

3  Asked on November 28, 2020 by joffrey-l

     

Pyomo variable creation dilemma

1  Asked on October 31, 2020 by ethan-deakins

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP