maciej-bendkowski / paganini

Multiparametric tuner for combinatorial specifications
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

cvxpy warning: Solution may be inaccurate #6

Closed Kerl13 closed 4 years ago

Kerl13 commented 4 years ago

Since recently I get warnings systematically when running a tuner, even on rather simple grammars. For instance with the example from the readme:

>>> from paganini import *
>>> sp = Specification()
>>> z, T = Variable(), Variable()
>>> sp.add(T, z * Seq(T))
>>> sp.run_singular_tuner(z)
/home/martin/venv/lib/python3.8/site-packages/cvxpy/problems/problem.py:1054: UserWarning: Solution may be inaccurate. Try another solver, adjusting the solver settings, or solve with verbose=True for more information.

Should I be worried about them?

maciej-bendkowski commented 4 years ago

@Kerl13 It seems that the warning is a consequence of upgrading cvxpy to version 1.1.5. All tests pass, the results of your problem seem all in order. I wouldn't worry too much, but if you want to, it might be a nice little "debugging" feature to enable users to pass a --verbose flag down to cvxpy. What do you think?

Kerl13 commented 4 years ago

Ok good, I won't worry then ;)

I've just realized it's already possible to pass the verbose flag like so:

params = Params(sys_type=Type.ALGEBRAIC)
params.verbose
spec.run_singular_tuner(z, params=params)

The Params class already has a .verbose attribute that is set to False by default. Not sure how to interpret the results though:

ECOS 2.0.7 - (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  -1.546e+00  +8e+00  6e-01  2e-01  1e+00  1e+00    ---    ---    0  0  - |  -  - 
 1  -3.836e-01  -7.435e-01  +2e+00  4e-01  8e-02  5e-01  2e-01  0.7833  3e-02   1  1  1 |  1  1
 2  +8.545e-01  +7.957e-01  +4e-01  1e-01  3e-02  3e-01  5e-02  0.7833  5e-02   1  1  1 |  2  1
 3  +1.214e+00  +1.205e+00  +9e-02  4e-02  6e-03  7e-02  1e-02  0.7833  2e-02   1  1  1 |  1  1
 4  +1.353e+00  +1.353e+00  +2e-02  9e-03  2e-03  2e-02  2e-03  0.7833  9e-03   1  1  1 |  1  1
 5  +1.377e+00  +1.377e+00  +4e-03  2e-03  4e-04  5e-03  6e-04  0.7833  1e-02   2  1  1 |  1  1
 6  +1.384e+00  +1.384e+00  +1e-03  6e-04  1e-04  1e-03  1e-04  0.7833  5e-02   2  1  1 |  2  1
 7  +1.386e+00  +1.386e+00  +3e-04  1e-04  3e-05  3e-04  3e-05  0.7833  5e-02   1  1  1 |  2  1
 8  +1.386e+00  +1.386e+00  +6e-05  3e-05  6e-06  7e-05  8e-06  0.7833  1e-02   1  1  1 |  1  1
 9  +1.386e+00  +1.386e+00  +1e-05  7e-06  1e-06  2e-05  2e-06  0.7833  9e-03   1  1  1 |  1  1
10  +1.386e+00  +1.386e+00  +3e-06  2e-06  4e-07  4e-06  4e-07  0.7833  5e-02   2  0  0 |  2  1
11  +1.386e+00  +1.386e+00  +8e-07  5e-07  1e-07  1e-06  1e-07  0.7833  5e-02   1  0  1 |  2  1
12  +1.386e+00  +1.386e+00  +2e-07  1e-07  2e-08  2e-07  2e-08  0.7833  1e-02   1  1  0 |  1  1
13  +1.386e+00  +1.386e+00  +4e-08  3e-08  5e-09  5e-08  5e-09  0.7833  9e-03   1  1  0 |  1  1
14  +1.386e+00  +1.386e+00  +1e-08  1e-08  2e-09  2e-08  2e-09  0.6266  5e-02   1  0  1 |  2  2
15  +1.386e+00  +1.386e+00  +3e-09  2e-09  4e-10  5e-09  4e-10  0.7833  9e-03   0  0  0 |  1  1
16  +1.386e+00  +1.386e+00  +1e-09  9e-10  2e-10  2e-09  2e-10  0.6266  5e-02   0  1  1 |  2  2
17  +1.386e+00  +1.386e+00  +3e-10  2e-10  4e-11  4e-10  4e-11  0.7833  9e-03   0  1  1 |  1  1
18  +1.386e+00  +1.386e+00  +2e-10  1e-10  3e-11  2e-10  2e-11  0.7833  5e-01   1  1  0 |  7  1
19  +1.386e+00  +1.386e+00  +3e-11  3e-11  6e-12  5e-11  5e-12  0.7833  9e-03   1  0  1 |  1  1
20  +1.386e+00  +1.386e+00  +1e-11  1e-11  2e-12  2e-11  2e-12  0.6266  5e-02   1  1  1 |  2  2
21  +1.386e+00  +1.386e+00  +6e-12  4e-12  1e-12  7e-12  7e-13  0.6266  5e-02   1  0  1 |  2  2
22  +1.386e+00  +1.386e+00  +5e-12  4e-12  8e-13  6e-12  6e-13  0.2053  5e-02   0  0  1 |  2  7
23  +1.386e+00  +1.386e+00  +1e-12  8e-13  2e-13  1e-12  1e-13  0.7833  9e-03   1  1  0 |  1  1
24  +1.386e+00  +1.386e+00  +6e-13  5e-13  4e-14  3e-13  7e-14  0.7833  9e-03   0  1  0 |  1  1
25  +1.386e+00  +1.386e+00  +5e-13  5e-13  4e-14  3e-13  6e-14  0.1051  2e-01   0  0  1 |  4 10
26  +1.386e+00  +1.386e+00  +5e-13  5e-13  4e-14  3e-13  6e-14  0.0220  6e-01   0  1  0 |  8 17
27  +1.386e+00  +1.386e+00  +2e-13  2e-13  8e-15  6e-14  2e-14  0.7833  9e-03   0  0  0 |  1  1
28  +1.386e+00  +1.386e+00  +8e-14  2e-13  5e-15  4e-14  1e-14  0.4010  5e-02   0  0  0 |  2  4
29  +1.386e+00  +1.386e+00  +7e-14  3e-13  5e-15  4e-14  8e-15  0.0538  8e-01   1  0  1 | 12 13
30  +1.386e+00  +1.386e+00  +6e-14  2e-13  4e-15  4e-14  7e-15  0.1314  1e-01   0  1  1 |  3  9
31  +1.386e+00  +1.386e+00  +8e-14  2e-13  4e-15  6e-14  1e-14  0.9791  1e+00   1  1  0 | 24  0
32  +1.386e+00  +1.386e+00  +4e-14  4e-14  1e-15  2e-14  5e-15  0.9791  2e-01   0  1  0 |  4  0
33  +1.386e+00  +1.386e+00  +3e-14  4e-14  8e-16  2e-14  4e-15  0.3208  4e-01   0  0  0 |  6  5
34  +1.386e+00  +1.386e+00  +3e-14  3e-14  6e-16  2e-14  3e-15  0.9791  7e-01   0  0  0 |  9  0
35  +1.386e+00  +1.386e+00  +1e-14  2e-14  4e-16  1e-14  1e-15  0.5013  1e-01   0  0  0 |  3  3
36  +1.386e+00  +1.386e+00  +4e-15  2e-14  1e-16  5e-15  5e-16  0.6266  1e-01   0  0  0 |  3  2
37  +1.386e+00  +1.386e+00  +2e-15  2e-14  1e-16  3e-15  3e-16  0.7833  7e-01   0  0  0 |  9  1
38  +1.386e+00  +1.386e+00  +1e-15  1e-14  1e-16  2e-15  2e-16  0.3208  4e-01   1  0  0 |  6  5
39  +1.386e+00  +1.386e+00  +1e-15  1e-14  9e-17  2e-15  2e-16  0.0841  8e-01   1  0  0 | 12 11
40  +1.386e+00  +1.386e+00  +9e-16  8e-15  7e-17  1e-15  1e-16  0.6266  4e-01   0  0  0 |  6  2
41  +1.386e+00  +1.386e+00  +4e-16  3e-15  9e-17  5e-16  6e-17  0.6266  5e-02   0  0  0 |  2  2
42  +1.386e+00  +1.386e+00  +4e-16  3e-15  0e+00  5e-16  6e-17  0.0220  9e-01   0  0  0 | 18 17
43  +1.386e+00  +1.386e+00  +2e-16  2e-15  9e-17  3e-16  3e-17  0.4010  3e-01   0  0  0 |  5  4
44  +1.386e+00  +1.386e+00  +3e-16  2e-15  1e-16  3e-16  4e-17  0.2053  5e-01   0  0  0 |  7  7
45  +1.386e+00  +1.386e+00  +2e-16  1e-15  2e-16  2e-16  3e-17  0.3208  3e-01   0  0  0 |  5  5
46  +1.386e+00  +1.386e+00  +2e-16  1e-15  2e-16  2e-16  3e-17  0.2053  5e-01   0  0  0 |  7  7
47  +1.386e+00  +1.386e+00  +2e-16  9e-16  1e-16  2e-16  2e-17  0.5013  5e-01   0  0  0 |  7  3
Combined backtracking failed 0 90 0 0 sigma 1
Combined line search failed, recovering best iterate (40) and stopping.

Close to OPTIMAL (within feastol=7.6e-15, reltol=6.8e-16, abstol=9.4e-16).
Runtime: 0.001819 seconds.

To me "Close to OPTIMAL" and the given tolerances look good.

maciej-bendkowski commented 4 years ago

Right, I've forgot we already have that ;)

I do not have to worry about this message. In any case, you can decrease the accuracy, increase the number of iterations, or use a fixed-size tuner.

Kerl13 commented 4 years ago

That's ok for me, thanks for the feedback