1

I am trying to solve the following optimization problem using cvxpy:

x and delta_x are (1,N) row vectors. A is a (N,N) symmetric matrix and b is a scalar. I am trying to find a y, such that it minimizes the sum of squares of (y - delta_x) with the constraint (x+y).A.(x+y).T - b = 0. Below is my attempt to solve it.

x = np.reshape(np.ravel(x_data.T), (1, -1))
delta_x = np.reshape(np.ravel(delta.T), (1, -1))
y = cp.Variable(delta_x.shape)
objective = cp.Minimize(cp.sum_squares(y - delta_x))
constraints = [cp.matmul(cp.matmul(x + y, A), (x + y).T) == (b*b)]
prob = cp.Problem(objective, constraints)
result = prob.solve()

I keep getting the error 'cvxpy.error.DCPError: Problem does not follow DCP rules'.

I followed the rules stated in the answer here, but I don't understand how to construct the proper cvxpy minimization Problem. Any help would be greatly appreciated. Thanks!

Ben
  • 11
  • 2
  • Your constraint looks problematic. Can you double check that your math is correct? Can `A` be PSD for example? Can it be an inequality? – Jacques Kvam Sep 12 '18 at 08:29
  • @JacquesKvam: Thank you for the reply. I checked the PSD condition for A, and it is satisfied. It has the following form: A = [[1, -1,0,0,0,0], [-1, 1, 0,0,0,0], [0,0,1,-1,0,0], [0,0,-1,1, 0,0], [0,0,0,0,1,-1], [0,0,0,0,-1,1]], and I am using it to compute the Euclidean distance between two points as x.A.x.T, where x has the form [x1,x2,y1,y2,z1,z2] – Ben Sep 12 '18 at 14:00
  • Awesome! Can you change your constraint to be of the form, `zAz' <= b^2`? Then it's a standard QCQP, if not, your constraint isn't convex and you'll need to do some extra work. I don't know how to solve it without researching. Or maybe taking advantage of `A`'s special structure. – Jacques Kvam Sep 12 '18 at 19:35

0 Answers0