Model has no integer variables but solution says "Solving nonconvex MIQCP"
AnsweredHello Gurobi support team,
I am optimizing an NLP model with SOS and bilinear constraints. When I begin optimizing the model using the model.optimize() command, the solution log says that I have 1639 continuous variables and 0 integer variables. However, despite removing all integer variables in my model, the solution log states that Gurobi is "Solving nonconvex MIQCP". Why does Gurobi seemingly still treat my model as if it still has integer variables?
Hoping for your soonest response.
Thank you.
Best regards,
Bern

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ł0 
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?
Thank you for your time in addressing my query.
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.
0 
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 piecewiselinear (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 PiecewiseLinear Approximation and Function Constraints With Dynamic PiecewiseLinear 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 nonconvex  solving as a MIP
This does not mean that the model now has integer variables. This means that the continuous nonconvex model is now solved using the spatial branchandbound algorithm. For more information about nonconvexity and spatial branchandbound, I recommend having a look at our webinars
 Tech Talk  A Practical Tour Through NonConvex Optimization
 NonConvex Quadratic Optimization Webinar
 What's New in Gurobi 11.0
Best regards,
Jaromił0 
Hi Jaromil,
Thank you very much for answering my query. I greatly appreciate it.
Best regards,
Bern
0
Please sign in to leave a comment.
Comments
4 comments