# Formulation of a stepwise linear approximation

I am currently trying to solve an MILP in Gurobi. Unfortunately, Gurobi does not support non-linear functions and I would like to do the following. I currently have the following constraint. It calculates the residual power of a machine $$j$$ at time $$t$$, where $$\alpha$$ is a parameter. Currently the relationship is linear:

$$degneration_{jt}=1-\alpha\cdot age_{jt}$$

But I would like to model such a progression $$f(x)=e^{-x}$$ and would like to use a linear approximation for this. How would I have to model something like this, unfortunately I have no idea.

• Does $f$ appear in the objective function (in which case we need to know whether you are maximizing or minimizing it) or in constraints?
– prubin
Commented Jan 30 at 16:37
• @prubin I am sorry, the OP isn't clear enough. $f$ doesn't appear in either. It's just an example. Currently I have a linear relationship ship between $degneration$ and $age$ but I rather want a non-linear one. I just need a linear approximation for $f$, as I want to implement it in Gurobi Commented Jan 30 at 17:03
• Gurobi's new version 11 does support a variety of common nonlinear functions. You can choose between global optimization and automatic piecewise-linear approximation. (Of course, whether this feature is useful for your particular application will depend on the form that $f$ takes.)
– 4er
Commented Jan 30 at 17:35

One approximation possible is to use the tangents of $$f(x)$$. Assuming you are minimizing $$f(x)$$, introduce a new variable $$z$$ to approximate $$f(x)$$ over a given set $$A$$ and use constraints: \begin{align} z &\ge f'(a)(x-a)+f(a)\quad &\forall a \in A \\ &= -e^{-a}(x-a)+e^{-a} \quad &\forall a \in A\\ &=-e^{-a}x+e^{-a}(1+a) \quad &\forall a \in A \end{align}