Why is lsqnonlin returning initial input values ?

4 views (last 30 days)
Hello,
I'm trying to do some king of optimization stuff. I have a LS problem to solve which is that form:
C=A*x-B;
Z=Y*x-W;
min_x(C'*C + theta.* Z'*Z)
To solve this, I'm using the lsqnonlin Matlab function this way.
f=@(x)((A*x-B)'*(A*x-B)+ theta.*(Y*x-W)'(Y*x-W));
options=optimset('TolX', 1E-12, 'TolFun', 1E-12, 'ScaleProblem', 'Jacobian','MaxFunEvals', 1000, 'Display', 'off', 'Algorithm', 'levenberg-marquardt');
[Teopt] = lsqnonlin(f,Te,[],[], options);
But the problem is that despite I tried to modify the TolX and TolFun parameters, the Levenberg-Marquardt algorithm seem to stop after no or only on iteration, returning Teopt=Te.
When I look at the lsqnonlin display in the command window, I have both of theses messages:
First-Order Norm of
Iteration Func-count Residual optimality Lambda step
0 10 0.143131 1.13 0.01
1 36 0.143131 1.13 1e+014 2.07051e-008
Optimization terminated: the relative change in the sum-of-squares of the functions is less than options.TolFun
First-Order Norm of
Iteration Func-count Residual optimality Lambda step
0 10 0.593098 9.95 0.01
Optimization terminated: no further progress can be made.
Cannot generate point that reduces the sum of squares.
Problem may be ill-conditioned.
I'm not satisfied by the range of the residuals after this (non)optimization. I'm far from being an expert in the field of matlab optimization functions: would someone have a hint in order to make this piece of code work better? I'm pretty sure my LS problem is not ill-conditioned as I just implemented an algorithm from a IEEE paper, but I can probably misuse the lsqnonlin function.
Thank you very much,
Guillaume

Answers (1)

John D'Errico
John D'Errico on 8 Oct 2020
lsqnonlin is not a function to optimize a scalar nonlinear function. Even though you could actually have written your problem in the form of a linear least squares, you have formulated a scalar objective for lsqnonlin to solve.
So first, you MIGHT have used fmincon. But instead, it would have been simpler and far more efficient to use just backslash. That is:
x = [A;theta*Y]\[B,theta*W];
So ONE line of code is required, with no iterative tool needed.

Categories

Find more on Problem-Based Optimization Setup in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!