Optimization with a vectorized objective function

1 view (last 30 days)
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
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.
Ivan
Ivan on 1 Feb 2013
Edited: Ivan on 1 Feb 2013
Thank you for your quick reply. By 'a highly vectorized objective function' I meant the following. It is much more efficient to compute the fitness values of many points at once than to compute these values one by one. For example, assume the objective is x^2. Then, what fminunc does is it passes { x1, x2, x3, ... } sequentially, but it would be much better if it passed several points at a time (if the algorithm inside allows), e.g., (x1, x2, x3), (x4, x5, x6), etc. The objective is indeed scalar, but I would like to compute this scalar for many points at once and return a vector.

Sign in to comment.

Accepted Answer

Matt J
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
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
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.

Sign in to comment.

More Answers (1)

Shashank Prasanna
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:

Community Treasure Hunt

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

Start Hunting!