diff --git a/README.md b/README.md index 22f22ac..33f2f17 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ python setup.py install ### SDP Solver, BLAS and LAPACK -cvxpnpl makes use of [cvxpy](https://www.cvxpy.org/) as its opaque convex solver. However, cvxpy is only an abstraction layer and invokes [SCS](https://github.com/cvxgrp/scs) to obtain a solution to the underlying SDP problem. SCS requires BLAS and LAPACK which can be painful to set up for Windows users. With that in mind, I **really recommend that you install cvxpy through their anaconda channel**, as it will abstract away all of this dependency setup. +cvxpnpl makes use of [SCS](https://github.com/cvxgrp/scs) to obtain a solution to the underlying SDP problem. SCS requires BLAS and LAPACK which can be painful to set up for Windows users. As of version 2.0.0, SCS is permanently linking with LAPACK and BLAS and it is possible that the process is now easier for Windows users as well. ## Examples diff --git a/cvxpnpl.py b/cvxpnpl.py index afd2271..89739e0 100644 --- a/cvxpnpl.py +++ b/cvxpnpl.py @@ -1,8 +1,9 @@ +import warnings import numpy as np from scipy.sparse import csc_matrix import scs -__version__ = "0.3.0" +__version__ = "1.0.0" def _point_constraints(pts_2d, pts_3d, K): @@ -451,8 +452,11 @@ def _solve_relaxation(A, B, eps=1e-9, max_iters=2500, verbose=False): max_iters=max_iters, ) # Invoke solver - # results = scs.solve({"A": _A, "b": _b, "c": _vech10(Q, 2)}, {"f": 22, "l": 0, "q": [], "ep": 0, "s": [10]}, verbose=True, eps=eps, max_iters=max_iters) Z = _vech10_inv(results["x"]) + if np.any(np.isnan(Z)): + if verbose: + warnings.warn("The SDP solver did not return a valid solution. Increasing max_iters might solve the issue.") + return [(np.full((3,3), np.nan), np.full(3, np.nan))] vals, vecs = np.linalg.eigh(Z) # check for rank diff --git a/requirements.txt b/requirements.txt index fbc3611..a319e8b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ numpy scipy -scs<2.0.0 +scs>=2.0.0