How to manipulate expression?
I know here it is totally unnecessary, but I am trying to use this method to a matrix opt problem.
Here is the code
x = cp.Variable(3)
# Create two constraints.
constraints = [x[0]<=1, x[1]<=1, x[2]<=3]
term1 = cp.Expression()
for i in range(3):
term1 += cp.log(x[i])
# Form objective.
obj = cp.Maximize(term1)
It does allow me to generate a term1.
Again, here it is unnecessary, because cp.sum is available. But I am applying this to a higher dimension, or for different i, I have different multipliers or stuff. What should I define term1 as?