On Jan 7, 2008 4:32 PM, Ravi Varadhan <[EMAIL PROTECTED]> wrote: > Your problem statement does not make much sense to me. You say that an > analytical solution can be found easily. I don't see how. > > This is a variational calculus type problem, where you maximize a > functional. Your constraint dx/dt=u(t) means that there exists a solution > (the anti-derivative of u) that is unique up to an arbitrary constant. > However, a solution may not even exist since you are imposing two conditions > on it: x(0) = x(1) = 0. If your solution satisfies both conditions, then it > certainly is unique, and it is the x(t) that maximizes integral.
Thanks, Ravi, for your answer. I think the analytical solution to my problem is x(t) = t, if t <= 1/2 and x(t) = 1 - t, if t >= 1/2. The definite integral corresponds to the area below the curve of the integrand function. If one takes this fact into consideration, then the above solution emerges quite naturally and intuitively, as one cannot think about a different x(t) (consistent with the imposed constraints) that corresponds to an area (below its curve) larger than the one corresponding to the proposed solution. Paul > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Paul Smith > Sent: Sunday, January 06, 2008 7:06 PM > To: r-help > Subject: [R] Can R solve this optimization problem? > > 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.