A conic quadratic constraints are considered convex if the variables are continuous, but is getting considered non convex if variables are binary?
Awaiting user inputA conic quadratic constraints are considered convex if the variables are continuous, but is getting considered nonconvex if the variables are binary.
So, I have the constraints in the quadratic form like this:
x^TQx <= y^2
and if x is considered as continuous, the Gurobi recognizes the constraint as convex and solves it appropriately.
However, y is considered binary, gurobi recognizes it as nonconvex and takes a lot of time to solve. Is there any reason for it, and any way to mitigate this problem?

Could you please share the log outputs of the two different runs? So one run where y is continuous and one run where y is binary?
0 
Thanks for the reply.
I am forcing Gurobi to use a convex optimizer as a nonconvex optimizer is taking a long time.
This is the output when the variable is continuous:Set parameter Username
Academic license  for noncommercial use only  expires 20250210
Set parameter NonConvex to value 0
Set parameter MIPGap to value 0.005
Set parameter TimeLimit to value 5
Warning: linear constraint 210 and linear constraint 211 have the same name "Source_SOC_constraint"
Gurobi Optimizer version 11.0.0 build v11.0.0rc2 (win64  Windows 11+.0 (22631.2))CPU model: 12th Gen Intel(R) Core(TM) i712700H, instruction set [SSE2AVXAVX2]
Thread count: 14 physical cores, 20 logical processors, using up to 20 threadsOptimize a model with 287 rows, 1393 columns and 1599 nonzeros
Model fingerprint: 0xef7edfe0
Model has 169 quadratic constraints
Coefficient statistics:
Matrix range [2e02, 1e+00]
QMatrix range [1e+00, 2e+07]
Objective range [1e+00, 1e+00]
Bounds range [1e+00, 1e+02]
RHS range [1e+00, 2e+03]
Presolve removed 43 rows and 347 columns
Presolve time: 0.01s
Presolved: 582 rows, 1385 columns, 2681 nonzeros
Presolved model has 169 secondorder cone constraints
Ordering time: 0.00sBarrier statistics:
AA' NZ : 2.018e+03
Factor NZ : 5.502e+03 (roughly 1 MB of memory)
Factor Ops : 6.199e+04 (less than 1 second per iteration)
Threads : 1Objective Residual
Iter Primal Dual Primal Dual Compl Time
0 5.24347161e+06 4.59707006e+06 3.00e+03 2.42e+02 1.04e+05 0s
1 4.00897914e+05 4.27301277e+06 1.96e+02 1.14e+01 8.24e+03 0s
2 8.35538275e+04 2.63423607e+06 1.48e+01 2.78e+00 1.61e+03 0s
3 3.25564823e+04 4.82120657e+05 8.52e03 3.17e01 2.35e+02 0s
4 1.85941531e+04 1.01330140e+05 3.94e04 6.61e02 5.39e+01 0s
5 9.05223183e+03 1.76286416e+04 1.07e04 1.19e02 1.19e+01 0s
6 4.42740375e+03 2.12454924e+03 2.85e05 2.32e03 2.91e+00 0s
7 3.29361404e+03 6.90176853e+02 1.30e05 8.02e04 1.15e+00 0s
8 2.91506519e+03 1.85479784e+03 7.40e06 2.23e04 4.69e01 0s
9 2.68628581e+03 2.19264576e+03 4.09e06 7.85e05 2.18e01 0s
10 2.56454591e+03 2.33448113e+03 2.33e06 2.16e05 1.02e01 0s
11 2.48859672e+03 2.37358433e+03 1.20e06 8.78e06 5.09e02 0s
12 2.45589630e+03 2.39315023e+03 7.22e07 3.20e06 2.77e02 0s
13 2.44103796e+03 2.39802053e+03 5.03e07 1.90e06 1.90e02 0s
14 2.40975384e+03 2.40487054e+03 3.18e08 1.97e07 2.16e03 0s
15 2.40713231e+03 2.40665403e+03 2.95e09 2.99e08 2.11e04 0s
16 2.40703819e+03 2.40682423e+03 1.06e08 1.64e08 9.46e05 0s
17 2.40702943e+03 2.40691284e+03 4.25e09 8.79e09 5.15e05 0s
18 2.40702427e+03 2.40696489e+03 3.74e10 4.56e09 2.63e05 0s
19 2.40702371e+03 2.40699731e+03 2.85e10 2.09e09 1.17e05 0s
20 2.40702357e+03 2.40702091e+03 4.55e09 7.71e10 1.18e06 0s
21 2.40702335e+03Barrier solved model in 21 iterations and 0.06 seconds (0.01 work units) Optimal objective 2.40702335e+03
This is the output when the variable is binary:It's saying matrix Q is not PSD, and diagonal adjustment is required.0 
So, I have tried increasing the PSD tolerance using the PSDtol parameter, but in this case, it doesn't work, as the diagonal adjustment required is quite high ( 1.0 e+00). It works in some cases though.
If possible could you provide any suggestions on how to tackle this problem?
Thanks a lot for your help.0 
If possible could you provide any suggestions on how to tackle this problem?
Could you please try setting PreQLinearize=0? If this does not help, could you please share the two models, one with and one without binaries? You can generate the model files by using the write method. Note that uploading files in the Community Forum is not possible but we discuss an alternative in Posting to the Community Forum.
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
4 comments