Add log term and exponential term in objective function?

Comments

1 comment

  • Eli Towle

    Hi,

    There is unfortunately no analog for adding logarithmic and exponential functions to the objective. However, you can accomplish this by introducing a new variable to represent the corresponding objective term, then use Gurobi's general constraint functions to set this new variable equal to the nonlinear term. This uses the following relationship (assuming the minimum of \( f(x) \) exists):

    $$\begin{align*} \min_x f(x) = \min_{x,y}\ &y \\ \textrm{s.t. }\ &y = f(x) \end{align*}$$ 

    Note that Gurobi builds piecewise-linear approximations of these nonlinear functions in order to solve the problem. It might be better to construct a single piecewise-linear approximation of the univariate function \( \log(b + e^{k+x}) \) yourself. With the Python API, you can do this with the Model.addGenConstrPWL() method.

    Thanks,

    Eli

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk