# Mosek interior point stopping criterion and basis identification

**URL:** <https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, mosek\
**Created:** [March 12, 2025, 11:05am UTC](https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863 "2025-03-12T11:05:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpetit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rpetit/32/12552_2.png) [@rpetit](https://discourse.julialang.org/u/rpetit)\
**Post date:** [March 12, 2025, 11:05am UTC](https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863/1 "2025-03-12T11:05:37Z")

</div>

Hi!

I have noticed a weird behaviour of Mosek: when solving a linear program with the interior-point optimizer, the primal and dual feasibility tolerances do not seem to be taken into account when basis identification is turned on.

```julia
using JuMP
using Mosek
using MosekTools

model = Model(Mosek.Optimizer)

set_attribute(model, "MSK_IPAR_OPTIMIZER", Mosek.MSK_OPTIMIZER_INTPNT)
# set_attribute(model, "MSK_IPAR_INTPNT_BASIS", Mosek.MSK_BI_NEVER)

set_attribute(model, "MSK_DPAR_INTPNT_TOL_PFEAS", 1e-14)
set_attribute(model, "MSK_DPAR_INTPNT_TOL_DFEAS", 1e-14)

@variable(model, x >= 0.0)
@variable(model, y >= 0.0)
@objective(model, Min, -x)

@constraint(model, x + y <= 1)
@constraint(model, x + 2*y >= 1)

optimize!(model)

```

The code above produces the following output.

```julia
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME  
0 5.0e-01 2.0e-01 5.8e-02 0.00e+00 -1.000000000e+00 -9.000000000e-01 1.9e-01 0.00  
1 2.2e-03 8.9e-04 2.6e-04 1.05e+00 -9.998086636e-01 -9.991418684e-01 8.4e-04 0.00  
2 2.2e-07 8.9e-08 2.6e-08 1.00e+00 -9.999999809e-01 -9.999999141e-01 8.4e-08 0.00  
3 2.2e-11 8.9e-12 2.6e-12 1.00e+00 -1.000000000e+00 -1.000000000e+00 8.4e-12 0.00  
Basis identification started.
Primal basis identification phase started.
Primal basis identification phase terminated. Time: 0.00
Dual basis identification phase started.
Dual basis identification phase terminated. Time: 0.00
Basis identification terminated. Time: 0.00
Optimizer terminated. Time: 0.00    

```

The solver says that the model is solved and feasible but the primal feasibility report shows that the first constraint is only satisfied up to a tolerance of approximately 10^{-11}.

Switching off basis indentification by uncommenting the proper line in the above code results in the following output.

```julia
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME  
0 5.0e-01 2.0e-01 5.8e-02 0.00e+00 -1.000000000e+00 -9.000000000e-01 1.9e-01 0.00  
1 2.2e-03 8.9e-04 2.6e-04 1.05e+00 -9.998086636e-01 -9.991418684e-01 8.4e-04 0.00  
2 2.2e-07 8.9e-08 2.6e-08 1.00e+00 -9.999999809e-01 -9.999999141e-01 8.4e-08 0.00  
3 2.2e-11 8.9e-12 2.6e-12 1.00e+00 -1.000000000e+00 -1.000000000e+00 8.4e-12 0.00  
4 2.7e-15 6.7e-16 5.4e-15 1.00e+00 -1.000000000e+00 -1.000000000e+00 8.4e-16 0.00  
Optimizer terminated. Time: 0.00 

```

The primal feasbility report now says that the second constraint is only satisfied up to a tolerance of 10^{-15}.

Does someone have an idea of what is happening there? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [March 12, 2025, 7:19pm UTC](https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863/2 "2025-03-12T19:19:24Z")

</div>

Hi @rpetit,

Take a read of [Tolerances and numerical issues · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/getting_started/tolerances/)

You cannot reasonably expect Mosek to find a solution to a tolerance of `1e-14`. Is there anything earlier in the log warning about the tolerances being too tight?

You might also be interested in [https://www.blogger.com/blogger.g?blogID=2124323532937076865#overview The MOSEK blog: Should Mosek optimizer parameters be tweaked?](https://themosekblog.blogspot.com/2025/02/should-mosek-optimizer-parameters-be.html)

---

<div class="post-metadata">

**Author:** ![araujoms](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/araujoms/32/217734_2.png) [@araujoms](https://discourse.julialang.org/u/araujoms)\
**Post date:** [March 13, 2025, 8:54am UTC](https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863/3 "2025-03-13T08:54:14Z")

</div>

If you really need such a high precision you cannot use Float64 as your data type. You need to use Double64 (from DoubleFloats), Float128 (from Quadmath), or BigFloat (from the standard library).

You need of course solvers that can handle these higher precision types, currently there exist two: Hypatia and Clarabel.

---

<div class="post-metadata">

**Author:** ![rpetit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rpetit/32/12552_2.png) [@rpetit](https://discourse.julialang.org/u/rpetit)\
**Post date:** [March 13, 2025, 9:21am UTC](https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863/4 "2025-03-13T09:21:49Z")

</div>

Hi,

Thanks a lot for the two links! I naively thought I could get improved precision by tweaking a bit the solver’s parameters. There are no warnings in the log about the tolerances. Looking at Mosek’s documentation these values seem to be allowed.

---

<div class="post-metadata">

**Author:** ![rpetit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rpetit/32/12552_2.png) [@rpetit](https://discourse.julialang.org/u/rpetit)\
**Post date:** [March 13, 2025, 9:22am UTC](https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863/5 "2025-03-13T09:22:18Z")

</div>

Thanks a lot, I’ll definitely have a look at Hypatia and Clarabel!
