# Simple SDP problem has different results with different precisions

I would like to solve a simple lyapunov equation problem, P*A + A’*P < 0. And the matrix A I am using is Hurwitz as following

A = [-9.690300337427388 & 0.430619270930755 & -1.224948874123738;
-1.962604643307266 & -10.247516519829006 & -1.954876539648875;
1.830517287587137 & -0.053241271269972 & -6.483027388191852];

When I solve this lyapunov equation problem with different precisions, the problem results are different.

When the precision is set to be ‘high’ or ‘best’, the result is infeasible (which is not true since matrix A is Hurwitz). And when the precision is set to be ‘default’, the problem is solved.

The code is as following

``````cvx_begin sdp
cvx_precision high or best or default
variable P(3,3) symmetric
P*A + A'*P <= -eye(3)
P >= eye(3)
cvx_end
``````

I am using Mosek solver (ver 7.1.0.12). I do not understand why the low precision gives me solved result, but high precision shows the problem infeasible, and in fact the problem should be solvable since A is Hurwitz.

Any thought on this would be helpful. Thanks a lot!

And the output is as following when the precision is set to be best

## Calling Mosek 7.1.0.12: 12 variables, 6 equality constraints

MOSEK Version 7.1.0.12 (Build date: 2014-12-12 07:25:47)
Platform: Linux/64-X86

Computer
Platform : Linux/64-X86
Cores : 4

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 6
Cones : 0
Scalar variables : 0
Matrix variables : 2
Integer variables : 0

Optimizer started.
Conic interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries : 0 time : 0.00
Eliminator - elim’s : 0
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.01
Optimizer - solved problem : the primal
Optimizer - Constraints : 6
Optimizer - Cones : 0
Optimizer - Scalar variables : 0 conic : 0
Optimizer - Semi-definite variables: 2 scalarized : 12
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 21 after factor : 21
Factor - dense dim. : 0 flops : 8.40e+02
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 3.9e+01 1.0e+00 1.0e+00 0.00e+00 0.000000000e+00 0.000000000e+00 1.0e+00 0.03
1 4.3e+00 1.1e-01 1.1e-01 -1.90e+00 0.000000000e+00 3.092603089e+01 1.1e-01 0.07
2 8.9e-01 2.3e-02 2.3e-02 -5.15e-01 0.000000000e+00 3.567647460e+01 2.3e-02 0.08
3 8.3e-02 2.1e-03 2.1e-03 8.17e-01 0.000000000e+00 2.129837998e+00 2.1e-03 0.08
4 4.2e-03 1.1e-04 1.1e-04 9.66e-01 0.000000000e+00 1.084320890e-01 1.1e-04 0.08
5 2.1e-04 5.3e-06 5.3e-06 9.98e-01 0.000000000e+00 5.426029347e-03 5.3e-06 0.09
6 1.0e-05 2.7e-07 2.7e-07 1.00e+00 0.000000000e+00 2.713124814e-04 2.7e-07 0.09
7 2.3e-11 6.0e-13 6.0e-13 1.00e+00 0.000000000e+00 2.713124814e-04 6.0e-13 0.09
Interior-point optimizer terminated. Time: 0.09.

MOSEK PRIMAL INFEASIBILITY REPORT.

Problem status: The problem is primal infeasible

Optimizer terminated. Time: 0.18

Interior-point solution summary
Problem status : PRIMAL_INFEASIBLE
Solution status : PRIMAL_INFEASIBLE_CER
Dual. obj: 2.8813551680e-11 Viol. con: 0e+00 barvar: 0e+00
Optimizer summary
Optimizer - time: 0.18
Interior-point - iterations : 7 time: 0.09
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
Clean primal-dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Primal-dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

Status: Infeasible
Optimal value (cvx_optval): +Inf

I solved it using SDPT3 and SeDuMI, and obtained solutions which were well inside the feasible region (not close to being infeasible). So the problem certainly is feasible (unless I made a mistake checking the solutions).

MOSEK 8 is now available, and is improved vs. MOSEK 7. As to what went wrong with your run which showed infeasible, I can recommend you show the output, then perhaps someone can make a better assessment.

Hi Mark, thanks for your answer. I tried SDPT3 too, and it works fine.

And http://cvxr.com/cvx/doc/mosek.html this is the link I found, but it seems that there is only MOSEK7 available for CVX solver. I was wondering if I am looking at the correct link? Thanks.

Here is the MOSEK website https://mosek.com/ .As far as I know, if you install MOSEK 8 under MATLAB and have CVX Professional, you should be able to invoke MOSEK 8 from CVX, the same as you would MOSEK 7; However, I am not the authority on that and can not verify it myself.

Mark, thanks again for your help!

It is wrong MOSEK 7 says infeasible i.e. a semi-bug. I suggest upgrading to MOSEK v8. I am fairly sure it will solve the problem. If that is not possible I can point to MOSEK parameter you can change.

Hi Mark, I have installed MOSEK 8 in Matlab, but I met a problem when I try to re-setup cvx to add MOSEK 8 solver. The warning is as following

``````Mosek    8.0.0.60    /home/amsl/mosek/8/toolbox/r2014a
Unexpected MEX file failure:
One or more output arguments not assigned during call to
"mosekopt".
``````

And the version info is

``````Path: /home/amsl/Documents/cvx
MATLAB version: 9.1 (R2016b Prerelease)
OS: Linux amd64 version 3.19.0-56-generic
Java version: 1.7.0_60
``````

I was wondering if this is due to some installing path issues of MOSEK 8 or version compatibility issues? Thank you!

I have installed MOSEK 8. But I met a problem to add MOSEK 8 solver in CVX. And the warning info is as follwoing

Mosek 8.0.0.60 /home/amsl/mosek/8/toolbox/r2014a
Unexpected MEX file failure:
One or more output arguments not assigned during call to
"mosekopt".

The version info is

Path: /home/amsl/Documents/cvx
MATLAB version: 9.1 (R2016b Prerelease)
OS: Linux amd64 version 3.19.0-56-generic
Java version: 1.7.0_60

I was wondering if you have any clue how to fix it? Thank you!

Did you get MOSEK to rum under MATLAB without using CVX?

I will defer to Erling and @mcg to resolve this.

Yes, I run mosekdiag under MATLAB, and everything is normal as the website suggests. Thanks.

I’m afraid I haven’t tested CVX with MOSEK 8 yet…

Could you email the output of

mosekdiag

to support@mosek.com. Then we will take it from there.

Btw several CVX users have used CVX with v8. Note the SDP optimizer has been improved dramatically in v8.

1 Like

I have sent the information to mosek support. Thanks for your reply. I think Mosek 8 is correctly installed, just for some unknown reason CVX could not add Mosek solver.

I suggest you post the output of cvx_version .

The cvx_version is as following

cvx_version

## CVX: Software for Disciplined Convex Programming ©2014 CVX Research Version 3.0beta, Build 1175 (1326ef2) Mon Nov 23 14:29:34 2015

Installation info:
Path: /home/amsl/Documents/cvx
MATLAB version: 9.1 (R2016b Prerelease)
OS: Linux amd64 version 3.19.0-56-generic
Java version: 1.7.0_60
Verfying CVX directory contents:
WARNING: The following files/directories are missing:
/home/amsl/Documents/cvx/mosek/a64/ + 5 files, 0 subdirectories
These omissions may prevent CVX from operating properly.
WARNING: The following extra files/directories were found:
/home/amsl/Documents/cvx/cvx_license/ + 1 files, 0 subdirectories
/home/amsl/Documents/cvx/mosek/8/ + 451 files, 49 subdirectories
/home/amsl/Documents/cvx/mosek/mosek.lic
These files may alter the behavior of CVX in unsupported ways.

Thanks!

I suggest you try CVX 2.1. CVX 3.0 is still in beta and may have bugs. No guarantees, but it’s worth a try.

If you have MOSEK 8.0 installed correctly for Matlab, then CVX 2.1 seems to pick it up correctly when you rerun cvxsetup.m. The setup script will identify 2 MOSEK solvers (version 7.1 and 8.0), and you need to change the default solver to MOSEK 8.

Hi Mark, I tried CVX 2.1. and it works well with mosek 8. Thanks for your advice.