Hot answers tagged

38

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


19

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


19

We use Julia in production for optimization at Invenia. We use Convex.jl, and JuMP.jl, and have found them to be excellent.


14

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.


13

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


13

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


12

I can't address the specifics of Python, Pyomo, Gurobi or GAMS, but I can address the general question of using a modeling language (such as GAMS) versus building the model directly in a general programming language (such as Python) via a solver API. Models written in a modeling language (say GAMS) tend to be easier to read and easier to relate to a problem ...


11

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


11

Although I personally think Julia is glorious, nearly no-one outside academia uses it for numerous reasons, including: Missing out on all the Python packages Julia programmers being much harder to find than Python programmers, and Julia being much harder than Python to integrate to other things. JuMP can offer performance benefits, but for commercial use ...


9

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


9

GAMS and AMPL are general purpose modelling languages and can he used to describe any type of nonlinear function, including some niche stuff like floor, ceil, max, etc (AMPL). I don't have experience with OPL so I can't comment on that. The purpose of these languages is twofold: They provide a solver interface for your math. Solvers typically require input ...


8

In a production environment, I have found code APIs to be superior to modelling languages in the long run. Nowadays, we also have Pyomo so we don't even need to compromise between the two. The subtlety is that if you use a solver's Python API your code is tied to that solver. Conversely, if you use a modelling environment (e.g. GAMS), you can seamlessly ...


7

For a test problem, check manually (outside GAMS) that the solution satisfies all constraints. If not, your GAMS model may be wrong. If all constraints are satisfied, try using a different solver and see if the same objective value is achieved. If the other solver gets a better result, your current runs may be stopping short of optimality. If the objective ...


7

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


6

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


6

To create a MPS file using GAMS, you have two options as follows: Your first option is to use the CONVERT solver. AFAIK, this solver is not available on NEOS Server (see here for a list of available solvers). Your second option is to use the solver-specific options to create MPS files. For example, CPLEX has a writemps option, which allows you to generate a ...


6

The model you describe is linear. There are a couple of reasons why GAMS wouldn't like it though: (I) did you define the right solver for your problem? and (ii) GAMS initialises any uninitiated variables to 0 - it then proceeds to evaluate all constraints at the initial values before sending the problem to a solver. If the initial values are infeasible (...


5

To fix a variable use x.fx(i) = 1. To unfix: x.lo(i) = 0; x.up(i) = 1;. To relax an integer/binary variable you can use: x.prior(i)=INF; Documentation of this can be found at the obvious place: https://www.gams.com/latest/docs/UG_Variables.html. Here is an example of how to use this.


5

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


5

By default, Gams/Cplex will try to calculate duals by fixing the integer variables and then resolving as an LP. This is the "final solve". Usually the objectives are the same. In rare cases the final lp can be infeasible or the objective can be different because of an artifact in Cplex (mind-numbing detail: it can return mip solutions obeying the ...


5

Collecting things in a parameter is actually very simple. set run /.../; parameter objresult(run,*); loop(run, solve m .... objresult(run,"obj") = m.objval; objresult(run,"bestbound") = m.objest; objresult(run,"absgap") = abs(m.objval-m.objest); );


5

There is a good reference that has been published by Alireza Soroudi. Power System Optimization Modeling in GAMS


4

model; set energy:= el co th; set tech := cog tri; subject to cons1 {i in demand, j in facility}: y[i,j,'th'] <= sum{i in size} x[j,l,'tri']; subject to cons2 {i in demand, j in facility, k in energy}: y[i,j,k] <= sum{j in facility, l in size, m in tech} x[j,l,m]; The only thing that you need to change is in your first constraint 'CO' to 'TH'. A ...


4

It is much better to collect all y.l(i) in a parameter with an extra index t, and export that in one swoop. I.e. parameter results(t,i); loop(t, * calculate y.l(i) solve ...; results(t,i) = y.l(i); ); execute_unload "AllResults.gdx", results; execute 'gdxxrw.exe AllResults.gdx par=results'; Calls to Excel are expensive so they should ...


4

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


3

The latest JuMP.jl website gives a few examples of its use in industry: route school buses by the Boston school district plan powergrid expansion by PSR optimize milk output by dairy farmers in New Zealand I personally find JuMP.jl, by far, the most user-friendly and flexible optimization interface I ever used. By far.


3

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.


3

You cannot loop over include files ($include is compile-time, while loop is execution- time, this is similar to say C where you cannot loop over #include). One could loop over complete GAMS models (call gams inside a loop), or over reading data from GDX (GAMS data) files. But often a better approach is the following. I would just read in all problem data in ...


3

Unfortunately, GAMS does not have an independent low-level API language (such as CPLEX or Gurobi) and you will need to use its high-level language into your favourite API. In the simplest form, you can write your optimization problem in the gams file (.gms) and invoke it in python as follows: # transport1 example in the gams directory from __future__ import ...


3

As @ErwinKalvelagen pointed out: by default gams cplex uses only 1 thread which results in a low usage of the pc ressources. In order to change this one has to increase the thread number so that multiple cores can be used at the same time: https://support.gams.com/solver:multiple_cplex_threads


Only top voted, non community-wiki answers of a minimum length are eligible