diff options
author | Nao Pross <np@0hm.ch> | 2024-05-16 11:16:17 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-05-18 14:55:12 +0200 |
commit | 05a737b1b743095a14bfa079c5d98b141b6e4b7a (patch) | |
tree | b13f9b88da444e43cd51b64c0bb4f6382c22c55f | |
parent | Fix imports after change in polymatrix dependency (diff) | |
download | sumofsquares-05a737b1b743095a14bfa079c5d98b141b6e4b7a.tar.gz sumofsquares-05a737b1b743095a14bfa079c5d98b141b6e4b7a.zip |
Fix bug in CVXOPT interface
Diffstat (limited to '')
-rw-r--r-- | sumofsquares/solver/cvxopt.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sumofsquares/solver/cvxopt.py b/sumofsquares/solver/cvxopt.py index 3b227c7..24ec413 100644 --- a/sumofsquares/solver/cvxopt.py +++ b/sumofsquares/solver/cvxopt.py @@ -70,7 +70,7 @@ def solve_sos_cone(prob: Problem, verbose: bool = False, # cost linear term cost_coeffs = dict(cost.affine_coefficients_by_degrees(variable_indices)) q = cost_coeffs.get(1) - if q is None: + if q is None and is_qp: q = np.zeros((len(variable_indices), 1)) # cost quadratic term @@ -163,7 +163,7 @@ def solve_sos_cone(prob: Problem, verbose: bool = False, "into the canonical form of CVXOPT.") # Convert to CVXOPT matrices - q = cvxopt.matrix(q.T) + q = cvxopt.matrix(q.T) if q is not None else None G = cvxopt.matrix(np.hstack(G_rows).T) if G_rows else None h = cvxopt.matrix(np.hstack(h_rows)) if h_rows else None A = cvxopt.matrix(np.hstack(A_rows).T) if A_rows else None |