Neir0
Neir0

Reputation: 13377

Find maximum of a function

I need to find a maximum of the function:

a1^x1 * const1 + a2^x2 * const2 +....+ ak^xk * constk = qaulity

where xk>0 and xk is integer. ak is constant.

constraint: a1^x1 * const1*func(x1) + a2^x2 * const2*func(x2) +....+ ak^xk * constk*func(xk) < Budget

Where func is a discrete function:

func(x)
{
    switch(x)
    {
        case 1: return 423;
        case 2: return 544;
        ...
        etc
    }
}

k may be big(over 1000). x less then 100. What is the best method?

Upvotes: 4

Views: 243

Answers (1)

Foo Bah
Foo Bah

Reputation: 26281

There are techniques like nelder-mead optimization (which I believe GSL implements), but most techniques assume some sort of special structure (i.e. convexity or continuity). Depending on the values of the function, there may not exist a unique optimum or even an optimum that a normal downhill method can find.

Upvotes: 2

Related Questions