How to define custom precision in CVX


(EHTISHAM ASGHAR) #1

I am working on a problem in which computation time is of critical importance and accuracy is not a concern at all (can compromise with accuracy subject to less computation time). The solver kept running for 3 days and didn’t reach solution at all when I changed the value of an index from 1 to 2. Is this issue related to precision level of solver? If yes, then I want to decrease the precision level (accuracy) and set it as low as possible to have the results quickly and tune the precision level accordingly. If it’s not related to precision level of the solver then why it takes this long by just changing an index from 1 to 2?

Optimizer process is pasted below for e = 1 (e is an index value)

Calling Mosek 8.0.0.60: 49262 variables, 31982 equality constraints

MOSEK Version 8.0.0.60 (Build date: 2017-3-1 13:09:33)
Copyright © MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 31982
Cones : 10079
Scalar variables : 49262
Matrix variables : 0
Integer variables : 864

Optimizer started.
Mixed integer optimizer started.
Threads used: 2
Presolve started.
Presolve terminated. Time = 1.30
Presolved problem: 31363 variables, 6264 constraints, 20723 non-zeros
Presolved problem: 0 general integer, 398 binary, 30965 continuous
Clique table size: 1
BRANCHES RELAXS ACT_NDS DEPTH BEST_INT_OBJ BEST_RELAX_OBJ REL_GAP(%) TIME
0 1 0 0 NA 5.0702969233e+004 NA 2.5
0 1 0 0 5.0702971386e+004 5.0702969233e+004 4.25e-006 5.2
An optimal solution satisfying the relative gap tolerance of 1.00e-002(%) has been located.
The relative gap is 4.25e-006(%).

Objective of best integer solution : 5.070297138586e+004
Best objective bound : 5.070296923254e+004
Construct solution objective : Not employed
Construct solution # roundings : 0
User objective cut value : 0
Number of cuts generated : 0
Number of branches : 0
Number of relaxations solved : 1
Number of interior point iterations: 20
Number of simplex iterations : 0
Time spend presolving the root : 1.30
Time spend in the heuristic : 0.00
Time spend in the sub optimizers : 0.00
Time spend optimizing the root : 0.95
Mixed integer optimizer terminated. Time: 5.24

Optimizer terminated. Time: 5.49

Integer solution solution summary
Problem status : PRIMAL_FEASIBLE
Solution status : INTEGER_OPTIMAL
Primal. obj: 5.0702971386e+004 nrm: 1e+003 Viol. con: 1e-007 var: 1e-007 cones: 2e-009 itg: 0e+000
Optimizer summary
Optimizer - time: 5.49
Interior-point - iterations : 0 time: 0.00
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 1 time: 5.24


Status: Solved
Optimal value (cvx_optval): +50703

Optimizer process is pasted below for e = 2 (e is an index value):

Calling Mosek 8.0.0.60: 78055 variables, 52711 equality constraints

MOSEK Version 8.0.0.60 (Build date: 2017-3-1 13:09:33)
Copyright © MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 52711
Cones : 10079
Scalar variables : 78055
Matrix variables : 0
Integer variables : 3168

Optimizer started.
Mixed integer optimizer started.
Threads used: 16
Presolve started.
Presolve terminated. Time = 1.98
Presolved problem: 36612 variables, 13224 constraints, 46971 non-zeros
Presolved problem: 0 general integer, 1769 binary, 34843 continuous
Clique table size: 39
BRANCHES RELAXS ACT_NDS DEPTH BEST_INT_OBJ BEST_RELAX_OBJ REL_GAP(%) TIME
0 1 0 0 NA 4.9606574926e+004 NA 3.2
0 1 0 0 5.0126129119e+004 4.9606574926e+004 1.04 8.6
Cut generation started.
0 2 0 0 5.0126129119e+004 4.9606574926e+004 1.04 17.4
Cut generation terminated. Time = 1.67
15 18 16 3 5.0126129119e+004 4.9606575486e+004 1.04 23.2
31 34 32 4 5.0126129119e+004 4.9606575486e+004 1.04 25.7
63 66 64 6 5.0126129119e+004 4.9606575486e+004 1.04 30.7
127 130 128 9 5.0126129119e+004 4.9606575486e+004 1.04 40.4
255 258 256 17 5.0126129119e+004 4.9606575486e+004 1.04 59.5
511 514 512 33 5.0126129119e+004 4.9606575486e+004 1.04 99.4
820 823 821 52 5.0126129119e+004 4.9606575486e+004 1.04 158.0
1150 1153 1151 72 5.0126129119e+004 4.9606575486e+004 1.04 210.6
1480 1483 1477 7 5.0126129119e+004 4.9606575486e+004 1.04 261.9
1827 1826 1768 18 5.0126129119e+004 4.9606575486e+004 1.04 313.1
2173 2170 1922 21 5.0126129119e+004 4.9606575486e+004 1.04 369.1
2516 2513 2091 29 5.0126129119e+004 4.9606575486e+004 1.04 426.7
2856 2853 2233 20 5.0126129119e+004 4.9606575486e+004 1.04 483.0
3195 3192 2374 39 5.0126129119e+004 4.9606575486e+004 1.04 540.2
3532 3529 2529 61 5.0126129119e+004 4.9606575522e+004 1.04 598.8
3869 3866 2694 78 5.0126129119e+004 4.9606575522e+004 1.04 655.9
4204 4201 2863 91 5.0126129119e+004 4.9606575522e+004 1.04 712.1
4541 4538 2970 104 5.0126129119e+004 4.9606575522e+004 1.04 768.2
4878 4875 2991 114 5.0126129119e+004 4.9606575522e+004 1.04 824.4
5221 5218 3158 134 5.0126129119e+004 4.9606575522e+004 1.04 877.5
5570 5567 3371 151 5.0126129119e+004 4.9606575522e+004 1.04 928.9
5906 5903 3503 166 5.0126129119e+004 4.9606575522e+004 1.04 983.7
6237 6234 3610 177 5.0126129119e+004 4.9606575522e+004 1.04 1041.6
6570 6567 3713 187 5.0126129119e+004 4.9606575522e+004 1.04 1100.4
6907 6904 3850 197 5.0126129119e+004 4.9606575585e+004 1.04 1156.4
7247 7244 4062 208 5.0113964215e+004 4.9606575608e+004 1.01 1210.2
7570 7560 4333 218 5.0113912504e+004 4.9606575637e+004 1.01 1267.5
7918 7906 4629 229 5.0094138320e+004 4.9606575637e+004 0.97 1322.5
8266 8253 4953 240 5.0094138320e+004 4.9606575664e+004 0.97 1377.8
8615 8602 5252 252 5.0094138320e+004 4.9606575664e+004 0.97 1432.9
8963 8950 5534 262 5.0094138320e+004 4.9606587486e+004 0.97 1489.7
9311 9298 5828 275 5.0094138320e+004 4.9606587586e+004 0.97 1546.9
9660 9647 6137 296 5.0094138320e+004 4.9606587602e+004 0.97 1603.2
10009 9995 6436 18 5.0076882496e+004 4.9606624923e+004 0.94 1660.3
10352 10336 6759 23 5.0076882496e+004 4.9606641047e+004 0.94 1737.8
10698 10682 7067 17 5.0076882496e+004 4.9606654926e+004 0.94 1796.1
11043 11027 7384 13 5.0076882496e+004 4.9606692818e+004 0.94 1852.9
11385 11369 7650 16 5.0076882496e+004 4.9606922172e+004 0.94 1912.4
11725 11710 7890 17 5.0076882496e+004 4.9606951564e+004 0.94 1970.7
12065 12050 8118 16 5.0076882496e+004 4.9606951564e+004 0.94 2031.6
12403 12388 8354 13 5.0076882496e+004 4.9606977664e+004 0.94 2092.6
12738 12723 8559 10 5.0076882496e+004 4.9607059544e+004 0.94 2152.9
13052 13037 8781 18 5.0076882496e+004 4.9607059544e+004 0.94 2219.0
13394 13379 9025 16 5.0076882496e+004 4.9607059544e+004 0.94 2281.2
13737 13722 9278 23 5.0076882496e+004 4.9607240680e+004 0.94 2347.3
14079 14064 9536 37 5.0076882496e+004 4.9607411587e+004 0.94 2410.0
14419 14404 9790 58 5.0076882496e+004 4.9607421304e+004 0.94 2477.3
14761 14746 10058 19 5.0076882496e+004 4.9607421304e+004 0.94 2544.8
15102 15087 10283 20 5.0076882496e+004 4.9607582839e+004 0.94 2613.4
15440 15425 10503 16 5.0076882496e+004 4.9607611730e+004 0.94 2680.5
15780 15765 10675 9 5.0076882496e+004 4.9607611730e+004 0.94 2745.9
16112 16097 10775 17 5.0076882496e+004 4.9607611730e+004 0.94 2811.4
16446 16431 10883 15 5.0076882496e+004 4.9607670953e+004 0.94 2878.0
16778 16763 11029 12 5.0076882496e+004 4.9607670953e+004 0.94 2942.2
17115 17099 11184 17 5.0076863430e+004 4.9607670953e+004 0.94 3005.6
17453 17438 11374 26 5.0067867007e+004 4.9607746932e+004 0.92 3073.3
17809 17786 11654 47 5.0067867007e+004 4.9607772805e+004 0.92 3144.6
18155 18133 11918 9 5.0067867007e+004 4.9608248204e+004 0.92 3215.8
18496 18474 12179 14 5.0067867007e+004 4.9608248204e+004 0.92 3288.1
18818 18796 12431 25 5.0067867007e+004 4.9609314581e+004 0.92 3362.2
19163 19141 12698 16 5.0067867007e+004 4.9609644427e+004 0.92 3431.2
19508 19486 12971 26 5.0067867007e+004 4.9609674920e+004 0.92 3502.3
19854 19832 13223 12 5.0067867007e+004 4.9609674920e+004 0.92 3574.2
20200 20178 13483 14 5.0067867007e+004 4.9609674920e+004 0.92 3646.8
20548 20526 13747 16 5.0067867007e+004 4.9609674920e+004 0.92 3716.3
20900 20878 14057 37 5.0067867007e+004 4.9609674920e+004 0.92 3784.7
21253 21231 14394 56 5.0067867007e+004 4.9609674920e+004 0.92 3855.0
21605 21583 14696 67 5.0060997636e+004 4.9609674920e+004 0.90 3930.0
21958 21932 15003 77 5.0060997636e+004 4.9611578995e+004 0.90 4008.9
22305 22279 15308 87 5.0060997636e+004 4.9611754912e+004 0.90 4088.8
22651 22625 15598 97 5.0060997636e+004 4.9611754912e+004 0.90 4168.8
22994 22968 15883 107 5.0060997636e+004 4.9612011114e+004 0.90 4246.2
23336 23310 16147 117 5.0060997636e+004 4.9612644989e+004 0.90 4325.4
23680 23654 16431 129 5.0060997636e+004 4.9612732428e+004 0.90 4401.1
24027 24001 16710 140 5.0060997636e+004 4.9612732428e+004 0.90 4480.5
24347 24321 16980 150 5.0060997636e+004 4.9612790867e+004 0.90 4567.4
24696 24670 17291 163 5.0060997636e+004 4.9613589241e+004 0.89 4649.0
25045 25019 17576 175 5.0060997636e+004 4.9613589241e+004 0.89 4731.0
25391 25365 17870 186 5.0060997636e+004 4.9614112508e+004 0.89 4813.2
25736 25710 18157 196 5.0060997636e+004 4.9614545565e+004 0.89 4894.7
26084 26058 18447 207 5.0060997636e+004 4.9614869501e+004 0.89 4977.5
26432 26404 18775 226 5.0060997636e+004 4.9614982921e+004 0.89 5061.5
26781 26753 19092 248 5.0060997636e+004 4.9615041211e+004 0.89 5146.3
27124 27096 19395 270 5.0060500746e+004 4.9615041211e+004 0.89 5234.7
27470 27441 19697 22 5.0057255032e+004 4.9615604299e+004 0.88 5326.7
27812 27782 20001 13 5.0057255032e+004 4.9615739317e+004 0.88 5416.4
28160 28130 20347 25 5.0057255032e+004 4.9616114473e+004 0.88 5511.7
28510 28480 20695 18 5.0057255032e+004 4.9616275961e+004 0.88 5608.4
28855 28825 21022 24 5.0057255032e+004 4.9616437409e+004 0.88 5704.8
29204 29172 21333 14 5.0057255032e+004 4.9616523054e+004 0.88 5800.1
29552 29520 21661 22 5.0057255032e+004 4.9616653357e+004 0.88 5894.3
29900 29868 21969 25 5.0057255032e+004 4.9616805138e+004 0.88 5990.7
30248 30216 22285 35 5.0057255032e+004 4.9616805138e+004 0.88 6088.0
30569 30534 22586 15 5.0057255032e+004 4.9617181187e+004 0.88 6192.6
30917 30882 22902 37 5.0057255032e+004 4.9617181187e+004 0.88 6292.2
31265 31230 23228 21 5.0057255032e+004 4.9617483503e+004 0.88 6395.2
31616 31579 23561 20 5.0057255032e+004 4.9617854422e+004 0.88 6498.6
31961 31924 23886 20 5.0057255032e+004 4.9617961295e+004 0.88 6604.2
32306 32269 24215 15 5.0057255032e+004 4.9617989263e+004 0.88 6708.7
32654 32617 24545 16 5.0057255032e+004 4.9618042769e+004 0.88 6814.2
33002 32965 24867 20 5.0057255032e+004 4.9618232205e+004 0.88 6923.3
33347 33310 25206 18 5.0057255032e+004 4.9618280745e+004 0.88 7031.2
33693 33656 25534 35 5.0057255032e+004 4.9618553100e+004 0.88 7141.7
34037 34000 25864 26 5.0057255032e+004 4.9618788305e+004 0.88 7251.5
34384 34347 26185 48 5.0057255032e+004 4.9618788305e+004 0.88 7363.3
34730 34693 26509 20 5.0057255032e+004 4.9618788305e+004 0.88 7476.0
35080 35043 26841 27 5.0057255032e+004 4.9619255349e+004 0.87 7592.1
35423 35386 27152 26 5.0057255032e+004 4.9619387884e+004 0.87 7707.5
35766 35729 27471 21 5.0057255032e+004 4.9619499676e+004 0.87 7822.2
36111 36074 27794 21 5.0057255032e+004 4.9619534573e+004 0.87 7940.2
36459 36420 28094 11 5.0057255032e+004 4.9619692600e+004 0.87 8059.4
36804 36765 28409 17 5.0057255032e+004 4.9619877755e+004 0.87 8181.6
37125 37084 28706 32 5.0057255032e+004 4.9619929006e+004 0.87 8314.6
37466 37425 29039 51 5.0057255032e+004 4.9619929006e+004 0.87 8438.4
37810 37769 29337 25 5.0057255032e+004 4.9620483801e+004 0.87 8562.1
38158 38117 29639 10 5.0057255032e+004 4.9620647739e+004 0.87 8687.9
38504 38463 29941 15 5.0057255032e+004 4.9620759899e+004 0.87 8816.1
38851 38810 30248 29 5.0057255032e+004 4.9620924921e+004 0.87 8945.5
39199 39158 30574 31 5.0057255032e+004 4.9620989612e+004 0.87 9076.4
39548 39507 30883 13 5.0057255032e+004 4.9620989612e+004 0.87 9208.3
39894 39853 31189 22 5.0057255032e+004 4.9621009430e+004 0.87 9341.4
40239 40198 31506 43 5.0057255032e+004 4.9621009430e+004 0.87 9475.5
40587 40546 31804 60 5.0057255032e+004 4.9621009430e+004 0.87 9611.5
40933 40892 32106 20 5.0057255032e+004 4.9621121598e+004 0.87 9748.8
41280 41239 32419 13 5.0057255032e+004 4.9621446116e+004 0.87 9887.5
41627 41586 32758 18 5.0057255032e+004 4.9621531609e+004 0.87 10027.8
41973 41932 33072 18 5.0057255032e+004 4.9621611397e+004 0.87 10170.4


(EHTISHAM ASGHAR) #2

This problem is already resolved thanks.


(Mark L. Stone) #3

You didn’t say how you resolved it, but integer problems can be very unpredictable in run time and can potentially take a very long time to run. You can adjust optimality gap tolerance parameters using cvx_solver_settings http://cvxr.com/cvx/doc/solver.html#advanced-solver-settings


(EHTISHAM ASGHAR) #4

Thanks, we did the same as you have referred to. We have set the termination time.


(Erling D.Andersen) #5

It seems you almost immediately has solution that with in 2% of optimum. Therefore I would set relative gap tolerance to say 5%, 2% or 1% and it would finish quickly. See section 12.5 at

http://docs.mosek.com/8.1/toolbox/mip-optimizer.html#speeding-up-the-solution-process

for details. I do not know how to do in it CVX but it must be possible.

If your problem is not secret I suggest donating a could of instances to cblib.zib.de.