Optimizing intervals in piecewise function

235 Views Asked by At

I am not sure what the relevant tags are (or how to best described the problem).

I have a piecewise function where for a particular interval element there is a known functional form (e.g. for interval #4 there is a particular function) but I need to choose the optimal size for each interval.

Formally I can try to describe it as follows:

$\underset{\{c_i\}}{\operatorname{arg\,max}}\int_{0}^{1} f(x,\{a_i\},\{b_i\},\{c_i\}) dx$

Where elements of $\{a_i\},\{b_i\}$ are some real numbers (of which there are N in each set) and $\{c_i\}$ is constrained in the following way:

$0\le c_i\le 1,c_i\le c_{i+1},|\{c_i\}|=N$

(I use $\le$ because I could squeeze out/drop some of the intervals). Finally the integrand itself is:

$f(x,\{a_i\},\{b_i\},\{c_i\}) = \begin{cases} a_0 g(x) + b_0, & \mbox{if } 0 \le x \le c_0 \\ a_1 g(x) + b_1, & \mbox{if } c_0\le x \le c_1 \\ ... \\ a_{N-1} g(x) + b_{N-1}, & \mbox{if } c_{N-1}\le x \le 1 \end{cases}$

Where $g(x)$ is a continuous non-linear (in my particular case monotonic) real function. Notably the resulting $f(x)$ is not monotonic and a/b can be either positive or negative (so for some intervals increasing g(x) would yield decreasing f(x)).

How would I go about finding $c_i$ (is there an analytical way? numerical way?). Since in my case $g(x)$ is determined from data I just do brute force search, but that clearly doesn't scale for large N/not a good idea. I am also ok with a sufficiently good approximate numerical solution (in case this is a hard problem).

Ilya