• Gurobi Staff

Hi Bern,

Could you please share the log output? Does your model still have SOS constraints? These are special discrete objects, which would explain the "MI" part.

Best regards,
Jaromił

Hello Jaromil,

Here is the log output:

It seems from the log output that the SOS constraints correspond to the general constraints that I put in my model. But my model only have general constraints that have been added using GRBModel.addGenConstrPow(). Does it mean that when I add constraints that involve power functions using GRBModel.addGenConstrPow(), those constraints automatically become SOS constraints?

Hoping to hear from you soon.

Best regards,

Bern

NB: In my original query, I mistakenly indicated the number of continuous variables to 1,639. It should have been 3,261 as seen in the log output. I apologize for the mistake.

• Gurobi Staff

Hi Bern,

Thank you for the output.

It seems from the log output that the SOS constraints correspond to the general constraints that I put in my model. But my model only have general constraints that have been added using GRBModel.addGenConstrPow(). Does it mean that when I add constraints that involve power functions using GRBModel.addGenConstrPow(), those constraints automatically become SOS constraints?

Function constraints introduced by using the addGenConstrXxx() methods are approximated via a piecewise-linear (PWL) approximation scheme, see section Function Constraints in the General Constraints documentation. This static PWL approximation introduces additional binary variables and possibly SOS constraints. Since you are using only power functions, I would recommend the two following alternatives

1. If all of the power exponents are integers, then I would recommend to formulate the model as a nonconvex QCP by introducing additional auxiliary variables. For example a cubic power $$y = x^3$$ can be implemented as

\begin{align*} y &= x \cdot w\\ w &= x^2 \end{align*}

This approach is discussed in How do I model multilinear terms in Gurobi?

In the case that some of the exponents are negative, you additionally would have to model division. This is discussed in How do I divide by a variable in Gurobi?

This approach would completely avoid the usage of the addGenConstrPow() method.

2. If some of the power exponents are fractional such that you can reformulate them as described above, you should then still use the addGenConstrPow() method, but additionally set the FuncNonlinear parameter to 1. This will tell Gurobi to handle the power functions as true nonlinear functions and do not approximate them via a static PWL approximation at the beginning of the solution process. Please refer to the sections Function Constraints with Static Piecewise-Linear Approximation and Function Constraints With Dynamic Piecewise-Linear Approximation in the General Constraints part of the documentation for additional information about the two approaches.

If you apply the above two points to your model, you should see the message

Continuous model is non-convex -- solving as a MIP

This does not mean that the model now has integer variables. This means that the continuous non-convex model is now solved using the spatial branch-and-bound algorithm. For more information about non-convexity and spatial branch-and-bound, I recommend having a look at our webinars

Best regards,
Jaromił

Hi Jaromil,

Thank you very much for answering my query. I greatly appreciate it.

Best regards,

Bern