Hi

I am trying to add a number of nonlinear equality constraints of the form:

$$ ||d_{j} - P_{i}||*2 = r*{i,j}, \forall i, j$$

,where d_{i}, r_{ij} are variables, and P_{i} is matrix, k is the dimension of space. Hence each such constraint says the distance of point p_i from a point d_j in \mathbb{R}^k is a new variable r_{ij}.

This is a part of a larger second order conic formulation.

I figured since equality os non convex, I would try to put these constraints in the objective.

I tried using expression, and adding all these equalities as

$$ sumEqualityConstraints = sumEqualityConstraints+ ||d_{j} - P_{i}||*2 - r*{i,j}, \forall i, j$$

However the *expression* apparently gets converted to a evaluated expression in objective.

I tried adding a different variable instead of expression, but that results in an error because I am voilating DCP ruleset: {real affine} == {convex}.

How do I add these to objective without a for loop.

Is there an object like *cvx_objective* wherein I can create add to this object.