summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sumofsquares/solver/cvxopt.py4
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