# Controlling stepsize of fmincon

155 views (last 30 days)
Commented: AM on 29 Nov 2018
Hi
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?
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".

Richard Alcock on 6 May 2011
Take a look at the documentation for fmincon: http://www.mathworks.com/help/toolbox/optim/ug/fmincon.html#f854721 and the options available for the optimization functions: http://www.mathworks.com/help/toolbox/optim/ug/f19175.html
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 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.

Hello,
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 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,
phi(x,F)=0
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!

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.