I have a linear Polynomial Optimization problem (DSOS) programming, and I want to solve it with Mosek. Mosek first does the interior point method (IPM) and then switches to simplex method and reoptimizes it with simplex method. The acceptable answer comes from the last iteration of the simplex method. However, when I ask Julia to give me the value of the objective function, it shows me the value from the last iteration of the IPM.
The following result is not for the preceding scripts because my program is too slow. However, the results are similar in the sense that Mosek only looks for the last iteration of IPM. Here the objective is “ub4”:
MOSEK warning 705: #1 (nearly) zero elements are specified in sparse row ''(61592) of matrix 'A'.
MOSEK warning 705: #1 (nearly) zero elements are specified in sparse row ''(61786) of matrix 'A'.
MOSEK warning 705: #1 (nearly) zero elements are specified in sparse row ''(63099) of matrix 'A'.
MOSEK warning 705: #1 (nearly) zero elements are specified in sparse row ''(63127) of matrix 'A'.
MOSEK warning 705: #1 (nearly) zero elements are specified in sparse row ''(63255) of matrix 'A'.
MOSEK warning 705: #1 (nearly) zero elements are specified in sparse row ''(63259) of matrix 'A'.
MOSEK warning 705: #1 (nearly) zero elements are specified in sparse row ''(63321) of matrix 'A'.
MOSEK warning 705: #1 (nearly) zero elements are specified in sparse row ''(64149) of matrix 'A'.
MOSEK warning 705: #2 (nearly) zero elements are specified in sparse row ''(64174) of matrix 'A'.
MOSEK warning 705: #3 (nearly) zero elements are specified in sparse row ''(64245) of matrix 'A'.
Warning number 705 is disabled.
Problem
Name :
Objective sense : min
Type : LO (linear optimization problem)
Constraints : 250499
Cones : 0
Scalar variables : 250222
Matrix variables : 0
Integer variables : 0
Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 133606
Eliminator terminated.
Eliminator started.
Freed constraints in eliminator : 6
Eliminator terminated.
Eliminator - tries : 2 time : 0.00
Lin. dep. - tries : 1 time : 0.06
Lin. dep. - number : 0
Presolve terminated. Time: 0.66
Problem
Name :
Objective sense : min
Type : LO (linear optimization problem)
Constraints : 250499
Cones : 0
Scalar variables : 250222
Matrix variables : 0
Integer variables : 0
Optimizer - threads : 4
Optimizer - solved problem : the dual
Optimizer - Constraints : 14371
Optimizer - Cones : 0
Optimizer - Scalar variables : 14597 conic : 0
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.55 dense det. time : 0.16
Factor - ML order time : 0.09 GP order time : 0.00
Factor - nonzeros before factor : 1.21e+06 after factor : 1.74e+06
Factor - dense dim. : 327 flops : 9.07e+08
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.0e+02 1.1e+01 9.4e+01 0.00e+00 0.000000000e+00 1.800000000e+01 3.0e+01 1.36
1 1.1e+03 1.1e+01 9.0e+01 1.71e+00 4.684526448e-01 1.753091726e+01 2.9e+01 1.58
2 9.1e+02 8.9e+00 7.5e+01 3.16e+00 2.698346354e+00 1.246310732e+01 2.4e+01 1.78
3 8.2e+02 7.5e+00 6.4e+01 2.64e+00 3.332819177e+00 1.018644502e+01 2.1e+01 1.94
4 2.3e+02 2.1e+00 1.8e+01 2.33e+00 5.350360132e+00 6.271789764e+00 5.8e+00 2.19
5 9.9e+01 9.0e-01 7.6e+00 1.68e+00 4.906117052e+00 5.204972972e+00 2.5e+00 2.48
6 4.4e+01 4.1e-01 3.4e+00 1.45e+00 4.608106162e+00 4.723165956e+00 1.1e+00 2.67
7 2.3e+01 2.1e-01 1.8e+00 1.28e+00 4.478708228e+00 4.534840670e+00 5.8e-01 2.86
8 1.3e+01 1.1e-01 9.7e-01 1.14e+00 4.428036482e+00 4.457422304e+00 3.1e-01 3.09
9 2.9e+00 2.7e-02 2.3e-01 1.08e+00 4.357429102e+00 4.364107497e+00 7.4e-02 3.28
10 2.8e+00 2.6e-02 2.2e-01 1.06e+00 4.349376905e+00 4.355653202e+00 7.1e-02 3.45
11 7.9e-01 7.3e-03 6.2e-02 1.07e+00 4.301093960e+00 4.302774090e+00 2.0e-02 3.64
12 7.6e-01 6.9e-03 5.9e-02 9.99e-01 4.298856951e+00 4.300457652e+00 1.9e-02 3.78
13 8.8e-02 8.1e-04 6.8e-03 9.91e-01 4.270870235e+00 4.271050257e+00 2.6e-03 4.00
14 8.1e-02 7.4e-04 6.3e-03 9.30e-01 4.270115379e+00 4.270280702e+00 2.4e-03 4.17
15 3.5e-02 3.2e-04 2.7e-03 9.37e-01 4.265623399e+00 4.265695527e+00 1.0e-03 4.34
16 3.4e-02 3.1e-04 2.7e-03 9.18e-01 4.265568835e+00 4.265640624e+00 1.0e-03 4.49
17 3.3e-02 3.0e-04 2.5e-03 9.22e-01 4.265281584e+00 4.265350328e+00 9.8e-04 4.61
18 2.8e-02 2.5e-04 2.2e-03 9.24e-01 4.264471157e+00 4.264529880e+00 8.4e-04 4.77
19 1.1e-02 1.0e-04 8.9e-04 9.32e-01 4.261960082e+00 4.261984526e+00 3.7e-04 4.95
20 7.4e-03 6.8e-05 5.8e-04 9.61e-01 4.261083559e+00 4.261099577e+00 2.4e-04 5.11
21 5.9e-03 7.5e-05 4.6e-04 9.63e-01 4.260686528e+00 4.260699312e+00 1.9e-04 5.27
22 4.8e-03 1.3e-04 3.7e-04 9.67e-01 4.260335195e+00 4.260345514e+00 1.5e-04 5.44
23 4.4e-03 1.7e-04 3.4e-04 9.67e-01 4.260182951e+00 4.260192585e+00 1.5e-04 5.58
24 2.5e-03 2.5e-04 1.9e-04 9.68e-01 4.259408588e+00 4.259414000e+00 8.5e-05 5.77
25 2.0e-03 3.2e-04 1.6e-04 9.69e-01 4.259144826e+00 4.259149244e+00 6.8e-05 5.94
26 1.7e-03 3.6e-04 1.3e-04 9.71e-01 4.258922145e+00 4.258925858e+00 5.7e-05 6.11
27 1.6e-03 4.0e-04 1.2e-04 9.73e-01 4.258811658e+00 4.258815046e+00 5.2e-05 6.25
28 1.1e-03 5.3e-04 8.9e-05 9.73e-01 4.258493537e+00 4.258496054e+00 3.8e-05 6.44
29 1.0e-03 5.2e-04 7.9e-05 9.74e-01 4.258382536e+00 4.258384768e+00 3.4e-05 6.61
30 9.2e-04 5.3e-04 7.1e-05 9.75e-01 4.258290855e+00 4.258292879e+00 3.1e-05 6.77
31 8.2e-04 6.1e-04 6.3e-05 9.76e-01 4.258181173e+00 4.258182966e+00 2.7e-05 6.95
32 5.4e-04 8.6e-04 4.2e-05 9.76e-01 4.257862908e+00 4.257864098e+00 1.7e-05 7.14
33 4.6e-04 9.9e-04 3.5e-05 9.80e-01 4.257748355e+00 4.257749361e+00 1.4e-05 7.31
34 3.6e-04 1.2e-03 2.8e-05 9.81e-01 4.257597105e+00 4.257597905e+00 1.1e-05 7.53
35 2.8e-04 1.4e-03 2.1e-05 9.82e-01 4.257438207e+00 4.257438822e+00 8.7e-06 7.69
36 2.3e-04 1.6e-03 1.8e-05 9.84e-01 4.257333568e+00 4.257334076e+00 7.1e-06 7.83
37 1.8e-04 1.8e-03 1.4e-05 9.85e-01 4.257222149e+00 4.257222559e+00 5.6e-06 7.99
38 1.7e-04 1.9e-03 1.3e-05 9.87e-01 4.257175825e+00 4.257176195e+00 5.1e-06 8.14
39 1.3e-04 2.0e-03 1.0e-05 9.87e-01 4.257068245e+00 4.257068536e+00 3.9e-06 8.30
40 1.2e-04 2.1e-03 9.6e-06 9.89e-01 4.257046151e+00 4.257046427e+00 3.7e-06 8.45
41 1.2e-04 2.1e-03 9.6e-06 9.87e-01 4.257046151e+00 4.257046427e+00 3.7e-06 8.61
42 1.2e-04 2.1e-03 9.6e-06 9.57e-01 4.257046151e+00 4.257046427e+00 3.7e-06 8.81
43 1.2e-04 2.1e-03 9.6e-06 -1.19e+00 4.257046151e+00 4.257046427e+00 3.7e-06 8.92
44 1.2e-04 2.1e-03 9.6e-06 7.49e-01 4.257046151e+00 4.257046427e+00 3.7e-06 9.05
45 1.2e-04 2.1e-03 9.6e-06 9.74e-01 4.257046151e+00 4.257046427e+00 3.7e-06 9.17
46 1.2e-04 2.0e-03 9.4e-06 9.98e-01 4.257049752e+00 4.257050022e+00 3.7e-06 9.36
Basis identification started.
Primal basis identification phase started.
Primal basis identification phase terminated. Time: 0.16
Dual basis identification phase started.
Dual basis identification phase terminated. Time: 1.66
Simplex reoptimization started.
Dual simplex reoptimization started.
ITER DEGITER(%) PFEAS DFEAS POBJ DOBJ TIME
0 0.00 2.92e+03 NA 4.250812464735e+00 NA 0.02
1121 49.38 0.00e+00 NA 4.246736222887e+00 NA 4.58
Dual simplex reoptimization terminated. Time: 4.58
Primal simplex reoptimization started.
ITER DEGITER(%) PFEAS DFEAS POBJ DOBJ TIME
0 0.00 NA 0.00e+00 NA 4.246736331660e+00 0.02
1 0.00 NA 0.00e+00 NA 4.246736331659e+00 0.03
Primal simplex reoptimization terminated. Time: 0.03
Simplex reoptimization terminated. Time: 4.73
Basis identification terminated. Time: 8.89
Optimizer terminated. Time: 18.50
value(ub4) = 4.257049761318281
4.257049761318281
I also added the result of my program in the following:
Problem
Name :
Objective sense : min
Type : LO (linear optimization problem)
Constraints : 1700705
Cones : 0
Scalar variables : 1700193
Matrix variables : 0
Integer variables : 0
Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 1657109
Eliminator terminated.
Eliminator started.
Freed constraints in eliminator : 24
Eliminator terminated.
Eliminator - tries : 2 time : 0.00
Lin. dep. - tries : 1 time : 2.94
Lin. dep. - number : 426
Presolve terminated. Time: 16.66
Problem
Name :
Objective sense : min
Type : LO (linear optimization problem)
Constraints : 1700705
Cones : 0
Scalar variables : 1700193
Matrix variables : 0
Integer variables : 0
Optimizer - threads : 4
Optimizer - solved problem : the primal
Optimizer - Constraints : 42940
Optimizer - Cones : 0
Optimizer - Scalar variables : 1701413 conic : 0
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 7.19 dense det. time : 0.00
Factor - ML order time : 0.25 GP order time : 0.00
Factor - nonzeros before factor : 8.90e+06 after factor : 1.70e+07
Factor - dense dim. : 2 flops : 1.28e+10
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 3.2e+03 1.6e+01 4.6e+04 0.00e+00 1.634937241e+04 0.000000000e+00 7.9e+00 25.86
1 3.1e+03 1.6e+01 4.5e+04 -7.24e-01 1.630379476e+04 1.448877208e-04 7.7e+00 28.34
2 3.1e+03 1.6e+01 4.4e+04 -7.78e-01 1.630130260e+04 2.384915934e-04 7.7e+00 29.75
3 3.1e+03 1.6e+01 4.4e+04 -6.91e-01 1.629771559e+04 3.607703543e-04 7.6e+00 31.14
4 3.1e+03 1.6e+01 4.4e+04 -6.75e-01 1.629319223e+04 5.140900368e-04 7.6e+00 32.73
5 3.1e+03 1.6e+01 4.4e+04 -6.85e-01 1.629262791e+04 5.333462833e-04 7.6e+00 34.06
6 3.1e+03 1.6e+01 4.4e+04 -7.28e-01 1.629250634e+04 5.377366205e-04 7.6e+00 36.69
7 3.1e+03 1.6e+01 4.4e+04 -7.93e-01 1.629250634e+04 5.377366205e-04 7.6e+00 38.94
8 3.1e+03 1.6e+01 4.4e+04 -7.93e-01 1.629250634e+04 5.377366205e-04 7.6e+00 41.41
9 3.1e+03 1.6e+01 4.4e+04 -7.93e-01 1.629250634e+04 5.377366205e-04 7.6e+00 43.47
10 3.1e+03 1.6e+01 4.4e+04 -7.95e-01 1.629250634e+04 5.377366205e-04 7.6e+00 45.56
11 3.1e+03 1.6e+01 4.4e+04 -8.10e-01 1.629250634e+04 5.377366205e-04 7.6e+00 47.69
12 3.1e+03 1.6e+01 4.4e+04 -8.85e-01 1.629240445e+04 5.438955443e-04 7.6e+00 49.83
Basis identification started.
Primal basis identification phase started.
Primal basis identification phase terminated. Time: 0.48
Dual basis identification phase started.
Dual basis identification phase terminated. Time: 0.06
Simplex reoptimization started.
Primal simplex reoptimization started.
ITER DEGITER(%) PFEAS DFEAS POBJ DOBJ TIME
0 0.00 7.62e-01 NA 2.930520743326e-02 NA 0.19
2500 24.55 0.00e+00 NA 4.532192773164e+00 NA 24.27
5000 12.92 0.00e+00 NA 4.271522491917e+00 NA 35.39
5725 11.44 0.00e+00 NA 4.254961577998e+00 NA 43.66
Primal simplex reoptimization terminated. Time: 43.66
Simplex reoptimization terminated. Time: 43.98
Basis identification terminated. Time: 66.33
Optimizer terminated. Time: 118.42
value(ub0) = 16292.404453101784
16292.404453101784
Let’s forget about “ub4”. Because my program is slow, I decided to show you the result of another program with the same problem. However, now, I write the scripts and the result of my program in this comment. Sorry for the inconvenience.
This suggests the Mosek knows something went wrong. You should always be cautious about accepting the results of a solver. For tricky problems, they can often fail.
I think you need to re-think your modeling approach. What are you trying to do/show? Do you need 18th order monomials?(!) Is Mosek the right choice of solver?
I suppose 4.2549 from the last iteration of simplex method in Mosek is the correct answer for this optimization because Gurobi gives the same answer and also I know it from my research. I do not know why your Gurobi solved this problem that way, this is the result when I solve it by Gurobi:
As it can be seen, the answer of Mosek and Gurobi are similar up to 5 digits.
The problem is not specifically related to this optimization. I think whenever Mosek switches to Simplex method, it does not consider the answer of Simplex method and only considers the answer of IPM. I am also wondering why in the solution summary of Mosek the Simplex iterations is 0 and the Barrier iterations is 13, while there are 5725 iterations for Simplex.