Thanks for that. I'll look more closely at a wrapper. I did one for "cmaes", maybe I can do one for optimize.
I want my "variables" to change by at list 0.01 because they are "physical" dimensions in millimetres of something I am designing. For my cost-fucntion, a variable that changes by less than 0.01mm will not change the value of the cost-function as I round off to two decimal points in the analysis as my manufacture accuracy is at best 0.01mm, but more line 0.02mm (20 microns) in real life. I'm designing hardware :)
Thanks for taking the time to look at my question. Much appreciated...
21 Feb 2014
Minimize constrained functions with FMINSEARCH or FMINLBFGS, globally or locally
It seems you and Ben have discrete problems, whereas OPTIMIZE() is for continuous problems. In other words, "grid" constraints are not supported.
Indeed you are correct -- "DiffMinChange" is not supported by OPTIMIZE(). But that is because it doesn't do what you think it does. From the documentation of FMINCON():
"Minimum change in variables for finite-difference gradients (a positive scalar). The default is 1e-8."
Thus it is an option to control the minimum step in the numerical computation of *derivative*, something that OPTIMIZE() does not need or use.
As a workaround, you can optimize your function with a wrapper:
myFunc = @(x) yourOriginalFunction( round(X*100)/100 );
Note that this restricts X to a grid with step 0.01 in all dimensions. This may not be what you want, but I trust you get the idea.
As a general interest -- *why* is your X restricted to 0.01 minimum steps?
No problem, thank you so much for taking the time to answer my question. So very much appreciated. I am using fminsearchbnd a lot and have also included rmsearch in my list of tools for optimization. Thank you so much for making these tools available!
The problem is, these tools are really just wrappers around fminsearch, which uses only a restricted set of parameters. From the help for fminsearch, I see only:
these options: Display, TolX, TolFun, MaxFunEvals, MaxIter, FunValCheck,
PlotFcns, and OutputFcn.
So I could never be able to control the problem as you would desire. Sorry. Even that limited set of variables becomes corrupted, since fminsearchbnd uses a transformation, which will prevent you from controlling things using TolX as it is designed.