# How to set the tolerance for constraints?

Hi, I’m using cvx with the solver mosek to solve a problem in Matlab. I have equation constraints Ax = 0.
First I tried directly imposing this constraints and it turned out that the constraints were not precisely satisfied. Later I tried “-1e-12<=A*x<=1e-12”. It looked better but the error is still of the order 1e-7, which is not that satisfying. How should I set the tolerance for the constraints?

Please provide full log output or a reproducible example, but in general for nontrivial big problems having violations of order 1e-8 is fairly standard.

https://docs.mosek.com/latest/faq/faq.html#why-does-the-solution-slightly-violate-constraints

https://docs.mosek.com/modeling-cookbook/practical.html#the-quality-of-a-solution

Sorry I can’t share my data here. I just wonder whether the violations can be improved to 1e-16.

You can try to tighten the termination tolerances from 13.3 Conic Optimization - Interior-point optimizer — MOSEK Optimization Toolbox for MATLAB 10.2.3 but not knowing anything about your problem it is just a guess.

You can also have a look at 8.2 Addressing numerical issues — MOSEK Optimization Toolbox for MATLAB 10.2.3

1e-16 is not realistic for real-life problems.

You cannot even solve a linear system

A x = b

where A is a nonsingular matrix to machine precision using that standard 64 bit floating precision.
This is well known from numerical analysis.

You are unlikely to find any software that can do what you want unless your problem is nice, small and trivial.

Thanks. I will try it.

I know it’s impossible to reach the accuracy of 1e-16. But it should be possible to get 1e-13 or 1e-12, which is still much smaller than 1e-8.

I wish you were right though. However, to the best of my knowledge, none of the available interior-point point optimizers make your wish of an absolute error of 1.0e-12 possible in general.

FYI the stopping criteria employed in Mosek is based on 25 years of experience, so is a carefully chosen compromise between several factors such as speed and reliability.

Good luck.