Parameter Optimization in an interval
5 views (last 30 days)
Show older comments
I have a scoring function asd that takes 4 parameters. Normally this works:
[m n]=fminsearch(asd,[40,40,0.04,0.75] , ...
optimset('MaxFunEvals',4000000,'MaxIter',4000000));
This gives the actual answer, the best possible point
However if I choose the starting point differently:
[m n]=fminsearch(asd,[10,100,0.04,0.75] ,...
optimset('MaxFunEvals',4000000,'MaxIter',4000000))
The optimizer just gives up and finds a non optimal solution. How do I make sure all the values within a certain interval are considered. It would be far more useful if I could specify a [lower bound, starting position, upper bound] for each parameter.
0 Comments
Accepted Answer
Matt J
on 27 Dec 2015
Edited: Matt J
on 27 Dec 2015
No solver can consider all values in a certain interval. However, you can use NDGRID to generate a 4D lattice of discrete sample points on the bounded region you're interested in. You could then exhaustively test the values of the objective function at all points on this lattice for its global minimum. Then, feed that result as the initial guess to fminsearch to minimize over continuous space. Depending on how finely you sample, you should get a much more reliable initial guess of the continuous-space global minimum that way. Of course, you also have to choose the sampling fineness to make the trade-off in computational expense reasonable...
If asd() is smooth, you should also consider using an Optimization Toolbox solver, if you have access to it. The performance of fminsearch deteriorates as the number of unknown variables increases. Four unknowns isn't so bad, but the Optimization Toolbox functions would have more robust performance. The Optimization Toolbox solvers, like fmincon, also let you specify bounds. This is no guarantee that all points in the bounded region will be considered, but it is a guarantee (within numerical tolerances) that points outside will not be considered.
More Answers (0)
See Also
Categories
Find more on Get Started with Optimization Toolbox 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!