As I understand it, if a modeling library (pyomo, amplpy, cvxpy, etc.) allows one to define a logarithmic objective function a solver may not support it. And even if a solver does support a logarithmic objective function then the modeling library may not support translation of the log function to the solver. So, which combinations of libraries and solvers support logarithmic objective functions?
Which combinations of python modeling libraries and solvers support logarithmic objective functions?
-
2$\begingroup$ For CVXPY see the EXP column in cvxpy.org/tutorial/advanced/index.html#choosing-a-solver $\endgroup$– Michal AdamaszekCommented Jan 10 at 9:53
-
$\begingroup$ The SCIP solver handles nonlinear non-convex objective functions, albeit indirectly. If you have min. log(...), you would need to change the objective to min. z, with z <= log(...) I think AMPL (and Pyomo as well? not sure) can use SCIP, but there are SCIP interfaces as well, using Python, or Java, or Rust, etc. $\endgroup$– J. DionisioCommented Jan 18 at 15:58
1 Answer
Assuming the model is convex, then you can easily state your problem on conic form using the exponential cone. The Mosek modeling cookbook discusses that topic.
Mosek has 2 different Python interfaces that allow you to specify conic optimization problems with exponential cones and other cone types.
Mosek can also be used from cvxpy and Pyomo to solve this class of problems.
AMPL support tells me that they support the exponential cone too.
If are you maximizing $$ \ln{\prod x_j} $$ then that corresponds to maximizing the geometric mean of the nonnegative variables i.e. maximizing $$ \left ( \prod_{j=1}^n x_j \right )^{1/n}. $$ This can be formulated using the power cone.
-
$\begingroup$ Yes @ErlingMOSEK maximizing / convex. Particular use case is $\max_{x_i \in \mathbb{R}_{++}} \sum_i \ln (x_i)$. So to summarize: cvxpy, Pyomo, and AMPL with Mosek support logarithmic objectives, right? $\endgroup$ Commented Jan 12 at 20:12
-
$\begingroup$ Yes. You can also use Mosek directly. The Fusion interface is quite nice IMO. $\endgroup$ Commented Jan 13 at 5:42
-
$\begingroup$ Accepting this answer for now. I hope to circle back and add a table of other solver/language combinations that support logarithmic objectives for reference. $\endgroup$ Commented Jan 17 at 20:01