From: Johan on
Hi,

I'm looking to solve a problem for work, where we use Matlab for some applications.

The problem I need to solve is to minimize the sum

f(x1) + f(x2) + .... + f(xn)

where:
x1+a < x2
x2+b < x3
..
..
etc ( where the x's are always increasing and separated by a set of constant spacings, x_i + c_i < x_i+1 )

The function f is completely continous, however there can be one discontinuity in its derivative. Usually n is about 2 or 3, but I would like to be able to handle up to 4 or 5.

f can contain 1-4 local maximas/peaks.

I'm interested in knowing if there are any good optimization tools in matlab for solving my specific problem and how I could use it (any example code would be greatly appreciated :))

Right now I brute force it up n = 3 or 4 (but very sparse at 4), I do not require that
high precision in the solution, only that it is within ~ 5%
From: Johan on
I forgot the weights in the sum, what I want to minimize is:

c1*f(x1) + c2*f(x2) + .... + cn*f(xn)

,
sry for the confusion
From: Johan on
update: I tried this : http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/fmincon.html ,
but I guess it will only find local solutions
From: James Allison on
I would suggest you use one of the algorithms in the global optimization
toolbox:

http://www.mathworks.com/products/global-optimization/

such as ga (genetic algorithm), GlobalSearch, or patternsearch with a
global search (such as ga or latin hypercube) in the first several
iterations. Any of these options would help you find the global optimum
in the presence of multiple local optima.

If solution speed is important, and you wanted to also get a precise
answer, a hybrid approach might be best. Use a global optimization
method (such as those listed above) with loose tolerances, or even a
rough search using a DOE technique, such as lhsdesign, to find a good
starting point for fmincon.

Best Regards,

-James

Johan wrote:
> Hi,
>
> I'm looking to solve a problem for work, where we use Matlab for some
> applications.
>
> The problem I need to solve is to minimize the sum
>
> f(x1) + f(x2) + .... + f(xn)
>
> where: x1+a < x2
> x2+b < x3
> .
> .
> etc ( where the x's are always increasing and separated by a set of
> constant spacings, x_i + c_i < x_i+1 )
>
> The function f is completely continous, however there can be one
> discontinuity in its derivative. Usually n is about 2 or 3, but I would
> like to be able to handle up to 4 or 5.
>
> f can contain 1-4 local maximas/peaks.
>
> I'm interested in knowing if there are any good optimization tools in
> matlab for solving my specific problem and how I could use it (any
> example code would be greatly appreciated :))
>
> Right now I brute force it up n = 3 or 4 (but very sparse at 4), I do
> not require that
> high precision in the solution, only that it is within ~ 5%