27 views (last 30 days)

Show older comments

I am using the lsqnonlin function to calibrate parameters of a ground heat conduction model. I am starting with one-parameter optimization. So far, I am using synthetic data to check the functioning of my model setup. I have a temperature field generated with certain ground thermal parameters combination ("true" parameter values). Then I change the value of one of the parameters ("modified" param. values) and I am trying to retrieve its "true" value by minimizing the residual between the temperature field calculated with true and modified parameter set. I do not add any noise so far to the temperature field simulated with modified target parameter.

The objective function for my parameter (here, the heat capacity of rock component of the ground) looks as on the picture below - it is not smooth. I know that the lsqnonlin searches for local minimum only, however, I believe that the algorithm should be able to overcome this kind of "spikes" in the cost function. In fact, no matter how close to the true parameter value I start the optimization, the lsqnonlin does not move at all from this starting point and the optimization does not progress at all. The objective function just looks this spiky all over the possible parameter values.

I am able to produce a very smooth cost function for the parameter when I adjust the settings of the pdepe solver (the AbsTol and RelTol settings), which I use for solving the heat equation. However, this comes for the cost of extremely long computation times which is not acceptable considering that the forward heat model calculation needs to run many times during the optimization. Therefore I am focusing on adjusting the settings of the lsqnonlin function to overcome the local minima and move to a minimum closer to the true value of calibrated parameter (CRock for the original temperature field = 2e6 [J/m3/K], my starting guesses ranging from 1.4e6 to 1.8e6).

During the lsqnonlin run, I am following the progress of the optimization using the Display option. I can see that the objective function value is not decreasing and the lsqnonlin is keeping to choose smaller and smaller steps, getting stuck even closer to the initial guess ("start" value).

I was trying to adjust lsqnonlin options such as the TolX, TolFun as stopping criteria and DiffMinChange setting, but nothing helps to force the lsqnonlin to make bigger steps to ignore these "spikes". I would be extremely grateful for any suggestions and advices since it is quite some time that I am struggling with this problem.

Sonia

PATHAN
on 29 Apr 2015

Alan Weiss
on 23 Oct 2013

There is some documentation on optimizing problems where the objective function is given by a simulation or integration. While it is very basic, perhaps some of the ideas there could help you.

Also, did you sum the squares in the objective function? lsqnonlin wants the objective not to contain the sum of squares.

Good luck,

Alan Weiss

MATLAB mathematical toolbox documentation

David
on 20 Feb 2019

Edited: David
on 20 Feb 2019

Agree with most of the above although (not sure if parameter names have changed) the parameter in the options to modify is called 'FiniteDifferenceStepSize' rather than DiffMinChange . For me setting this to 1e-2 rather than the default of sqrt(eps) (i.e.1e-8) got it to actually do something rather than just not doing anything and saying that the initial point is (a local) optimal.

options=optimoptions('lsqnonlin','display','iter-detailed','FiniteDifferenceStepSize',1e-2);

[x,resnorm,residual,exitflag,output,lambda,jacobian]=lsqnonlin(fun,x0,lb,ub,options);

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

Start Hunting!