Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/sage/numerical/backends/cvxpy_backend.pyx: Use our column names w…
Browse files Browse the repository at this point in the history
…hen no name is given
  • Loading branch information
Matthias Koeppe committed Jul 30, 2022
1 parent 9f9207a commit 7b1ee3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sage/numerical/backends/cvxpy_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ cdef class CVXPYBackend:
obj = float(obj)
self.objective_coefficients.append(obj)

if name is None:
name = f'x_{self.ncols()}'

if binary:
variable = cvxpy.Variable(name=name, boolean=True)
elif integer:
Expand Down Expand Up @@ -844,7 +847,7 @@ cdef class CVXPYBackend:
sage: p.add_variable()
0
sage: p.col_name(0)
'var...'
'x_0'
"""
return self.variables[index].name()

Expand Down

0 comments on commit 7b1ee3f

Please sign in to comment.