Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Optimization

Subject: Optimization

From: Carlos Alejandro Perez Lasso

Date: 21 Nov, 2012 19:39:08

Message: 1 of 7

Hi Matlab users,

My purpose is to use the Optimtool to estimate material model parameters so that running the model with such parameters in Abaqus results in a predicted curve close to some experimental data.
I am trying to solve the problem with the lsqnonlin solver with a Cost function that receives initial 3 parameters, reads experimental data, writes a file for parameter study in Abaqus, runs the simulation using the 3 parameters in the material model, reads the corresponding numerical result, compares it with the experimental data and returns a Cost Vector for the solver to do its job.
The problem: When running, the solver does 4 function calls in the 0 iteration and doesn't move from the initial 3 parameters. Thus no gradient is calculated and he thinks that the initial point is already a minimum. Here is what he says:

                                                                             Norm of First-order
 Iteration Func-count f(x) step optimality CG-iterations
     0 4 246.506 0


Initial point is a local minimum.

Optimization completed because the size of the gradient at the initial point
is less than the default value of the function tolerance.

"Optimization running.
Objective function value: 246.50561987942325
Initial point is a local minimum.

Optimization completed because the size of the gradient at the initial point
is less than the default value of the function tolerance."

I would appreciate any help on this regard.

Thank you Matlab users.

Subject: Optimization

From: Matt J

Date: 21 Nov, 2012 22:18:10

Message: 2 of 7

"Carlos Alejandro Perez Lasso" <carlosalejandro85@gmail.com> wrote in message <k8jaks$fqr$1@newscl01ah.mathworks.com>...
> Hi Matlab users,
>
> My purpose is to use the Optimtool to estimate material model parameters so that running the model with such parameters in Abaqus results in a predicted curve close to some experimental data.
> I am trying to solve the problem with the lsqnonlin solver
============

If it's a curve fitting problem, mightn't it be better to use lsqcurvefit.


> Optimization completed because the size of the gradient at the initial point
> is less than the default value of the function tolerance.
==========

This usually occurs because you have quantizing operations like ROUND, FLOOR, CEIL, etc... in your objective function. They make the function locally flat in places, making the initial point trivially a point of zero gradient.

Subject: Optimization

From: Carlos Alejandro Perez Lasso

Date: 22 Nov, 2012 16:12:07

Message: 3 of 7

"Matt J" wrote in message <k8jjv2$ioc$1@newscl01ah.mathworks.com>...
> "Carlos Alejandro Perez Lasso" <carlosalejandro85@gmail.com> wrote in message <k8jaks$fqr$1@newscl01ah.mathworks.com>...
> > Hi Matlab users,
> >
> > My purpose is to use the Optimtool to estimate material model parameters so that running the model with such parameters in Abaqus results in a predicted curve close to some experimental data.
> > I am trying to solve the problem with the lsqnonlin solver
> ============
>
> If it's a curve fitting problem, mightn't it be better to use lsqcurvefit.
>
>
> > Optimization completed because the size of the gradient at the initial point
> > is less than the default value of the function tolerance.
> ==========
>
> This usually occurs because you have quantizing operations like ROUND, FLOOR, CEIL, etc... in your objective function. They make the function locally flat in places, making the initial point trivially a point of zero gradient.

Thank you Matt for your answer.
I will try lsqcurvefit and see what happens.
Regarding the objective function, it doesn't have quantizing operations like the once you described above. It does contain operations that write python scripts to produce input files for running Abaqus simulation and retrieve information once the simulation is done.
Thanks for your help Matt.

Subject: Optimization

From: Matt J

Date: 22 Nov, 2012 19:16:07

Message: 4 of 7

"Carlos Alejandro Perez Lasso" <carlosalejandro85@gmail.com> wrote in message <k8lisn$aqf$1@newscl01ah.mathworks.com>...
>
> I will try lsqcurvefit and see what happens.
> Regarding the objective function, it doesn't have quantizing operations like the once you described above. It does contain operations that write python scripts to produce input files for running Abaqus simulation and retrieve information once the simulation is done.
=================

It seems like it would be hard to know in advance whether such a function was even differentiable. As for local flatness, an easy test you can do is

  small=1e-6;

for i=1:N
  f(x)-f(x+small*rand(size(x)))
end

If this returns N zeros, it's a strong sign know your objective function f() is locally flat.

Subject: Optimization

From: Alan_Weiss

Date: 26 Nov, 2012 17:37:56

Message: 5 of 7

On 11/22/2012 2:16 PM, Matt J wrote:
> "Carlos Alejandro Perez Lasso" <carlosalejandro85@gmail.com> wrote in
> message <k8lisn$aqf$1@newscl01ah.mathworks.com>...
>>
>> I will try lsqcurvefit and see what happens. Regarding the objective
>> function, it doesn't have quantizing operations like the once you
>> described above. It does contain operations that write python scripts
>> to produce input files for running Abaqus simulation and retrieve
>> information once the simulation is done.
> =================
>
> It seems like it would be hard to know in advance whether such a
> function was even differentiable. As for local flatness, an easy test
> you can do is
>
> small=1e-6;
>
> for i=1:N
> f(x)-f(x+small*rand(size(x))) end
>
> If this returns N zeros, it's a strong sign know your objective
> function f() is locally flat.

You might want to consult the documentation on optimizing simulations
for suggestions:
http://www.mathworks.com/help/optim/ug/optimizing-a-simulation-or-ordinary-differential-equation.html

Alan Weiss
MATLAB mathematical toolbox documentation

Subject: Optimization

From: Carlos Alejandro Perez Lasso

Date: 27 Feb, 2013 15:24:05

Message: 6 of 7

Alan_Weiss <aweiss@mathworks.com> wrote in message <k909dk$77l$1@newscl01ah.mathworks.com>...
> On 11/22/2012 2:16 PM, Matt J wrote:
> > "Carlos Alejandro Perez Lasso" <carlosalejandro85@gmail.com> wrote in
> > message <k8lisn$aqf$1@newscl01ah.mathworks.com>...
> >>
> >> I will try lsqcurvefit and see what happens. Regarding the objective
> >> function, it doesn't have quantizing operations like the once you
> >> described above. It does contain operations that write python scripts
> >> to produce input files for running Abaqus simulation and retrieve
> >> information once the simulation is done.
> > =================
> >
> > It seems like it would be hard to know in advance whether such a
> > function was even differentiable. As for local flatness, an easy test
> > you can do is
> >
> > small=1e-6;
> >
> > for i=1:N
> > f(x)-f(x+small*rand(size(x))) end
> >
> > If this returns N zeros, it's a strong sign know your objective
> > function f() is locally flat.
>
> You might want to consult the documentation on optimizing simulations
> for suggestions:
> http://www.mathworks.com/help/optim/ug/optimizing-a-simulation-or-ordinary-differential-equation.html
>
> Alan Weiss
> MATLAB mathematical toolbox documentation

Hi Alan and Matt,

I'm nearly done with my master thesis and I wanted to thank you both because the information you provided was really helpful. I found the answer in the section 'Set Larger Finite Differences'.

Thanks a lot.

Carlos Alejandro Perez

Subject: Optimization

From: Alan_Weiss

Date: 27 Feb, 2013 15:42:20

Message: 7 of 7

On 2/27/2013 10:24 AM, Carlos Alejandro Perez Lasso wrote:
> Alan_Weiss <aweiss@mathworks.com> wrote in message
> <k909dk$77l$1@newscl01ah.mathworks.com>...
>> On 11/22/2012 2:16 PM, Matt J wrote:
>> > "Carlos Alejandro Perez Lasso" <carlosalejandro85@gmail.com> wrote
>> in > message <k8lisn$aqf$1@newscl01ah.mathworks.com>...
>> >>
>> >> I will try lsqcurvefit and see what happens. Regarding the
>> objective >> function, it doesn't have quantizing operations like the
>> once you >> described above. It does contain operations that write
>> python scripts >> to produce input files for running Abaqus
>> simulation and retrieve >> information once the simulation is done.
>> > =================
>> >
>> > It seems like it would be hard to know in advance whether such a >
>> function was even differentiable. As for local flatness, an easy test
>> > you can do is
>> >
>> > small=1e-6;
>> >
>> > for i=1:N
>> > f(x)-f(x+small*rand(size(x))) end
>> >
>> > If this returns N zeros, it's a strong sign know your objective >
>> function f() is locally flat.
>>
>> You might want to consult the documentation on optimizing simulations
>> for suggestions:
>> http://www.mathworks.com/help/optim/ug/optimizing-a-simulation-or-ordinary-differential-equation.html
>>
>>
>> Alan Weiss
>> MATLAB mathematical toolbox documentation
>
> Hi Alan and Matt,
>
> I'm nearly done with my master thesis and I wanted to thank you both
> because the information you provided was really helpful. I found the
> answer in the section 'Set Larger Finite Differences'.
> Thanks a lot.
>
> Carlos Alejandro Perez

Thanks for letting us know. I'm always happy when my documentation helps
someone.

Alan Weiss
MATLAB mathematical toolbox documentation

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us