Skip to main content

What is exactly auxiliary variables in the opt model?

Answered

Comments

4 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    I am not aware whether there is a unified definition of an "auxiliary variable" as this term is used whenever a variable is introduced in order to reformulate the model in a way to suit the solver's needs or take advantage of some specific algorithm.

    I will show a few examples and then you can hopefully get a better grasp of what can be seen as an auxiliary variable.

    Can anyone tell me what is the exact definition of auxiliary (helper) variables in the optimization model?

    When you want to implement a division by a variable in Gurobi \(\frac{1}{x}\), you have to introduce an auxiliary variable as described in How do I divide a variable in Gurobi? There, variable \(z\) is an auxiliary variable which has the sole purpose to formulate the division as a product and make it possible to solve the underlying model with Gurobi. The auxiliary variable \(z\) would not be needed if Gurobi would natively support variable division such as most state-of-the-art MINLP solver such as  ANTIGONE, BARON, OCTERACT do.

    Let's say you want to introduce an equality constraint \(\exp(x) = |y|\). This is currently not directly possible in Gurobi and you have to introduce an auxiliary variable in order to make the underlying technology applicable. You have to introduce an auxiliary variable \(z\) and formulate the given equality constraint as \(\exp(x) = z, |y| = z\). Again, the sole purpose of \(z\) is to make the formulation of the nonlinear constraint possible.

    You can also introduce auxiliary variables to construct specific separations of your model. Let's assume that you have an objective function \(f(x) = g(x) + h(x)\) and you have some specific knowledge about \(g\) and \(h\). It is often convenient to introduce auxiliary variables and formulate the model as \(f(x) = w + z, w = g(x), z=h(x)\) and then apply your knowledge about \(g\) and \(h\). With an auxiliary variable you can start off with a simple \(w = g(x)\) equality and apply all your knowledge and tricks to function \(g\). Again, variables \(w,z\) are not needed to solve the original model. However, they make the application of specific (detection) algorithms much easier.

    A classical usage of auxiliary variables is the so-called Auxiliary Variable Method (AVM) most often used by nonlinear global solvers where an auxiliary variable together with a corresponding auxiliary equality constraint is introduced for every intermediate nonlinear factor of a given function. For example, the function \(f(x,y) = \exp(x^2 + \log(y))\) is reformulated via auxiliary variables and equalities as

    \[\begin{align*}
    z_1 &= \exp(z_2)\\
    z_2 &= z_3 + z_4\\
    z_3 &= x^2\\
    z_4 &= \log(y)
    \end{align*}\]

    As you see the auxiliary variables and equalities are just an equivalent formulation of the \(f(x,y)\) function but now every equality constraint can be handled one by one when constructing a relaxation of the nonlinear function \(f\).

    One could say that an auxiliary variable is redundant for a model to be solved in theory but it is often necessary to introduce one in order to solve a given model in practice.

    How to create identify /create them during formulating a problem? 

     You can add auxiliary variables just as any other variable. However, when introducing an auxiliary variable for a nonlinear term, such as in the "division by a variable" case discussed above, it is necessary that you introduce valid lower and upper bounds for every auxiliary variable in order to avoid numerical issues, e.g., division by \(0\) or taking \(\log\) of a value close to \(0\).

    I hope this helps.

    Best regards, 
    Jaromił

    0
  • Taposh Kumar Kapuria
    Gurobi-versary
    First Comment
    First Question

    A big thank you!

    0
  • Tanmoy Das
    Gurobi-versary
    Investigator
    Collaborator

    Hello Jaromił Najman, appreciate your explanation. 

    In an optimization model that I am developing right now, the objective function contains 3 terms, two of these terms would be zero depending on input data. 

    Taking your point "you have some specific knowledge about g and ℎ." , I can use the idea of auxiliary variable to turn off some data/terms in the objective function, right? 

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Taking your point "you have some specific knowledge about g and ℎ." , I can use the idea of auxiliary variable to turn off some data/terms in the objective function, right? 

    Correct.

    0

Please sign in to leave a comment.