Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gcsopt/programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ def to_conic(self):
conic_program = ConicProgram(cp_conic.x.size, id_to_range, self.binary_variable)

# Define cost of conic program.
cd = cp_conic.c.toarray().flatten()
cd = cp_conic.q.toarray().flatten()
conic_program.add_cost(cd[:-1], cd[-1])

# Define constraints of conic program. Sparse matrices are converted to
# dense arrays, since keeping them sparse seems to make things slower.
cols = cp_conic.c.shape[0]
cols = cp_conic.q.shape[0]
Ab = cp_conic.A.toarray().reshape((-1, cols), order='F')
K = [(type(c), c.size) for c in cp_conic.constraints]
conic_program.add_constraints(Ab[:, :-1], Ab[:, -1], K)
Expand All @@ -234,4 +234,4 @@ def solve(self, **kwargs):
"""
prob = cp.Problem(cp.Minimize(self.cost), self.constraints)
prob.solve(**kwargs)
return prob.value
return prob.value
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy
cvxpy >=1.5, <=1.7.1
cvxpy >=1.7.4
pytest
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
packages=find_packages(),
install_requires=[
"numpy",
"cvxpy >=1.5, <=1.7.1",
"cvxpy >=1.7.4",
"pytest",
],
)