Skip to main content

Scaling variable in MIP




  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    Hi Bryan,

    When scaling the model, we propose to consider the following steps

    • Scale your variables and constraints to get reasonable coefficients
    • First, consider the units of your variables:
      For example: If you deal with millions of dollars, do not use cents or dollars as a unit. Instead use thousands or millions. (Tons instead of grams, kilometers instead of meters, ...)
    • If you deal with millions of dollars, do you need exact integral cent values?
    • Scale constraints so that coefficients get closer to 1
    • Use integral data wherever possible, e.g. 1*x + 2*y = 3 better than 0.3333333*x + 0.66666666*y = 1

    As mentioned in the variable coefficients should not be smaller than 10e-3.

    If your model only contains binary variables, this is fine. But also here the range of the coefficients should not be larger than 10e6 and also within [10e-3, 10e6].

    I hope this helps,

  • Bryan Liu
    First Comment
    First Question

    Hi Marika,

    Thanks for the response. I understand the part of scaling the coefficient of all variables together for one constraint. My question is that how we can scale one variable for all the constraints like the article but in a MIP model where the variable should be binary. In the article it replace the x with x' where x=10^5x' for all the constraints.


  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    Hi Bryan,

    You are right. The substitution discussed in the article can be done with continuous variables but not with binary (or integer) variables. In this case, it might help to rethink the unit of the variable or if the constraint can be modeled differently.
    I think you have a commercial license with us. You are welcome to create a support request via the Gurobi Help Center, share the model with us, and discuss scaling or numerics in more detail.

    Best regards,


Please sign in to leave a comment.