Zero Steps Performed in lsqcurvefit Calculation for Matrix Optimization Problem

1 view (last 30 days)
I'm trying to perform a nonlinear least-squares optimization using lsqcurvefit. The dimensions of the data involved are the following:
x0 → [nxn]
xdata →[mxn]
ydata →[mx1]
F(x,xdata) →[mx1]
The initial values for x0 are chosen by calling rand(n) and multiplying by a scaling factor so that the mean output of F is within an order of magnitude of the mean of ydata. However, both with or without this scaling factor, I get the message:
"Initial point is a local minimum.
Optimization completed because the size of the gradient at the initial point is less than the value of the optimality tolerance."
I have tried passing in the options object so that I can set the optimality tolerance to 1e-11 or smaller, but I get the same message regardless. How can I fix this so that an actuall optimization calculation is performed? Thanks in advance!
UPDATE: I have tried switching to using fmincon through solve(prob,...) with the objective function set to mimick a nonlinear least squares minimization. It is going over 10,000 function evaluations though and I have not yet achieved a solution.
UPDATE: Here is a snippet of the code showing a stated constraint for orthogonality, the options object and the segment that contains the objective function...
%% Set up constraint, opts, and init
prob = optimproblem;
A = optimvar('A',[n,n]);
B = optimvar('B',[n,n]);
prob.Constraints.orthoA = (A.'*A) == eye(n);
opts = optimoptions('fmincon',...
'UseParallel',1,'MaxFunctionEvaluations',20000,'Display','iter',...
'FiniteDifferenceStepSize',1e-4);
init.A = ones(n);
init.B = diag(ones(n,1))
And then later in the code, I define D and P which are num by n and num by 1 matrices, respectively.
%% Objective Function
tic,
J = optimexpr(1);
for i = 1:num
J = J + 0.5*(D(i,:)*(1e33)*(A.'*B*A)*D(i,:)'-P(i)).^2;
end
toc
tic,
prob.Objective = J;
[x,fval,exitflag,output] = solve(prob,init,'Options',opts);
toc
The scaling factor of 1e33 that I include in the loop that defines J seems to bring the magnitude of the first term within the outermost brackets into the same order of magnitude as the second term, P(i). I've checked this with histograms and the values should be close. Any suggestions?
  4 Comments
Matt J
Matt J on 15 Jun 2021
Edited: Matt J on 15 Jun 2021
This often occurs when F(x,xdata) contains quantizing operations like round() or ceil(). They shouldn't be there. In any case, we need to see code to make any real diagnosis.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 17 Jun 2021
Edited: Matt J on 17 Jun 2021
Seems like the problem has a simple analytical solution,
[A,B]=eig( D\diag(P)/(D.') );
A=A.';
  3 Comments
Matt J
Matt J on 21 Jun 2021
Edited: Matt J on 21 Jun 2021
Complicated how? The analytical solution above satisfies these constraints.

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!