Although Gurobi's support for piecewise-linear functions is limited to univariate functions, 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 with the following approach:
- Construct a piecewise-linear approximation of \( \sigma(t) \) and set it equal to a new auxiliary variable \( u \). In Python, you can set a variable equal to a piecewise-linear function of another variable with the Model.addGenConstrPWL() method.
- Construct a piecewise-linear approximation of \( \sqrt{x} \) and set it equal to a new auxiliary variable \( w \).
- Introduce a new auxiliary variable \( y \) to represent \( f(x, t) \). Add a bilinear constraint to set \( y \) equal to the product of the piecewise-linear approximations of \( \sigma(t) \) and \( \sqrt{x} \), e.g., \( 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 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.
Comments
0 comments
Article is closed for comments.