Optimization with a vectorized objective function
1 view (last 30 days)
Show older comments
Hello,
The objective function that I am trying to optimize is highly vectorized meaning that if someone passed thousands of points to it at once, the function would do its job much more efficiently. The problem is that such optimization routines as fminunc are only capable of evaluating one point at a time; at least I could not find a way to turn on this feature if it does exist. I would be very grateful for any suggestions. Thank you.
Best wishes, Ivan
2 Comments
José-Luis
on 1 Feb 2013
Edited: José-Luis
on 1 Feb 2013
What do you mean by a highly vectorized objective function? An objective function returns a scalar. Are you talking about multiple objective optimization? If that is the case, I don't think you can optimize directly. You either need to express it as a scalar or do some sort of Pareto optimization.
Accepted Answer
Matt J
on 1 Feb 2013
Edited: Matt J
on 1 Feb 2013
What you're talking about might be possible with GA in the Global Optimization Toolbox. Since global optimization algorithms work with a population of many initial points, it makes sense for it to allow you to vectorize these evaluations.
It doesn't really make sense for the purposes of FMINUNC, though. The whole aim in local optimization code like FMINUNC is to work with one initial point (presumed to be a good one) and to keep to a minimum the number of function evaluations that you have to do. Global optimization algs only work with multiple initial points because they have to.
You could, however, use the efficiency you're talking about to help select a good initial point, which would help improve the speed of FMINUNC. Taking your example of
f=@(x) x.^2
you could do
xspace=linspace(-2,2,1000);
[~,i]=min(f(xspace));
x0=f(xspace(i));
fminunc(f,x0,...)
3 Comments
Sean de Wolski
on 1 Feb 2013
@Ivan the 'UseParallel' option is used just calculate the central differences for the gradients. If you want to use this, try fmincon() ( Interior-point algorithm is recommended) with bounds and the 'UseParallel' flag on.
Matt J
on 1 Feb 2013
There's also nothing stopping you from using PARFOR and other PCT functions to parallelize operations inside your objective function.
More Answers (1)
Shashank Prasanna
on 1 Feb 2013
Ivan, MultiStart may just be what the doctor ordered. It kicks off at several different points and takes different paths in an attempt to find a global minima:
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!