I've been using GAMS for a long time, but I cannot use all the functionality of CPLEX under GAMS. Can you do that using Pyomo? or using CPLEX directly in Python? Thanks!
1 Answers
The advantage of using Pyomo is that it is a modeling language that is independent of the underlying solver that is used to solve the problem. For example, you can write your model and then solve it with glpk. By changing a command line option, you can solve the same model with CPLEX, Gurobi, etc. It provides many capabilities such as supporting distributed optimization and allows you to use your own custom solver if you wish (see the documentation).
The CPLEX Python API is on the other end of the spectrum. It is not a modeling language. It's a relatively lightweight layer that wraps around the underlying CPLEX Callable Library (C API). Variables, constraints, etc., are referred to by index or name. It allows you to do almost anything that can be done in the Callable Library. In this sense, it give you the most access to CPLEX functionality (even advanced capabilities like callbacks).
An option that lies somewhere in the middle is DOCplex. DOCplex is an open source modeling language provided by IBM and it allows you to solve on the cloud or locally. It supports CPLEX for mathematical programming, but also CP Optimizer for constraint programming.

- 4,447
- 2
- 22
- 31
-
Thanks rkersh! Do you know how pyomo compares to gams in terms of access to CPLEX functionality? For example, under gams, you can stop the brach and bound algorithm everytime a new incumbent solution is found. Can this also be done under pyomo? – Salva Apr 23 '17 at 07:48
-
I doubt that. [Here is some indication](https://groups.google.com/forum/#!topic/pyomo-forum/lJTUjlAjw3s), although it's talking about the other big commercial solver. This is also something which is not common in high-level optimization languages, especially open-source ones. The only one i know of, is [JuMP](https://jump.readthedocs.io/en/latest/). But that's not python obviously. – sascha Apr 23 '17 at 11:50