# Controlling stepsize of fmincon

155 views (last 30 days)

Show older comments

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?

##### 1 Comment

Matt J
on 27 Nov 2018

Edited: Matt J
on 27 Nov 2018

### Answers (3)

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

##### 2 Comments

Sean de Wolski
on 9 Jan 2013

Radomir
on 9 May 2017

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.

Radomir

##### 8 Comments

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

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.

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!