Zero Steps Performed in lsqcurvefit Calculation for Matrix Optimization Problem
1 view (last 30 days)
Show older comments
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
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!