I am trying to optimize a function of the following form:


$L = \int\_{t=0}^{T}(AR-x)dt$, where A is a system parameter


i.e. I am trying to find the optimum x(t) that minimizes L over all admissible x(t)s. R is related to x using a relation:


$\frac{dR}{dt} = axRY - bR$, where a and b are system parameters and $R(0) = R\_{0}$


$\frac{dY}{dt} = -xRY$


I was looking at this problem from mainly a simulation perspective. There is a whole amount of work that went into showing that x can take only two specific values that minimize the function over any given interval. Now, what I was thinking was to convert the integral into its discrete formulation and do the following:


For $t=1$,
Let $x = x\_{min}$ and calculate $L\_{10}$
Let $x = x\_{max}$ and calculate $L\_{11}$
Finally, choose the one that has the min L.


And then continue with t=2 and so on, in the same way. If I visualize this problem, it is nothing but finding a minimum cost path in a binary tree i.e. something of the following form:


---------------------- $L\_{00}$  

-----------------------/--\---------  

------------------$L\_{10}$----$L\_{11}$----  

-----------------/-----\----/----\-------  

-------------$L\_{20}$-----$L\_{21}$-$L\_{22}$-$L\_{23}$--


and so on until the last T. I am not sure if my thought process of simulating this is in the right direction. Can someone give me some suggestions? 



Minimizing a function containing an integral
I don't think the problem as posed has an optimal solution. This is a problem in optimal control, typically dealt with by solving the [Hamilton–Jacobi–Bellman equation](http://en.wikipedia.org/wiki/Hamilton%E2%80%93Jacobi%E2%80%93Bellman%5Fequation). Your problem here is quite general, namely, a *linear* and *unconstrained* control. Thus the minimum with respect to the control variable ($x$ in your notation, $u$ in the notation of the referenced Wikipedia page) in the HJB equation does not exist, unless the value function $V$ does not depend on the control variable. In other words, an optimum exists only in the trivial case where the control variable does not actually influence the cost function.


(A small caveat: Though I have sat through a number of lectures on optimal control theory, that is the extent of my expertise, so take this with a grain of salt.)


