Skip to main content

How to to define multivariate polynomials



1 comment

  • Jaromił Najman
    Gurobi Staff Gurobi Staff


    I am not sure if I understand fully understand your issue.

    It is currently not possible to directly define multivariate polynomials in Gurobi but it is certainly possible to model them.

    For example, let's consider the multivariate polynomial \( p:\mathbb{R}^2 \to \mathbb{R}, (x,y) \mapsto x^2\cdot y  + x \cdot y + x \cdot y^2 \). You can formulate a constraint such as \(p(x,y) = 0\) by the addition of auxiliary variables and the use of quadratic expressions as
    \omega_1 \cdot y + &x \cdot y + x \cdot \omega_2 = 0 \\
    \omega_1 &= x^2 \\
    \omega_2 &= y^2 \\
    x \in &[x^L, x^U] \\
    y \in &[y^L,y^U] \\
    \omega_1 \in &\begin{cases} [0, \max{(x^L)^2,(x^U)^2}], &\text{if } x^L < 0 < x^U \\ [(x^L)^2, (x^U)^2], &\text{if } x^L\geq 0  \\ [(x^U)^2, (x^L)^2], &\text{if } x^U\leq 0 \end{cases} \\
    \omega_2 \in &\begin{cases} [0, \max{(y^L)^2,(y^U)^2}], &\text{if } y^L < 0 < y^U \\ [(y^L)^2, (y^U)^2], &\text{if } y^L\geq 0  \\ [(y^U)^2, (y^L)^2], &\text{if } y^U\leq 0 \end{cases}

    Note that I added finite bounds for \(x\) and \(y\) as this is recommended when working with nonlinear expressions.

    I hope the above could answer your questions. Feel free to ask further questions if not.

    Best regards,


Please sign in to leave a comment.