From 05a737b1b743095a14bfa079c5d98b141b6e4b7a Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 16 May 2024 11:16:17 +0200 Subject: Fix bug in CVXOPT interface --- sumofsquares/solver/cvxopt.py | 4 ++-- 1 file 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 -- cgit v1.2.1