Skip to main content

Model Definition

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • Gurobi Staff

    Hi Francisco,

    Gurobi currently does not support the function \(x^y\) where both \(x\) and \(y\) are optimization variables. Thus, if \(z\) in your formulation is an optimization variable, then you cannot formulate \(f\) in Gurobi.

    Since you defined \(f(x)\) and not \(f(x,y,z\) I will assume that both \(y\) and \(z\) are constants. If \(z\) is an integer constant you can formulate your model as a quadratic one via additional auxiliary variables as described in How do I model multilinear terms in Gurobi? For example, if \(z=3\), you could formulate your model as

    \[\begin{align*}
    w_1 &= x -y\\
    w_2 &= w_1 \cdot w_1\\
    w_3 &= w_2 \cdot w_1\\
    w_4 &= x \cdot w_3
    \end{align*}\]

    If \(z\) is not integer, you could use the addGenConstrPow method. For example, if \(z=1.3\), you could formulate your model as

    \[\begin{align*}
    w_1 &= x - y\\
    w_2 &= w_1^{1.3} \quad (*)\\
    w_3 &= x \cdot w_2
    \end{align*}\]

    The \((*)\) constraint is implemented via

    model.addGenConstrPow(w_1, w_2, 1.3)

    Best regards, 
    Jaromił

    0

Post is closed for comments.