Selection of Mosek Optimizer in JuMP not respected

Hi,
I am using MosekTools with JuMP. I have been facing problem in forcing solver attributes to Mosek.
for example, following seems to work
set_attribute(myModel, “MSK_IPAR_PRESOLVE_USE”, 0)
but, following does not work
set_attribute(myModel,“MSK_IPAR_OPTIMIZER”, 4)

Mosek is choosing Primal simplex method whenever it attempts to solve my model, even though I gave above attribute. Can you please let me know where things might be going wrong?

Note: the integers given as attribute values are taken from Mosek documentation.

further, following also does not work
set_attribute(myModel, “MSK_IPAR_INFEAS_REPORT_AUTO”,“MSK_ON”)

in this example, keyword has “IPAR” which as per JuMP documentation takes integer value, but there is no integer given for MSK_ON in Mosek documentation. If I try
set_attribute(myModel, “MSK_IPAR_INFEAS_REPORT_AUTO”,1)
or
set_attribute(myModel, “INFEAS_REPORT_AUTO”,“MSK_ON”)
it does not work.

similar to this, many such attributes of Mosek, I am confused how to set.

I’ve opened an issue to better document how to set options: Document how to set options · Issue #146 · jump-dev/MosekTools.jl · GitHub

PR is Clarify option setting in the README by odow · Pull Request #147 · jump-dev/MosekTools.jl · GitHub

You probably need:

using JuMP, Mosek, MosekTools
model = Model(Mosek.Optimizer)
set_attribute(model, "MSK_IPAR_INFEAS_REPORT_AUTO", Mosek.MSK_ON)

Mosek is choosing Primal simplex method whenever it attempts to solve my model, even though I gave above attribute. Can you please let me know where things might be going wrong?

I’m not sure. This might be an issue in Mosek. Do you have a reproducible example? Can you post the full log of the solve?

Mosek is choosing Primal simplex method whenever it attempts to solve my model, even though I gave above attribute

This worked for me:

using JuMP, Mosek, MosekTools
model = Model(Mosek.Optimizer)
set_attribute(model, "MSK_IPAR_OPTIMIZER", Mosek.MSK_OPTIMIZER_INTPNT)
@variable(model, x >= 0)
@constraint(model, 2 * x <= 1)
@objective(model, Max, 3 * x + 1)
julia> optimize!(model)
Problem
  Name                   :                 
  Objective sense        : maximize        
  Type                   : LO (linear optimization problem)
  Constraints            : 1               
  Affine conic cons.     : 0               
  Disjunctive cons.      : 0               
  Cones                  : 0               
  Scalar variables       : 1               
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer started.
Presolve started.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries                  : 1                 time                   : 0.00            
Lin. dep.  - tries                  : 0                 time                   : 0.00            
Lin. dep.  - primal attempts        : 0                 successes              : 0               
Lin. dep.  - dual attempts          : 0                 successes              : 0               
Lin. dep.  - primal deps.           : 0                 dual deps.             : 0               
Presolve terminated. Time: 0.00    
Optimizer terminated. Time: 0.00    


Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: 2.5000000000e+00    nrm: 1e+00    Viol.  con: 0e+00    var: 0e+00  
  Dual.    obj: 2.5000000000e+00    nrm: 2e+00    Viol.  con: 0e+00    var: 0e+00  

Basic solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: 2.5000000000e+00    nrm: 1e+00    Viol.  con: 0e+00    var: 0e+00  
  Dual.    obj: 2.5000000000e+00    nrm: 2e+00    Viol.  con: 0e+00    var: 0e+00  

Hi @odow,
So, essentially I learnt that importing MosekTools is not enough to set attributes to Mosek solver. Now I imported both Mosek.jl and MosekTools.jl and used the same commands and it started working.

Thank you so much :handshake:

In bender’s decomposition, the subproblem is solved multiple times. In the first iteration, it is being solved by INTPNT. But, all subsequent solutions are performed by Mosek using Primal simplex only, even if we use the command

set_attribute(model, "MSK_IPAR_OPTIMIZER", Mosek.MSK_OPTIMIZER_INTPNT)

Following is the log of a sample run

Iteration  Lower Bound  Upper Bound          Gap
[ Info: iteration 1:
Master problem solution: [0.0, 234.0, 60.0, 25.2, 100.1, 18.9, 51.5, 7.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 2:
Master problem solution: [0.0, 234.0, 60.0, 25.2, 100.1, 18.9, 51.5, 10.5])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 3:
Master problem solution: [0.2, 234.0, 60.0, 25.2, 100.1, 18.9, 51.5, 12.600000000000001])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 4:
Master problem solution: [1.5, 234.0, 60.0, 25.2, 100.1, 18.9, 51.5, 12.600000000000001])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 5:
Master problem solution: [3.5, 234.0, 60.0, 25.2, 100.1, 18.9, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 6:
Master problem solution: [6.5, 234.0, 60.0, 25.2, 100.1, 18.9, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 7:
Master problem solution: [0.2, 222.59999999999997, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 8:
Master problem solution: [1.7000000000000002, 224.39999999999998, 60.0, 25.2, 100.0, 29.4, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 9:
Master problem solution: [5.4, 228.6, 60.0, 25.2, 101.0, 24.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 10:
Master problem solution: [3.6, 225.0, 60.0, 25.2, 100.0, 28.69999452755752, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 11:
Master problem solution: [3.7, 222.6, 60.0, 25.2, 100.0, 31.499999999999993, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 12:
Master problem solution: [7.300000000000001, 225.0, 60.0, 25.2, 100.0, 28.699999999999996, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 13:
Master problem solution: [7.1000000000000005, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 14:
Master problem solution: [9.0, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 15:
Master problem solution: [10.700000000000001, 222.6, 60.1, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 16:
Master problem solution: [12.200000000000001, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 17:
Master problem solution: [13.600000000000001, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 18:
Master problem solution: [14.8, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 19:
Master problem solution: [15.9, 222.6, 59.99999999999994, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 20:
Master problem solution: [16.8, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 21:
Master problem solution: [17.5, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 22:
Master problem solution: [18.1, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 23:
Master problem solution: [18.6, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 24:
Master problem solution: [19.200000000000003, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 25:
Master problem solution: [19.6, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 26:
Master problem solution: [19.999999999999996, 222.6, 60.1, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 27:
Master problem solution: [20.3, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 28:
Master problem solution: [20.6, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 29:
Master problem solution: [20.900000000000002, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 30:
Master problem solution: [21.1, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 31:
Master problem solution: [21.3, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 32:
Master problem solution: [21.5, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 33:
Master problem solution: [21.6, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 34:
Master problem solution: [21.700000000000003, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 35:
Master problem solution: [21.8, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 36:
Master problem solution: [21.900000000000002, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 37:
Master problem solution: [22.0, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 38:
Master problem solution: [22.1, 222.6, 59.99999999999996, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 39:
Master problem solution: [22.1, 222.6, 60.1, 25.2, 100.0, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 40:
Master problem solution: [22.200000000000003, 222.6, 60.0, 25.2, 100.0, 31.5, 51.5, 13.0])
Problem
  Name                   :
  Objective sense        : minimize
  Type                   : LO (linear optimization problem)
  Constraints            : 254039
  Affine conic cons.     : 0
  Disjunctive cons.      : 0
  Cones                  : 0
  Scalar variables       : 122648
  Matrix variables       : 0
  Integer variables      : 0

Optimizer started.
GP based matrix reordering started.
GP based matrix reordering terminated.
Optimizer  - threads                : 4
Optimizer  - solved problem         : the dual        
Optimizer  - Constraints            : 122640
Optimizer  - Cones                  : 0
Optimizer  - Scalar variables       : 376680            conic                  : 0
Optimizer  - Semi-definite variables: 0                 scalarized             : 0
Factor     - setup time             : 1.42
Factor     - dense det. time        : 0.09              GP order time          : 0.81
Factor     - nonzeros before factor : 9.82e+05          after factor           : 1.62e+06
Factor     - dense dim.             : 6                 flops                  : 2.49e+07
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME
0   1.4e+07  3.4e+00  1.1e+07  0.00e+00   5.040806270e+06   -5.689002211e+06  2.1e+02  1.81
1   9.5e+06  2.3e+00  7.1e+06  2.60e+01   1.139275519e+06   -7.707307219e+05  1.4e+02  2.19  
2   7.6e+06  1.8e+00  5.7e+06  2.91e-01   8.765397154e+05   -7.361787948e+05  1.1e+02  2.55  
3   7.0e+06  1.7e+00  5.2e+06  1.46e+00   7.861974399e+05   -6.086027294e+05  1.0e+02  2.89  
4   6.8e+06  1.6e+00  5.1e+06  1.53e+00   7.424072730e+05   -5.642718538e+05  9.9e+01  3.25  
5   6.7e+06  1.6e+00  5.0e+06  1.71e+00   7.396991711e+05   -5.287813680e+05  9.8e+01  3.61  
6   5.1e+06  1.2e+00  3.8e+06  1.76e+00   5.503871981e+05   -2.322526846e+05  7.5e+01  3.95  
7   4.7e+06  1.1e+00  3.5e+06  1.71e+00   5.132298619e+05   -1.711861941e+05  6.9e+01  4.33  
8   3.4e+06  8.1e-01  2.5e+06  1.71e+00   4.204555586e+05   -7.282409503e+03  4.9e+01  4.70  
9   3.3e+06  7.9e-01  2.5e+06  1.55e+00   4.171639825e+05   1.738989696e+03   4.8e+01  5.03  
10  2.6e+06  6.2e-01  1.9e+06  1.52e+00   3.771276085e+05   6.913276921e+04   3.8e+01  5.38  
11  6.3e+05  1.5e-01  4.7e+05  1.40e+00   2.934775788e+05   2.318655604e+05   9.2e+00  5.78  
12  1.9e+05  4.6e-02  1.4e+05  1.12e+00   2.782973390e+05   2.601527023e+05   2.8e+00  6.17  
13  7.0e+04  1.7e-02  5.2e+04  1.05e+00   2.743088217e+05   2.678967261e+05   1.0e+00  6.55  
14  1.5e+04  3.7e-03  1.1e+04  1.02e+00   2.726584738e+05   2.712628337e+05   2.2e-01  6.92  
15  3.2e+03  7.6e-04  2.4e+03  1.01e+00   2.723008127e+05   2.720107544e+05   4.7e-02  7.31  
16  2.1e+03  5.0e-04  1.6e+03  9.90e-01   2.722696807e+05   2.720789938e+05   3.0e-02  7.64  
17  1.3e+03  3.0e-04  9.5e+02  1.00e+00   2.722459108e+05   2.721294799e+05   1.9e-02  7.97  
18  1.3e+03  3.0e-04  9.3e+02  7.70e-01   2.722481432e+05   2.721293393e+05   1.8e-02  8.33  
19  1.4e+02  3.4e-05  1.0e+02  9.13e-01   2.722182342e+05   2.722047607e+05   2.1e-03  8.70  
20  7.6e+01  1.8e-05  5.7e+01  9.35e-01   2.722169594e+05   2.722095494e+05   1.1e-03  9.08  
21  3.7e+01  8.8e-06  2.7e+01  9.67e-01   2.722161718e+05   2.722125645e+05   5.4e-04  9.45  
22  2.2e+01  5.3e-06  1.7e+01  9.85e-01   2.722158800e+05   2.722136813e+05   3.3e-04  9.81  
23  1.3e+01  3.2e-06  9.8e+00  9.91e-01   2.722156952e+05   2.722143950e+05   1.9e-04  10.19 
24  8.2e+00  2.0e-06  6.1e+00  9.95e-01   2.722155957e+05   2.722147874e+05   1.2e-04  10.53 
25  4.1e+00  9.9e-07  3.1e+00  9.94e-01   2.722155159e+05   2.722151048e+05   6.1e-05  10.89 
26  2.0e+00  4.8e-07  1.5e+00  9.99e-01   2.722154739e+05   2.722152739e+05   3.0e-05  11.25 
27  8.2e-01  2.0e-07  6.1e-01  1.00e+00   2.722154503e+05   2.722153695e+05   1.2e-05  11.59 
28  4.5e-01  1.1e-07  3.4e-01  1.00e+00   2.722154432e+05   2.722153988e+05   6.6e-06  11.98 
29  3.0e-01  7.2e-08  2.2e-01  1.00e+00   2.722154403e+05   2.722154109e+05   4.3e-06  12.36 
30  1.5e-01  3.7e-08  1.1e-01  1.00e+00   2.722154375e+05   2.722154228e+05   2.2e-06  12.69 
31  1.8e-02  4.8e-09  1.3e-02  1.00e+00   2.722154350e+05   2.722154333e+05   2.6e-07  13.09 
32  9.3e-03  2.6e-09  6.6e-03  1.00e+00   2.722154348e+05   2.722154340e+05   1.4e-07  13.44 
33  3.1e-03  1.1e-09  2.1e-03  1.00e+00   2.722154347e+05   2.722154344e+05   4.5e-08  13.88 
34  1.0e-03  9.2e-10  7.0e-04  1.00e+00   2.722154347e+05   2.722154346e+05   1.5e-08  14.25 
35  3.2e-04  6.6e-10  2.1e-04  1.00e+00   2.722154347e+05   2.722154347e+05   4.8e-09  14.62 
36  1.6e-04  7.9e-10  1.0e-04  1.00e+00   2.722154347e+05   2.722154347e+05   2.4e-09  14.97 
37  8.2e-05  9.8e-10  4.8e-05  1.00e+00   2.722154347e+05   2.722154347e+05   1.2e-09  15.31 
38  4.4e-05  7.3e-10  2.3e-05  1.00e+00   2.722154347e+05   2.722154347e+05   6.6e-10  15.67 
39  2.3e-05  5.1e-10  9.7e-06  1.00e+00   2.722154347e+05   2.722154347e+05   3.5e-10  16.02 
40  1.2e-05  7.6e-10  5.2e-06  1.00e+00   2.722154347e+05   2.722154347e+05   1.9e-10  16.38 
41  7.4e-06  5.0e-10  2.9e-06  1.00e+00   2.722154347e+05   2.722154347e+05   1.0e-10  16.70 
42  5.2e-06  3.5e-10  1.1e-06  1.00e+00   2.722154347e+05   2.722154347e+05   5.4e-11  17.03 
43  2.2e-06  3.3e-10  7.0e-07  1.00e+00   2.722154347e+05   2.722154347e+05   2.9e-11  17.38 
Basis identification started.
Primal basis identification phase started.
Primal basis identification phase terminated. Time: 0.30
Dual basis identification phase started.
Dual basis identification phase terminated. Time: 8.73
Basis identification terminated. Time: 9.23
Optimizer terminated. Time: 26.70   

SP feasible reported
       40   1.8994e+05   4.6216e+05   5.8901e-01
[ Info: From SP, adding the optimality cut 1.079154230239156 CumCapacity[BESS] - 965.9411194913768 CumCapacity[Coal] + 24.10911331012792 CumCapacity[Wind] - 859.585110771685 CumCapacity[Gas] + 41.55641806911097 CumCapacity[Solar] + 149.44251694935093 CumCapacity[Nuclear] + 49.18109181160243 CumCapacity[Hydro] + 2.2631225246166977 CumCapacity[PHES] + Γ >= 48431.22861658601
[ Info: iteration 41:
Master problem solution: [22.1, 199.2, 60.2, 25.2, 186.9, 31.5, 51.5, 13.0])
[ Info: From SP_slide: 1, adding the feasibility cut
[ Info: iteration 42:
Master problem solution: [22.1, 199.2, 60.4, 25.2, 186.60000000000002, 31.5, 51.5, 13.0])
Problem
  Name                   :
  Objective sense        : minimize
  Type                   : LO (linear optimization problem)
  Constraints            : 254039
  Affine conic cons.     : 0
  Disjunctive cons.      : 0
  Cones                  : 0
  Scalar variables       : 122648
  Matrix variables       : 0
  Integer variables      : 0

Optimizer started.
Simplex reoptimization started.
Primal simplex reoptimization started.
ITER      DEGITER(%)  PFEAS       DFEAS       POBJ                  DOBJ                  TIME
0         0.00        NA          0.00e+00    NA                    2.460246153124e+05    0.03    
1         0.00        NA          0.00e+00    NA                    2.460246153124e+05    0.12    
Primal simplex reoptimization terminated. Time: 0.12    
Simplex reoptimization terminated. Time: 0.19
Optimizer terminated. Time: 31.09   

SP feasible reported
       42   4.5995e+05   4.5997e+05   4.4567e-05
[ Info: From SP, adding the optimality cut 1.238276603223978 CumCapacity[BESS] - 949.7493865995763 CumCapacity[Coal] + 26.16854216575602 CumCapacity[Wind] - 852.7688115427384 CumCapacity[Gas] + 42.1860667082473 CumCapacity[Solar] + 164.13348665483272 CumCapacity[Nuclear] + 55.087714429273944 CumCapacity[Hydro] + 2.5682279766589375 CumCapacity[PHES] + Γ >= 52865.238444877934
[ Info: iteration 43:
Master problem solution: [22.1, 199.2, 60.4, 25.2, 186.60000000000002, 31.5, 51.5, 13.0])
Problem
  Name                   :
  Objective sense        : minimize
  Type                   : LO (linear optimization problem)
  Constraints            : 254039
  Affine conic cons.     : 0
  Disjunctive cons.      : 0
  Cones                  : 0
  Scalar variables       : 122648
  Matrix variables       : 0
  Integer variables      : 0

Optimizer started.
Simplex reoptimization started.
Primal simplex reoptimization started.
ITER      DEGITER(%)  PFEAS       DFEAS       POBJ                  DOBJ                  TIME
0         0.00        NA          0.00e+00    NA                    2.460246153124e+05    0.03    
1         0.00        NA          0.00e+00    NA                    2.460246153124e+05    0.12
Primal simplex reoptimization terminated. Time: 0.12
Simplex reoptimization terminated. Time: 0.20
Optimizer terminated. Time: 32.17

SP feasible reported
       43   4.5997e+05   4.5997e+05   5.4832e-08
Terminating with the optimal solution

It looks like Mosek has identified that it already has a stored solution, so it can more efficiently re-optimize using primal simplex.

I don’t know if there is a way to force starting from scratch with interior point. Why do you want this?

You could reach out to Mosek support for more information.

1 Like