2 years ago

#38517

test-img

scbas1000

Problem does not follow DCP rules (problem with cvxpy )

I was wondering if any of you folks could help me with this problem. I would like to solve the next optimization problem numerical by using cvxpy library.

enter image description here

end here my code for solving this problem:

n=5
L = 0.25
u = Variable((n+2 , 2))
X = Variable((n+2 , n+2) , symmetric = True)

cost = sum(u[1])
objective = Minimize(cost)

constraints = []
constraints += [X[0,0] == 0]
constraints += [X[n+1 , n+1] == a**2 + b**2 ]
constraints += [u[0,0] == 0]
constraints += [u[0,1] == 0]
constraints += [u[n+1,0] == a]
constraints += [u[n+1,1] == b]

'''
#Dont work  
S = np.zeros((n+4 , n+4))
S[0:2 , 0:2] = np.eye(2)
S[2: , 0:2] = u
S[0:2, 2:] = u.T
S[2: , 2:] = X
constraints.append(S >> 0 )
'''
constraints += [X - u@(u.T) >> 0]




for i in range(0, n+1):
  constraints += [X[i,i] - 2*X[i, i+1] + X[i+1 , i+1] - L**2 == 0]


prob = Problem(objective , constraints)
opt_value = prob.solve()
solution = u.value

I get this error "Problem does not follow DCP rules";

python

optimization

cvxpy

0 Answers

Your Answer

Accepted video resources