Skip to content

Commit

Permalink
Fix OModel.Param.evaluate when its value is a number
Browse files Browse the repository at this point in the history
  • Loading branch information
jinningwang committed Nov 15, 2024
1 parent fd21db2 commit f1c5af5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ams/opt/omodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,10 @@ def evaluate(self):
self.v = sps.csr_matrix(self.v)

# Create the cvxpy.Parameter object
self.optz = cp.Parameter(shape=self.v.shape, **config)
if isinstance(self.v, np.ndarray):
self.optz = cp.Parameter(shape=self.v.shape, **config)
else:
self.optz = cp.Parameter(**config)
self.optz.value = self.v
except ValueError:
msg = f"Parameter <{self.name}> has non-numeric value, "
Expand Down

0 comments on commit f1c5af5

Please sign in to comment.