What are the handiest optimization parsers out there? Is COIN-OR's PyPy being used actively? I am currently trying to do an optimization project in Python, but I am used to using MATLAB + YALMIP combination, so I need some advice!
4 Answers
Given you are a MATLAB+Yalmip user you may prefer Cvxpy. Cvxpy is particularly useful if you do nonlinear models. Mosek also includes 2 Python interfaces where the so called Fusion interface may be the most interesting for you.
Here you find a comparison of Cvxpy, Pyomo and Fusion for some large scale problems.
-
$\begingroup$ I tried it, that's really like YALMIP. I was overwhelmed with the notation of other parsers, this works great! Note: The documentation of CVXPY says MOSEK can not solve Exponential Cone problems, which is not true anymore I guess, so just flagging here... $\endgroup$ Commented Nov 20, 2019 at 23:25
-
Handiest optimization package in python is Pyomo(in my opinion). I recommend that because of the following specifications:
- There is a google group ( in addition to se and or.se) that you can ask for help if you stacked.
- You can use all the pythonic facilities to write your model
- There are enough books, tutorials and documents about it.
- Pyomo is an active and well developed package.
- You can also use many available solvers to solve your model written in Pyomo.
- You can easily use solvers on Neos server to solve the model.
-
$\begingroup$ Thanks much!! How can I find examples with Gurobi? Do you know any resourcse? $\endgroup$ Commented Nov 19, 2019 at 16:42
-
1$\begingroup$ In this address(pyomo.readthedocs.io/en/stable/working_models.html) it’s explained how to use different solvers to solve your model. $\endgroup$ Commented Nov 19, 2019 at 17:25
Pyomo can do a lot. CVXPY is good for convex problems which can be modeled using DCP (Disciplined Convex Programming), including Linear SDPs, and does have certain extensions for certain non-convex problems.
But there is no modeling environment I know of in Python which captures all of YALMIP's capabilities. For instance, I am not aware of any BMI (Blinear Matrix Inequality) capability in Pyomo or any other modeling environment in Python, let alone the capability to solve BMIs and Nonlinear SDPs to global optimality (given enough time).
SO it really depends on the type and variety of problems you wish to solve.