Your problem is solved exactly because you don't have any constraint. I skipped the function to make you a shorter script.
import numpy as np
import cvxpy as cp
pts = np.array([(-2, 3), (-3, 5), (-1, 4), (-3, 7), (0, 3),
(-2, -2), (-3, 8), (3, 1), (1, -2), (2, 6),
(-2, 6), (-2, 5), (-4, 3), (-4, 6), (-3, 10),
(2, -3)])
n = pts.shape[0]
x = cp.Variable((n, 2))
objective = cp.Minimize(cp.sum(cp.norm(pts - x, 2, axis=1)))
prob = cp.Problem(objective)
prob.solve()
print(x.value)
# result
# [[-2. 3.]
# [-3. 5.]
# [-1. 4.]
# [-3. 7.]
# [ 0. 3.]
# [-2. -2.]
# [-3. 8.]
# [ 3. 1.]
# [ 1. -2.]
# [ 2. 6.]
# [-2. 6.]
# [-2. 5.]
# [-4. 3.]
# [-4. 6.]
# [-3. 10.]
# [ 2. -3.]]
P.S. maybe this is not your correct answer. The problem is that from what I see in your equation. I'm not able to differentiate the parameters and your values.

Does it mean that you have two functions to minimize? one approaching the points and the other one approaching all the previous points to the current one?
If that's the case, you can replace the code with:
cost1 = cp.sum(cp.norm(pts - x, 2, axis=1))
cost2 = cp.sum([cp.norm(x[j] - x[i],2) for i in range(1, n) for j in range(0, i)])
objective = cp.Minimize(cost1+cost2)
prob = cp.Problem(objective)
prob.solve()
print(x.value)
#result
# [[-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]
# [-1.7909687 4.4720621]]
But as you can see, the result is not that interesting.
Answer from silgon on Stack Overflowpython - norm of differences of variables in cvxpy - Stack Overflow
Infinity norm for matrices different than convention
python - Why is CVXPY throwing a DCP error with cp.sqrt but no error with cp.norm - Computational Science Stack Exchange
CVXPY: Why Norm constraint is not DCP?
`cp.norm(weights, 1).is_dcp()` returns true. Then why this code works:
import numpy as np import cvxpy as cp inputs = np.random.normal(0, 1, (100, 300)) inputs_mean = inputs.mean(axis=1) # shape (features,) inputs_cov = np.asmatrix(np.cov(inputs)) # shape (features, features) weights = cp.Variable(len(inputs)) risk = cp.quad_form(weights, inputs_cov) constraints = [ # cp.norm(weights, 1) == 1., cp.sum(weights) == 1., ] problem = cp.Problem(cp.Minimize(risk), constraints) problem.solve(verbose=True) weights.value
But if you use the first constraint (`cp.norm`) instead of the second, it does not:
DCPError: Problem does not follow DCP rules. Specifically: The following constraints are not DCP: norm1(var456) == 1.0 , because the following subexpressions are not: |-- norm1(var456) == 1.0
Why is it not DCP-compliant? How can I troubleshoot it? Is there an alternative way to solve the problem of requiring the sum of abs weights to be 1? Thanks.