Warning: failed to compute QCP dual solution due to inaccurate barrier solution
AnsweredHi,everyone
I used gurobi through YALMIP to solve a SOCP problem ,I successfully obtained the optimal objective value, but failed to get the dual variables, the solving info returned a warning:failed to compute QCP dual solution due to inaccurate barrier solution.
I wonder what is wrong about my problem model below:
clear
s=100;
N=100;
ds=s/N;
Fp=sdpvar(1,N-1);Fd=sdpvar(1,N-1);
Fa=sdpvar(1,N-1);Fg=sdpvar(1,N-1);
Fr=sdpvar(1,N-1);Ekin=sdpvar(1,N);
v=sdpvar(1,N);vr=sdpvar(1,N);
Ee=sdpvar(1,N);
opts1=sdpsettings('solver','gurobi','gurobi.qcpdual',1,'verbose',1,'savesolveroutput',1,'showprogress',4,'debug',1);
Ekindot=Fp-Fd;
Eedot=Fp/0.95;
constraints=[Ekin(2:N)==Ekin(1:N-1)+Ekindot*ds;
Ee(2:N)==Ee(1:N-1)+Eedot*ds;
cone([(2/500)*ones(1,N)+Ekin;
2*v;
(2/500)*ones(1,N)-Ekin]);
cone([v+vr;
2*ones(1,N);
v-vr]);
Fp>=-500*9.8*0.6;
Fp<=5000;
Fd==Fa+Fg+Fr;
Fa==0.5*0.5*2.5*0.3*1.29*2*Ekin(1:N-1)/500;
Fg==0;
Fr==500*9.8*0.4;
Ekin>=250;
Ekin<=25000;
Ee>=0;
Ekin(1)==250;
Ekin(N)==250;
Ee(1)==0.01;
];
obj=sum(vr*ds);
sol=optimize(constraints,obj,opts1);
duals=dual(constraints(1));
-
Additionally, the solving info is below:
+ Solver chosen : GUROBI
+ Processing objective function
+ Processing constraints
+ Calling GUROBI
Set parameter NodefileDir to value ""
Set parameter QCPDual to value 1
Gurobi Optimizer version 11.0.0 build v11.0.0rc2 (win64 - Windows 11.0 (22621.2))
CPU model: AMD Ryzen 7 6800H with Radeon Graphics, instruction set [SSE2|AVX|AVX2]
Thread count: 8 physical cores, 16 logical processors, using up to 16 threads
Optimize a model with 1695 rows, 1495 columns and 3286 nonzeros
Model fingerprint: 0xbf25ae04
Model has 200 quadratic constraints
Coefficient statistics:
Matrix range [1e-03, 2e+00]
QMatrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [4e-03, 3e+04]
Presolve removed 1202 rows and 705 columns
Presolve time: 0.02s
Presolved: 787 rows, 890 columns, 1674 nonzeros
Presolved model has 198 second-order cone constraints
Ordering time: 0.00s
Barrier statistics:
Free vars : 98
AA' NZ : 2.441e+03
Factor NZ : 5.892e+03 (roughly 1 MB of memory)
Factor Ops : 5.678e+04 (less than 1 second per iteration)
Threads : 1
Objective Residual
Iter Primal Dual Primal Dual Compl Time
0 1.80489780e+05 -1.92609200e+04 1.38e+05 1.00e+00 6.30e+03 0s
1 6.00072128e+07 -3.27311504e+05 3.20e+04 8.76e-01 1.08e+05 0s
2 2.29919999e+07 -2.78412254e+05 6.56e+03 4.91e-01 1.13e+04 0s
3 1.50411557e+07 -1.13863850e+05 1.69e+03 3.34e-01 9.42e+03 0s
4 9.78679587e+06 -7.01367591e+04 9.21e+02 2.52e-01 6.86e+03 0s
5 6.98308769e+05 -9.25596135e+03 5.40e+01 1.15e-01 5.80e+02 0s
6 7.57032921e+04 -4.08004578e+03 5.00e+00 7.19e-03 7.35e+01 0s
7 6.86072859e+03 -7.47045613e+02 4.32e-01 7.63e-04 7.13e+00 0s
8 3.88875707e+02 -7.89564824e+01 2.33e-02 1.06e-04 4.39e-01 0s
9 2.80179607e+01 -1.96975844e+01 1.18e-03 3.29e-05 4.46e-02 0s
10 1.80234876e+01 7.60004648e+00 2.87e-04 6.80e-06 9.72e-03 0s
11 1.38774603e+01 1.08904206e+01 8.45e-05 1.51e-06 2.79e-03 0s
12 1.26799912e+01 1.22054837e+01 1.34e-05 2.38e-07 4.43e-04 0s
13 1.24668426e+01 1.24487698e+01 8.87e-07 4.20e-08 1.70e-05 0s
14 1.24524301e+01 1.24520219e+01 1.48e-06 1.36e-08 3.85e-07 0s
15 1.24521027e+01 1.24520782e+01 6.28e-05 6.14e-07 2.29e-08 0s
16 1.24520979e+01 1.24520791e+01 2.75e-04 1.11e-05 1.73e-08 0s
17 1.24520960e+01 1.24520791e+01 7.02e-05 1.46e-05 1.56e-08 0s
18 1.24520960e+01 1.24520791e+01 1.44e-01 2.85e-05 1.56e-08 0s
19 1.24520960e+01 1.24520791e+01 2.95e-01 2.07e-05 1.56e-08 0s
20 1.24520960e+01 1.24520791e+01 5.21e-01 4.90e-05 1.56e-08 0s
21 1.24520960e+01 1.24520791e+01 1.01e+00 9.33e-05 1.56e-08 0s
22 1.24520960e+01 1.24520791e+01 5.27e-01 1.94e-04 1.56e-08 0s
23 1.24520960e+01 1.24520791e+01 7.24e-01 4.05e-04 1.56e-08 0s
24 1.24520960e+01 1.24520791e+01 1.44e+00 8.99e-04 1.56e-08 0s
25 1.24520960e+01 1.24520791e+01 5.42e+00 1.81e-03 1.56e-08 0s
26 1.24520960e+01 1.24520791e+01 4.95e+00 2.07e-03 1.56e-08 0s
27 1.24520960e+01 1.24520791e+01 1.02e+01 3.20e-03 1.56e-08 0s
28 1.24520960e+01 1.24520791e+01 1.13e+01 6.54e-03 1.56e-08 0s
29 1.24520960e+01 1.24520791e+01 1.05e+01 1.29e-02 1.56e-08 0s
30 1.24520960e+01 1.24520791e+01 1.39e+01 2.50e-02 1.56e-08 0s
31 1.24520960e+01 1.24520791e+01 2.32e+01 5.45e-02 1.56e-08 0s
32 1.24520960e+01 1.24520791e+01 6.59e+01 1.26e-01 1.56e-08 0s
33 1.24520958e+01 1.24520791e+01 1.40e+02 4.05e-01 1.54e-08 0s
34 1.24520956e+01 1.24520797e+01 6.35e+01 4.03e-01 1.46e-08 0s
35 1.24520953e+01 1.24520800e+01 1.60e+02 6.32e-01 1.42e-08 0s
36 1.24520955e+01 1.24520802e+01 1.62e+02 1.07e+00 1.42e-08 0s
37 1.24520952e+01 1.24520940e+01 8.82e+00 1.95e-01 1.11e-09 0s
38 1.24520952e+01 1.24520940e+01 8.83e+00 3.16e-01 1.11e-09 0s
39 1.24520952e+01 1.24520940e+01 2.07e+01 6.42e-01 1.12e-09 0s
40 1.24520952e+01 1.24520940e+01 1.82e+01 7.28e-01 1.12e-09 0s
41 1.24520952e+01 1.24520940e+01 1.82e+01 7.31e-01 1.12e-09 0s
42 1.24520952e+01 1.24520940e+01 2.60e+01 1.02e+00 1.12e-09 0s
43 1.24520952e+01 1.24520940e+01 3.71e+01 1.58e+00 1.12e-09 0s
44 1.24520952e+01 1.24520940e+01 6.90e+01 2.15e+00 1.12e-09 0s
45 1.24520952e+01 1.24520940e+01 6.17e+01 3.88e+00 1.12e-09 0s
46 1.24520952e+01 1.24520940e+01 8.67e+01 4.28e+00 1.12e-09 0s
47 1.24520952e+01 1.24520940e+01 7.30e+01 6.25e+00 1.12e-09 0s
48 1.24520952e+01 1.24520940e+01 2.01e+02 8.29e+00 1.13e-09 0s
49 1.24520954e+01 1.24520940e+01 3.45e+02 1.00e+01 1.15e-09 0s
50 1.24520956e+01 1.24520940e+01 4.14e+02 1.08e+01 1.15e-09 0s
51 1.24521066e+01 1.24520940e+01 4.05e+02 1.15e+01 1.20e-09 0s
Barrier solved model in 51 iterations and 0.18 seconds (0.05 work units)
Optimal objective 1.24524301e+01
Warning: failed to compute QCP dual solution due to inaccurate barrier solution
Try decreasing BarQCPConvTol for more accuracy0 -
Hi Liao,
Looking at the output it seems Gurobi found the "optimal" objective of 1.24524301e+01 at iterate 14:
Objective Residual Iter Primal Dual Primal Dual Compl Time
14 1.24524301e+01 1.24520219e+01 1.48e-06 1.36e-08 3.85e-07 0sA good solution should have very small residuals and the relative difference between the primal and dual objective values should be less than the tolerance (specified by BarQCPConvTol in this case). The relative difference for this iterate is approximately 3e-5, so the barrier algorithm does not stop. But as it proceeds the primal and dual infeasibilities get worse. Ultimately what we are left with is a substandard solution, as indicated by the log, and duals cannot be calculated because of this.
As suggested by the log you could try experimenting with the BarQCPConvTol parameter. There are also some good suggestions to try in this post: https://support.gurobi.com/hc/en-us/community/posts/4404870829073-Criteria-for-Barrier-method-early-termination
- Riley
0
Please sign in to leave a comment.
Comments
2 comments