Clear Filters
Clear Filters

Controlling stepsize of fmincon

155 views (last 30 days)
Mads on 3 May 2011
Commented: AM on 29 Nov 2018
Im am trying to shape optimize a heating surface using MATLAB fmincon and a CFD software. My problem is that the computational costs of a function evaluation (ie a CFD analysis) is very high and thus I want to make a rater rough search of my solution space.
When I iniate fmincon it seems that some ver small steps (in the order of 10^-5 of a mm) are done in order to determine a search direction. This is a waste of function evalutaion since this does not changes the results at all.
My question: Is their any way to avoid these useless function evalution and start out by making large steps?
  1 Comment
Matt J
Matt J on 27 Nov 2018
Edited: Matt J on 27 Nov 2018
If you know that the small steps are done in order to determine a search direction, then why would you consider them useless or wasteful? Isn't determining a search direction important? How can the algorithm make any progress without knowing in which direction to step? Rather than saying that they are "useless", I think what you really mean to say is that they are "costly".

Sign in to comment.

Answers (3)

Richard Alcock
Richard Alcock on 6 May 2011
Take a look at the documentation for fmincon: and the options available for the optimization functions:
Reading those, I think you want to set the DiffMinChange option to something larger than it's default.
DiffMinChange Minimum change in variables for finite-difference gradients (a positive scalar). The default is 0
Pablo on 9 Jan 2013
DiffMinChange not define de mínimum step size
Sean de Wolski
Sean de Wolski on 9 Jan 2013
@Pablo, all though it does not define a minimum step size it does encourage fmincon() to look further away where the gradient might be steeper. This will cause it to take bigger steps.

Sign in to comment.

Radomir on 9 May 2017
I understand that this topic is no longer up to date, but I believe that it could still help to somebody.
Solving similar problem (also CFD software ivolved) I used FiniteDifferenceStepSize as an optimset parametr to avoid small parameters increase.
Matt J
Matt J on 27 Nov 2018
What I meant is that I do not have an analytical expression of F
That does make things more difficult. But what I really was trying to understand is if you know the algorithm used to compute F. Could you write your own version of it if you had to? If for example, F is not computed by an explicit formula, but instead your external software somehow obtains F as the solution of an implicit equation,
then the gradient of F could still be obtained using the implict function theorem.
AM on 29 Nov 2018
I will look into this, thank you for your help Matt!

Sign in to comment.

Matt J
Matt J on 27 Nov 2018
Edited: Matt J on 27 Nov 2018
My question: Is their any way to avoid these useless function evalution and start out by making large steps?
The additional function evaluations are caused by finite difference calculations that fmincon (and other Optimization Toolbox solvers) use to compute derivatives of the objective and constraints, which in turn are used to compute search directions. You can avoid finite differencing, and often save computation, by providing analytic gradient calculations and/or analytic Hessian calculations for algorithms that use them.
However, if you must rely on the default finite difference calculations, then it is usually a bad idea to increase the differencing stepsize in the hope of taking larger steps. The finite differencing controls the direction of search in each iteration, not the distance moved. Typically, reducing the step size will just degrade the finite difference approximation, causing fmincon to choose an inferior search direction. A non-accurate gradient calculation would also prevent fmincon from recognizing when a point of zero-gradient has been reached, and that it is time to stop iterating.


Find more on Computational Fluid Dynamics (CFD) 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!