Nonconvex Quadratic Programming

201 views
Skip to first unread message

Aras

unread,
Jan 2, 2020, 8:01:22 AM1/2/20
to YALMIP
Dear Dr. Lofberg and the community,

I am working on non-convex quadratic programming. CPLEX has been solving this problem for some time now. GUROBI is also solving this problem in version 9.0. 

My questions are:
  1. Gurobi gives me solver not applicable error. Normally with cplex the following works:
    optimize(Constraint,-Obj,sdpsettings('solver','cplex', 'cplex.optimalitytarget',3));
    However, in sdpsettings for Gurobi I couldn't find such an option. In Gurobi's documentation it seems like 'NonConvex' might work: https://www.gurobi.com/documentation/9.0/refman/nonconvex.html
    Is this version not yet updated in Gurobi, or is it available?

  2. In CPLEX the following linear constrained nonconvex quadratic program works
     x = sdpvar(2,1);
    Obj = x(1)^2 + x(2)^2;
    Constraint = [ abs(x) <= 5];
    Z = optimize(Constraint,-Obj,sdpsettings('solver','cplex', 'cplex.optimalitytarget',3,'savesolveroutput',1));

    however if I change the constraint to norm(x) <= 5 then it gives me an error. I tried x(1)^2 + x(2)^2 <= 5, or norm(x)^2 <= 5. All gives me
    Warning: Solver not applicable (cplex)


    Any idea how I can fix this? It should solve nonconvex quadratic objective and convex quadratic constraints right? Thanks!!

Johan Löfberg

unread,
Jan 2, 2020, 8:36:05 AM1/2/20
to YALMIP

cplex with nonconvex quadratic objective does not support the case with SOCP constraints as far as I know (I tried and it gave an error complaining about convexity of objective), i.e. it only supports nonconvex quadratic programming.

Aras

unread,
Jan 2, 2020, 8:38:54 AM1/2/20
to YALMIP
Oh, that’s double bad news than. Thank you! Which free solver would you recommend for the norm constrained NCQP problem that I can directly solve via YALMIP?

Johan Löfberg

unread,
Jan 2, 2020, 8:44:49 AM1/2/20
to YALMIP
yalmips own bminb

(trying both with 2-norm constraints and squaring them to get convex quadratics. can make big difference in the solution of lower bounds as the first leads to SOCP models while the second leads to relaxaed LP models, but bmibnb is pretty good at strenghening these)

>> x = sdpvar(2,1);
Obj = x(1)^2 + x(2)^2;
Constraint = [ norm(x) <= 5];
Z = optimize(Constraint,-Obj,sdpsettings('solver','bmibnb'))
* Starting YALMIP global branch & bound.
* Branch-variables : 2
* Upper solver     : fmincon
* Lower solver     : GUROBI
* LP solver        : GUROBI
 Node       Upper      Gap(%)       Lower    Open
    1 :   -9.861E-32   192.31     -5.000E+01   2    
    2 :   -2.500E+01    64.94     -5.000E+01   3    
    3 :   -2.500E+01    64.94     -5.000E+01   4    
    4 :   -2.500E+01    64.94     -5.000E+01   5    
    5 :   -2.500E+01    64.94     -5.000E+01   6    
    6 :   -2.500E+01    64.94     -5.000E+01   7    
    7 :   -2.500E+01    33.21     -3.536E+01   8    
    8 :   -2.500E+01    33.21     -3.536E+01   9    
    9 :   -2.500E+01    33.21     -3.536E+01  10    
   10 :   -2.500E+01    33.21     -3.536E+01  11    
   11 :   -2.500E+01    33.21     -3.536E+01  12    
   12 :   -2.500E+01    33.21     -3.536E+01  13    
   13 :   -2.500E+01    33.21     -3.536E+01  14    
   14 :   -2.500E+01    33.21     -3.536E+01  15    
   15 :   -2.500E+01    24.19     -3.216E+01  16    
   16 :   -2.500E+01    24.19     -3.216E+01  17    
   17 :   -2.500E+01    24.19     -3.216E+01  18    
   18 :   -2.500E+01    24.19     -3.216E+01  19    
   19 :   -2.500E+01    24.19     -3.216E+01  20    
   20 :   -2.500E+01    24.19     -3.216E+01  21    
   21 :   -2.500E+01    24.19     -3.216E+01  22    
   22 :   -2.500E+01    24.19     -3.216E+01  23    
   23 :   -2.500E+01     9.08     -2.747E+01  24    
   24 :   -2.500E+01     9.08     -2.747E+01  25    
   25 :   -2.500E+01     9.08     -2.747E+01  26    
   26 :   -2.500E+01     9.08     -2.747E+01  27    
   27 :   -2.500E+01     9.08     -2.747E+01  28    
   28 :   -2.500E+01     9.08     -2.747E+01  29    
   29 :   -2.500E+01     9.08     -2.747E+01  30    
   30 :   -2.500E+01     9.08     -2.747E+01  31    
   31 :   -2.500E+01     7.60     -2.705E+01  32    
   32 :   -2.500E+01     7.60     -2.705E+01  33    
   33 :   -2.500E+01     7.60     -2.705E+01  34    
   34 :   -2.500E+01     7.60     -2.705E+01  35    
   35 :   -2.500E+01     7.60     -2.705E+01  36    
   36 :   -2.500E+01     7.60     -2.705E+01  37    
   37 :   -2.500E+01     7.60     -2.705E+01  38    
   38 :   -2.500E+01     7.60     -2.705E+01  39    
   39 :   -2.500E+01     6.53     -2.675E+01  40    
   40 :   -2.500E+01     6.53     -2.675E+01  41    
   41 :   -2.500E+01     6.53     -2.675E+01  42    
   42 :   -2.500E+01     6.53     -2.675E+01  43    
   43 :   -2.500E+01     6.53     -2.675E+01  44    
   44 :   -2.500E+01     6.53     -2.675E+01  45    
   45 :   -2.500E+01     6.53     -2.675E+01  46    
   46 :   -2.500E+01     6.53     -2.675E+01  47    
   47 :   -2.500E+01     3.06     -2.581E+01  48    
   48 :   -2.500E+01     3.06     -2.581E+01  49    
   49 :   -2.500E+01     3.06     -2.581E+01  50    
   50 :   -2.500E+01     3.06     -2.581E+01  51    
   51 :   -2.500E+01     3.06     -2.581E+01  52    
   52 :   -2.500E+01     3.06     -2.581E+01  53    
   53 :   -2.500E+01     3.06     -2.581E+01  54    
   54 :   -2.500E+01     3.06     -2.581E+01  55    
   55 :   -2.500E+01     2.34     -2.562E+01  56    
   56 :   -2.500E+01     2.34     -2.562E+01  57    
   57 :   -2.500E+01     2.34     -2.562E+01  58    
   58 :   -2.500E+01     2.34     -2.562E+01  59    
   59 :   -2.500E+01     2.34     -2.562E+01  60    
   60 :   -2.500E+01     2.34     -2.562E+01  61    
   61 :   -2.500E+01     2.34     -2.562E+01  62    
   62 :   -2.500E+01     2.34     -2.562E+01  63    
   63 :   -2.500E+01     2.03     -2.553E+01  64    
   64 :   -2.500E+01     2.03     -2.553E+01  65    
   65 :   -2.500E+01     2.03     -2.553E+01  66    
   66 :   -2.500E+01     2.03     -2.553E+01  67    
   67 :   -2.500E+01     2.03     -2.553E+01  68    
   68 :   -2.500E+01     2.03     -2.553E+01  69    
   69 :   -2.500E+01     2.03     -2.553E+01  70    
   70 :   -2.500E+01     2.03     -2.553E+01  71    
   71 :   -2.500E+01     1.98     -2.552E+01  72    
   72 :   -2.500E+01     1.98     -2.552E+01  73    
   73 :   -2.500E+01     1.98     -2.552E+01  74    
   74 :   -2.500E+01     1.98     -2.552E+01  75    
   75 :   -2.500E+01     1.98     -2.552E+01  76    
   76 :   -2.500E+01     1.98     -2.552E+01  77    
   77 :   -2.500E+01     1.98     -2.552E+01  78    
   78 :   -2.500E+01     1.98     -2.552E+01  79    
   79 :   -2.500E+01     1.67     -2.544E+01  80    
   80 :   -2.500E+01     1.67     -2.544E+01  81    
   81 :   -2.500E+01     1.67     -2.544E+01  82    
   82 :   -2.500E+01     1.67     -2.544E+01  83    
   83 :   -2.500E+01     1.67     -2.544E+01  84    
   84 :   -2.500E+01     1.67     -2.544E+01  85    
   85 :   -2.500E+01     1.67     -2.544E+01  86    
   86 :   -2.500E+01     1.67     -2.544E+01  87    
   87 :   -2.500E+01     0.99     -2.526E+01  88    
* Finished.  Cost: -25 Gap: 0.98616
* Termination with relative gap satisfied 
* Timing: 41% spent in upper solver (87 problems solved)
*         4% spent in lower solver (91 problems solved)
*         31% spent in LP-based domain reduction (714 problems solved)
Z = 
  struct with fields:

    yalmipversion: '20190425'
       yalmiptime: 0.6470
       solvertime: 7.0150
             info: 'Successfully solved (BMIBNB)'
          problem: 0
>> Constraint = [ x'*x <= 25];
Z = optimize(Constraint,-Obj,sdpsettings('solver','bmibnb'))
* Starting YALMIP global branch & bound.
* Branch-variables : 2
* Upper solver     : fmincon
* Lower solver     : GUROBI
* LP solver        : GUROBI
 Node       Upper      Gap(%)       Lower    Open
    1 :   -2.500E+01     0.00     -2.500E+01   2  Improved solution  
* Finished.  Cost: -25 Gap: 3.8453e-07
* Termination with relative gap satisfied 
* Timing: 39% spent in upper solver (1 problems solved)
*         1% spent in lower solver (5 problems solved)
*         8% spent in LP-based domain reduction (4 problems solved)
Z = 
  struct with fields:

    yalmipversion: '20190425'
       yalmiptime: 0.1900
       solvertime: 0.2180
             info: 'Successfully solved (BMIBNB)'
          problem: 0


Aras

unread,
Jan 2, 2020, 4:54:20 PM1/2/20
to YALMIP
Thanks :) It works!
Reply all
Reply to author
Forward
0 new messages