Is it possible to use the sklearn pairwise_distances function inside an addConstr(...) for computing the distance between 2 D-dimensional points in the constraint? I'd like to do something like this:
for i in range(N):
for j in range(N):
constr1 = m.addConstr( pairwise_distances(X[i,:], Y[j,:]) <= 50 for i in range(N), name="constr1")
# X and Y are N by D numpy arrays
I know that Gurobi only allows optimization functions that are linear, piecewise linear or Quadratic (as far as I know), so most other functions like sqrt aren't implementable (even for constraints). So trying to manually implement distance calculations involving square roots or absolute values may not be possible in gurobi constraints - though if I'm wrong, I'd like to be corrected.
Also how would I do this if Y wasn't a pre-set numpy array but actually a gurobi variable I'm trying to find?