How to adjust the parameter for termination condition and how to read the output?
AnsweredI have a convex quadratic programming problem, and its solution is guaranteed. However, when I used Gurobi to solve the problem, it said that "GUROBI failed to solve this problem". When I output the iterations, I do not understand why because the "Compl" is already 10^-9, it seems that the termination condition is satisfied... I will really appreciate it if you can tell me how to read this output and how should I adjust the parameter. (I tried to find the instruction of output online but I could not find it)
Is it possible to automatically adjust the parameters in Gurobi?
When I set verbose = True, the output is as below:
-------------------------------------------------------------------------------
Compilation
-------------------------------------------------------------------------------
(CVXPY) Mar 30 02:21:43 PM: Compiling problem (target solver=GUROBI).
(CVXPY) Mar 30 02:21:43 PM: Reduction chain: CvxAttr2Constr -> Qp2SymbolicQp -> QpMatrixStuffing -> GUROBI
(CVXPY) Mar 30 02:21:43 PM: Applying reduction CvxAttr2Constr
(CVXPY) Mar 30 02:21:43 PM: Applying reduction Qp2SymbolicQp
(CVXPY) Mar 30 02:21:43 PM: Applying reduction QpMatrixStuffing
(CVXPY) Mar 30 02:21:43 PM: Applying reduction GUROBI
(CVXPY) Mar 30 02:21:43 PM: Finished problem compilation (took 1.496e-02 seconds).
-------------------------------------------------------------------------------
Numerical solver
-------------------------------------------------------------------------------
(CVXPY) Mar 30 02:21:43 PM: Invoking solver GUROBI to obtain a solution.
Set parameter QCPDual to value 1
Set parameter BarHomogeneous to value 1
Gurobi Optimizer version 10.0.0 build v10.0.0rc2 (win64)
CPU model: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz, instruction set [SSE2|AVX|AVX2]
Thread count: 8 physical cores, 16 logical processors, using up to 16 threads
Optimize a model with 976 rows, 162 columns and 2971 nonzeros
Model fingerprint: 0x5774741d
Model has 79 quadratic objective terms
Coefficient statistics:
Matrix range [1e+00, 6e+04]
Objective range [0e+00, 0e+00]
QObjective range [2e+00, 2e+00]
Bounds range [0e+00, 0e+00]
RHS range [1e+00, 2e+02]
Presolve removed 595 rows and 5 columns
Presolve time: 0.01s
Presolved: 381 rows, 387 columns, 1754 nonzeros
Presolved model has 79 quadratic objective terms
Ordering time: 0.00s
Barrier statistics:
AA' NZ : 5.905e+03
Factor NZ : 7.248e+03
Factor Ops : 1.431e+05 (less than 1 second per iteration)
Threads : 1
Objective Residual
Iter Primal Dual Primal Dual Compl Time
0 5.45033780e+10 -1.75900664e+12 2.51e+05 2.14e+05 3.80e+10 0s
1 8.41885257e+08 -4.84792279e+11 2.65e+04 1.62e+04 3.27e+09 0s
2 7.39591445e+07 -2.13873035e+10 4.26e+02 2.74e+02 7.16e+07 0s
3 1.23384346e+07 -5.66456568e+09 5.70e+01 4.03e+01 1.28e+07 0s
4 1.36026530e+06 -3.52511000e+08 3.90e+00 2.58e+00 7.45e+05 0s
5 8.66038347e+03 -3.52439166e+07 4.14e-01 2.71e-01 7.24e+04 0s
6 7.79387165e+02 -5.76394547e+06 6.99e-02 4.41e-02 1.08e+04 0s
7 1.65297807e+02 -1.47584641e+06 1.85e-02 1.13e-02 2.43e+03 0s
8 1.01240615e+02 -8.49505106e+05 1.05e-02 6.48e-03 1.34e+03 0s
9 4.06007779e+01 -2.30924187e+05 2.53e-03 1.76e-03 3.40e+02 0s
10 2.94397165e+01 -2.58464269e+04 2.97e-04 1.97e-04 3.56e+01 0s
11 2.86879539e+01 -1.99256296e+03 2.46e-05 1.54e-05 2.71e+00 0s
12 2.79653446e+01 -5.79562189e+02 7.42e-06 4.63e-06 8.18e-01 0s
13 2.59847974e+01 -1.27637649e+02 3.06e-06 1.26e-06 2.14e-01 0s
14 2.60856718e+01 3.84206426e+00 3.57e-07 8.34e-06 3.02e-02 0s
15 2.51014128e+01 2.45110121e+01 5.75e-07 1.90e-05 8.06e-04 0s
16 2.50077832e+01 2.49973000e+01 5.10e-08 3.42e-06 5.65e-06 0s
17 2.50125035e+01 2.50003699e+01 5.12e-07 1.56e-04 5.71e-09 0s
18 2.50126368e+01 2.50106355e+01 4.65e-07 7.63e-04 5.71e-12 0s
19 2.52116245e+01 3.87529811e+03 5.27e-05 2.69e+03 5.89e-15 0s
20 2.52107305e+01 3.79583043e+03 4.50e-05 2.63e+03 5.77e-15 0s
21 2.52100436e+01 3.54555325e+03 4.06e-05 2.46e+03 5.39e-15 0s
22 2.99101513e+01 6.02072119e+05 1.37e-03 1.33e+06 1.14e-16 0s
23 2.99160933e+01 5.97788340e+05 1.33e-03 1.32e+06 1.78e-15 0s
24 2.99052390e+01 5.55068030e+05 1.28e-03 1.22e+06 1.73e-11 0s
25 3.12492764e+01 5.57872478e+05 1.88e-03 1.23e+06 7.02e-11 0s
26 3.13546677e+01 5.57113719e+05 1.88e-03 1.23e+06 1.03e-10 0s
27 3.36901868e+01 5.44252673e+05 2.49e-03 1.20e+06 1.18e-09 0s
28 3.31504142e+01 5.38914397e+05 2.55e-03 1.19e+06 1.68e-09 0s
29 3.32148535e+01 5.39078885e+05 2.53e-03 1.19e+06 1.83e-09 0s
30 3.06315505e+01 5.16574405e+05 2.15e-03 1.14e+06 1.84e-07 0s
31 3.01609821e+01 5.04531630e+05 2.26e-03 1.03e+06 2.23e-06 0s
32 3.01527584e+01 2.47477967e+01 2.26e-03 1.22e-04 3.13e-06 0s
33 3.01216239e+01 2.47684033e+01 2.27e-03 1.07e-02 3.14e-06 0s
34 2.77557934e+01 2.47792184e+01 1.97e-03 4.42e-01 7.46e-06 0s
35 2.75153921e+01 2.48977197e+01 1.83e-03 1.68e-01 6.98e-06 0s
36 2.67116633e+01 2.40704856e+01 1.40e-03 8.59e-02 6.28e-06 0s
37 2.57747021e+01 2.34473157e+01 1.40e-03 1.34e+00 4.94e-06 0s
38 2.45547652e+01 2.44178118e+01 7.37e-04 6.38e-01 2.26e-06 0s
39 2.42574149e+01 2.48164107e+01 2.90e-04 1.74e-01 6.31e-07 0s
40 2.42513175e+01 2.48054231e+01 2.93e-04 1.99e-01 6.25e-07 0s
41 2.44431103e+01 2.47641883e+01 3.30e-04 7.17e-01 5.41e-09 0s
42 2.44457087e+01 2.46736926e+01 3.68e-04 1.35e-01 5.15e-09 0s
43 2.44474886e+01 2.45308489e+01 2.77e-04 1.03e+00 3.39e-09 0s
44 2.44462283e+01 2.45293534e+01 2.68e-04 9.87e-01 3.27e-09 0s
45 2.44453221e+01 2.45236612e+01 2.60e-04 9.60e-01 3.17e-09 0s
46 2.44491310e+01 2.45145026e+01 2.50e-04 9.04e-01 2.98e-09 0s
47 2.44470451e+01 2.44977264e+01 2.06e-04 8.30e-01 2.69e-09 0s
48 2.44433134e+01 2.44341156e+01 1.94e-04 8.68e-01 2.49e-09 0s
49 2.44425384e+01 2.38048958e+01 1.82e-04 2.01e+00 2.32e-09 0s
50 2.43820039e+01 3.51752518e+01 1.71e-04 9.88e+00 2.15e-09 0s
51 2.86177612e+01 4.05112367e+02 3.46e-03 5.84e+02 1.23e-10 0s
52 2.85549880e+01 1.21994118e+02 1.49e-03 1.53e+02 1.09e-10 0s
53 2.85604565e+01 1.00377108e+02 1.29e-03 1.17e+02 4.63e-09 0s
Barrier performed 53 iterations in 0.07 seconds (0.02 work units)
Numerical trouble encountered
-
Hi,
The barrier algorithm terminates if 1) the primal solution is feasible 2) the dual solution is feasible and 3) the normalized duality gap (the difference between primal and dual objective values) is less than the convergence tolerance, i.e., the BarQCPConvTol parameter value for the QCP problems.
Your log shows that at iteration 53 where the barrier algorithm encountered numerical issues, the solution is not dual feasible because of the residual as big as 1.17e+02.
Is it possible to automatically adjust the parameters in Gurobi?
You can pass Gurobi parameters to the \(\texttt{cvxpy.solve(**params)}\) method using a Python dictionary in the form \(\texttt{params = {Gurobi parameter name: value}}\).
You can consider running your model with Gurobi numerically-alert parameters listed below.
-
NumericFocus=1|2|3
- Start by setting this parameter to 1 and then increase it to 2 and 3, if necessary
- Aggregate=0
- ScaleFlag=2
Hope this helps.
Best regards,Maliheh
1 -
NumericFocus=1|2|3
Please sign in to leave a comment.
Comments
1 comment