While Gurobi's support for piecewise-linear functions is limited to univariate functions, but it can still be useful for approximating multivariate functions.

Consider the following multivariate function:

$$\begin{align*} f(x, t) &= \sigma(t) \sqrt{x}. \end{align*}$$

This function can be approximated by using the following approach.

1. Construct a piecewise-linear approximation of \( \sigma(t) \). E.g., \( u = \sigma(t) \). In Python, this can be done with the Model.addGenConstrPWL() method.

2. Construct a piecewise-linear approximation of \( \sqrt{x} \). E.g., \( w = \sqrt{x} \).

3. Introduce a new auxiliary variable to the model (say, \( y \)) to represent \( f(x, t) \). Add a bilinear constraint to set \( y \) equal to the product of the two piecewise-linear approximations: \( y = uw \).

Alternatively, a piecewise-linear approximation can be built from scratch. For example, a piecewise-linear function of two variables can be built by triangulating the three-dimensional surface corresponding to the function graph (for example, see this article on surface triangulation). In this case, it is necessary to keep track of which "supporting triangle" (simplex, more generally) the argument of the function lies in. This can be done with binary indicator variables.

### Further information