Hello all,
I have been working on an optimization problem with a matrix variable in Mathematica, but I haven't managed to get a numerical solution, as I am receiving some error messages. Below is a simple example representing my code:
Xrs1 = RandomReal[{0, 1}, {10, 3}];
Xrs2 = RandomReal[{0, 1}, {40, 3}];
Xdr2 = RandomReal[{-5, 5}, {40, 2}];
d = DistanceMatrix[Xrs1, Xrs2];
dr[Xdr1_] := DistanceMatrix[Xdr1, Xdr2];
f[Xdr1_] := Total[(dr[Xdr1] - d)^2, 2];
FindMinimum[f[Xdr1], {Xdr1, ConstantArray[0., {10, 2}]}]
I receive several errors, despite the fact that the function f
works perfectly with the initial solution or any other numerical matrix with that dimensions.
I would appreciate any help.
Thank you in advance for your time and support.