Find maximum function

I need to find the maximum of the function:

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

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

restriction: 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 large (more than 1000). x less than 100. What is the best method?

+4
source share
1 answer

There are methods such as nelder-mead optimization (which I believe GSL implements), but most methods require some kind of special structure (i.e. convexity or continuity). Depending on the values โ€‹โ€‹of the function, there may not be a unique optimum or even an optimal method that the usual descent method can find.

+2
source

Source: https://habr.com/ru/post/1338485/


All Articles