# Re: [R] Constrained minimization solver for nonlinear programming

From: Paul Smith <phhs80_at_gmail.com>
Date: Wed, 9 Jan 2008 16:06:19 +0000

Indeed, constrOptim does not do equality constraints, but, trough penalties, one can add them.

> A concrete example for finding a solution based on a target value instead of
> min or max would be something like this: let's say I am trying exponential
> smoothing on a time series and would like to find a solution for the
> smoothing constant that instead of minimizes the root mean square error
> (RMSE), it targets a particular value of RMSE. Is this possible in R?

Yes, Tom, R can do that for you. Apply the exponential smoothing. At the end, you get the RMSE as an expression depending on alpha (the smoothing parameter). Then use

uniroot

to solve the following equation

RMSE == "your desired value for RMSE".

Please, notice that this is not an optimization problem.

Paul

>
>
>
> On 1/9/08, Paul Smith <phhs80@gmail.com> wrote:
> >
> >
> >
> > On Jan 9, 2008 1:14 PM, tom soyer <tom.soyer_at_gmail.com> wrote:
> > > Thanks Paul. yes, with equality constraints. What are "friends"? I read
> the
> > > document for optim, but still could not figure out how to do this. Do
> you
> > > just set the lower bound equal to the upper bound?
> >
> > constrOptim is a friend of optim. See ?constrOptim.
> >
> > Could you please provide a concrete example of an optimization problem
> > that you would like R solving it?
> >
> > > Also, is it possible to ask R to search for a solution based on a target
> > > value instead of min and max? Is there a function like that in R?
> >
> > Could you please provide a concrete example?
> >
> > Paul
> >
> >
> >
> > > On 1/9/08, Paul Smith <phhs80_at_gmail.com > wrote:
> > > >
> > > >
> > > >
> > > > On Jan 9, 2008 4:01 AM, tom soyer <tom.soyer_at_gmail.com> wrote:
> > > > > I noticed that R has a few bound-constrained nonlinear min and max
> > > solvers,
> > > > > such as optim, nlm, etc. But I could not find a constrained min and
> max
> > > > > solver that is not LP. Does this mean R do not have this capability?
> It
> > > is
> > > > > hard to believe that R may not be as advanced as Excel in certain
> > > areas...
> > > > > Maybe it's there but I missed it? Does anyone know?
> > > >
> > > > Do you mean optimization solvers for nonlinear problems with equality
> > > > constraints? If so, you can use optim and friends with penalties to
> > > > incorporate equality constraints.
> > > >
> > > > Paul
> > > >
> > > >
> > > > ______________________________________________
> > > > R-help_at_r-project.org mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > http://www.R-project.org/posting-guide.html
> > > > and provide commented, minimal, self-contained, reproducible code.
> > > >
> > >
> > >
> > >
> > > --
> > > Tom
> >
> > ______________________________________________
> >
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> Tom

R-help_at_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. Received on Wed 09 Jan 2008 - 16:09:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jan 2008 - 17:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.