I am trying to find an optimal solution on predefined np arrays and I need to use these arrays in constraints. I tried converting those arrays to cvxpy variables but it it says that cvxpy variables do not support assignment. Here is code for reference. Can somebody provide some tips?
N, d = xTr.shape y = yTr.flatten()
## Solution Start
# dummy code: example of establishing objective and constraints, and let the solver solve it.
si = np.random.randn(N)
w = Variable(d)
b = Variable(1)
objective = norm(w) + C * (sum(si))
constraints = []
for i in range(N):
constraints += [
y[i]*(w * xTr[i] + b)+ si[i] >=1,
si[i] >= 0
]
prob = Problem(Minimize(objective), constraints)
prob.solve()>