0

I have the following code snippet for CVXPY:

delta=1e-3

loglambda = rvec*theta #rvec: TxJ regressor matrix, theta: (Jx1) cvx variable 
a= mul_elemwise(dy[0:T],loglambda) # size(Tx1)
b1=cvx.exp(loglambda) 
b2=mul_elemwise(delta,b1) 
cost= -a + b1             
#cost= -a + b2  #size (Tx1)
prob = Problem(Minimize(sum_entries(cost)))
prob.solve(solver=SCS)

The code runs fine as it is with cost = - a + b1. However, if I try to multiply b1 with a scalar using mul_elemwise and try to run it with cost = - a + b2, I get the error message:

UnboundLocalError: Local variable 'coeff' referenced before assignment.

Rodrigo de Azevedo
  • 1,097
  • 9
  • 17
Msin
  • 63
  • 2
  • 7

1 Answers1

1

The bug is fixed on the latest master. And I dont need to use mul_elemwise to multiply by a scalar, delta*b1 it will automatically do the right thing in cvxpy

Msin
  • 63
  • 2
  • 7