This can be discretized to a linear programming problem so you can solve it with the lpSolve package. Suppose we have x0, x1, x2, ..., xn. Our objective (up to a multiple which does not matter) is:
Maximize: x1 + ... + xn which is subject to the constraints: -1/n <= x1 - x0 <= 1/n -1/n <= x2 - x1 <= 1/n ... -1/n <= xn - x[n-1] <= 1/n and x0 = xn = 0 On Jan 6, 2008 7:05 PM, Paul Smith <[EMAIL PROTECTED]> wrote: > Dear All, > > I am trying to solve the following maximization problem with R: > > find x(t) (continuous) that maximizes the > > integral of x(t) with t from 0 to 1, > > subject to the constraints > > dx/dt = u, > > |u| <= 1, > > x(0) = x(1) = 0. > > The analytical solution can be obtained easily, but I am trying to > understand whether R is able to solve numerically problems like this > one. I have tried to find an approximate solution through > discretization of the objective function but with no success so far. > > Thanks in advance, > > Paul > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.