Gurobi supports constraints containing bilinear terms like \( x \cdot y \). Although Gurobi does not directly support constraints containing more general multilinear terms, they can be modeled using a series of bilinear constraints.

Consider the multilinear constraint

$$x \cdot y \cdot z = d,$$

where \(x\), \(y\), and \(z\) are continuous variables satisfying \(x \in [x^L, x^U]\), \(y \in [y^L, y^U]\), and \(z \in [z^L, z^U]\), and \(d\) is a constant value. To model the multilinear constraint \(x \cdot y \cdot z = d\), introduce a single auxiliary variable \( w \) and add the following constraints:

$$\begin{align*}x \cdot y &= w \\ w \cdot z &= d.\end{align*}$$

Set the lower and upper bounds of \( w \) to be \(w^L\) and \(w^U\) respectively, where

$$\begin{align*}w^L &= \min\{x^L \cdot y^L, x^L \cdot y^U, x^U \cdot y^L, x^U \cdot y^U\} \\ w^U &= \max\{x^L \cdot y^L, x^L \cdot y^U, x^U \cdot y^L, x^U \cdot y^U\}.\end{align*}$$

This idea can be generalized to any model constraints containing (multivariate) monomial terms. For example, the constraint \(x^2 \cdot y \cdot z^3 = d\) can be formulated by introducing four auxiliary variables \(w_1\), \(w_2\), \(w_3\), and \(w_4\), then adding the following equality constraints:

$$\begin{align*}x^2 &= w_1 \\ w^1 \cdot y &= w_2 \\ w_2 \cdot z &= w_3 \\ w_3 \cdot z &= w_4 \\ w_4 \cdot z &= d.\end{align*}$$

**Note:** It is strongly recommended that finite lower and upper bounds are provided for **all** variables that occur in nonlinear terms in a given problem.

### Further information