Finding an optimal function subject to some constraints. I'm looking for hints on a problem I am facing. Not sure where to look to learn to solve such a thing or determine properties of the solution. I need to find an $f(x)$ that maximizes:
$\int_b^a{f(x)w(x)dx}$
$w(x)$ is a density function bounded everywhere. 
$f$ need not be continuous or smooth. 
Subject to the following constraints:
$f:[a,b]\rightarrow[0,1]$
$f(x)$ is monotonic increasing. 
$\int_b^a{f(x)dx}=z<(a-b)$
Edit: Seems like making some assumptions about $w$ would help the progress. 
I suspect if $w(x)$ is increasing in $x$ then the optimal $f$ is a step function $0$ up to some point and $1$ after. 
What if $w(x)$ is concave, and symmetric over $[a,b]$?   
 A: I doubt an analytic answer can be found -- I would approach this as a numerical problem in constrained optimization.  A first and very simple approach is:
Pick a discretization size $n$ so that you have grid points at the middle of $n$ intervals in $[a,b]$: $x_1=a+\frac{1}{2n},x_2=a+\frac{3}{2n},x_3=\frac{5}{2n},\ldots,x_n=b-\frac{1}{2n}$.  Your function $f$ is determined by its values at the grid points: $f(x_1)=f_1,\ldots,f(x_n)=f_n$.  Your weights similarly are $w(x_1)=w_1,\ldots,w(x_n)=w_n$.  The integral (objective function) is computed by whatever quadrature you like -- for simplicity here the midpoint rule:
$$\int_a^b f(x)w(x)\,dx\approx \frac{1}{n}\sum_{k=1}^n f_n w_k.$$
And you have the constraints $0\le f_1\le f_2\le f_3\le\cdots\le f_n\le 1$.
Give this to your favorite solver (it would take just a couple minutes to write it up for AMPL), and you have a numeric approximation for $f$.
That is the quick and naive introduction to finding a solution.  If it all seems obvious, perhaps you can update your question to reflect what you know.
