embotech/ecos

ECOS fails for sum of squares problem

Opened this issue · 1 comments

This problem returns Infeasible/Inaccurate

import numpy as np
from cvxpy import *
m = 3
n = 2
np.random.seed(1)
A = np.random.randn(m, n)
b = np.random.randn(m)
x = Variable(n)
obj = sum_squares(A*x - b) + sum_squares(x - 1000)
prob = Problem(Minimize(obj))
prob.solve(verbose=True)
print prob.status
c, G, h, dims, A, b = prob.get_problem_data(ECOS)
echu commented

The latest version of ECOS (v2.0.0) doesn't fail, but still has numerical instabilities.

ECOS 2.0.0 - (C) embotech GmbH, Zurich Switzerland, 2012-15. Web: www.embotech.com/ECOS

It     pcost       dcost      gap   pres   dres    k/t    mu     step   sigma     IR    |   BT
 0  +0.000e+00  -5.826e-01  +2e+03  3e-01  1e-01  1e+00  4e+02    ---    ---    1  1  - |  -  - 
 1  +7.921e+03  +9.946e+03  +1e+03  3e+00  8e-01  2e+03  2e+02  0.8926  4e-01   1  1  1 |  0  0
 2  +1.828e+03  +4.777e+03  +1e+02  3e-01  7e-02  3e+03  4e+01  0.9250  2e-01   1  1  1 |  0  0
 3  +7.364e+03  +1.245e+04  +2e+01  2e-01  4e-02  5e+03  7e+00  0.9890  2e-01   1  1  1 |  0  0
 4  +1.303e+04  +2.672e+04  +1e+01  3e-01  5e-02  1e+04  3e+00  0.8936  3e-01   2  1  1 |  0  0
 5  +2.552e+04  +2.636e+04  +5e+00  9e-02  1e-02  8e+02  1e+00  0.9081  3e-01   1  1  1 |  0  0
 6  +3.809e+04  +4.485e+04  +2e+00  2e-01  2e-02  7e+03  4e-01  0.9232  3e-01   2  1  1 |  0  0
 7  +7.010e+04  +8.075e+04  +2e-01  5e-02  6e-03  1e+04  4e-02  0.9376  5e-02   2  1  1 |  0  0
 8  +1.452e+05  +1.840e+05  +5e-02  5e-02  5e-03  4e+04  1e-02  0.9507  2e-01   2  1  1 |  0  0
 9  +1.929e+05  +2.063e+05  +1e-02  2e-02  2e-03  1e+04  3e-03  0.8807  2e-01   2  1  1 |  0  0
10  +3.247e+05  +4.162e+05  +5e-03  3e-02  3e-03  9e+04  1e-03  0.9633  3e-01   2  2  1 |  0  0
11  +4.433e+05  +4.858e+05  +1e-03  1e-02  1e-03  4e+04  3e-04  0.8573  1e-01   1  1  1 |  0  0
12  +4.780e+05  +5.748e+05  +6e-04  1e-02  2e-03  1e+05  1e-04  0.8410  4e-01   2  2  1 |  0  0
13  +7.744e+05  +8.585e+05  +8e-05  3e-03  1e-03  8e+04  2e-05  0.8509  1e-02   2  1  1 |  0  0
14  +9.245e+05  +1.072e+06  +4e-05  3e-03  5e-03  1e+05  1e-05  0.7477  3e-01   3  2  2 |  0  0
15  +1.289e+06  +1.337e+06  +3e-06  4e-04  9e-04  5e+04  8e-07  0.9337  1e-02   2  3  2 |  0  0
16  +1.390e+06  +1.404e+06  +4e-07  8e-05  2e-03  1e+04  1e-07  0.9528  1e-01   3  3  3 |  0  0
17  +1.428e+06  +1.429e+06  +3e-08  7e-06  3e-04  1e+03  9e-09  0.9252  5e-03   2  3  3 |  0  0
18  +1.432e+06  +1.432e+06  +2e-09  1e-06  1e-04  7e+01  6e-10  0.9669  3e-02   3  2  2 |  0  0
19  +1.433e+06  +1.433e+06  +3e-11  8e-07  5e-06  1e+00  8e-12  0.9862  2e-04   3  3  3 |  0  0
20  +1.433e+06  +1.433e+06  +2e-12  5e-07  3e-06  6e-02  5e-13  0.9376  4e-04   2  2  2 |  0  0
21  +1.349e+15  +1.349e+15  -3e+49  4e-09  2e-14  -6e-02  -5e+48  0.0000  1e+00   0  0  0 |  0  0
Unreliable search direction detected, recovering best iterate (20) and stopping.

Close to OPTIMAL (within feastol=3.4e-06, reltol=1.4e-18, abstol=2.1e-12).
Runtime: 0.000461 seconds.

optimal_inaccurate