Skip to content

Commit e3d3d76

Browse files
committed
small edit to test
1 parent 1478159 commit e3d3d76

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cvxpy/tests/nlp_tests/test_matmul.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,32 @@ def test_sparse_matrix(self):
9090
x0 = np.random.rand(n, 1)
9191
b = A @ x0
9292

93+
x.value = 10 * np.ones((n, 1))
9394
obj = cp.Minimize(c.T @ x)
9495

9596
# solve problem with dense A
9697
constraints = [A @ x == b]
9798
problem = cp.Problem(obj, constraints)
98-
problem.solve(solver=cp.IPOPT, nlp=True)
99+
problem.solve(solver=cp.IPOPT, nlp=True, verbose=True)
99100
dense_val = problem.value
100101
dense_sol = x.value
101102

103+
x.value = 10 * np.ones((n, 1))
104+
102105
# solve problem with sparse A CSR
103106
A_sparse = sp.csr_matrix(A)
104107
constraints = [A_sparse @ x == b]
105108
problem = cp.Problem(obj, constraints)
106-
problem.solve(solver=cp.IPOPT, nlp=True)
109+
problem.solve(solver=cp.IPOPT, nlp=True, verbose=True)
107110
sparse_val = problem.value
108111
sparse_sol = x.value
109112

113+
x.value = 10 * np.ones((n, 1))
110114
# solve problem with sparse A CSC
111115
A_sparse = sp.csc_matrix(A)
112116
constraints = [A_sparse @ x == b]
113117
problem = cp.Problem(obj, constraints)
114-
problem.solve(solver=cp.IPOPT, nlp=True)
118+
problem.solve(solver=cp.IPOPT, nlp=True, verbose=True)
115119
csc_val = problem.value
116120
csc_sol = x.value
117121

0 commit comments

Comments
 (0)