[R] Nonlinear constrains with optim

Paul Smith phhs80 at gmail.com
Thu May 10 23:00:09 CEST 2007


On 5/10/07, Spencer Graves <spencer.graves at pdf.com> wrote:
> > I don't know of any sources, but the idea is quite simple.
> >
> > For each constraint that is broken, the penalty is the amount
> > by which the constraint is broken times a penalty rate.  The
> > total penalty to add to the objective is the sum of penalties
> > over all constraints.
> >
> > There is a catch or two when using this with derivative-based
> > optimizers.  The objective typically becomes non-differentiable
> > at the boundary, and optimizers can get confused.
> I believe I've gotten good results with penalties that are the SQUARE of
> the amount by which the constraints were violated.  These are
> continuously differentiable and so don't confuse the derivative-based
> optimizers much.
>
> Also, I start with a small penalty, then increase the penalty until I
> get a solution that seems sensible.  If you can't handle a solution just
> a little outside your constraints, shrink a little the place at which
> the penalty starts.
>
>       Hope this helps.
>       Spencer Graves
>
> > They might
> > be less confused with smaller penalty rates.  However if the
> > penalty rate is too small, then you can get a "solution" that breaks
> > one or more penalties.
> >
> > Starting from a solution given by Rgenoud or its ilk is probably
> > a good idea.
> >
> > Patrick Burns
> > patrick at burns-stat.com
> > +44 (0)20 8525 0696
> > http://www.burns-stat.com
> > (home of S Poetry and "A Guide for the Unwilling S User")
> >
> > Paul Smith wrote:
> >
> >
> >> Dear All
> >>
> >> I am dealing at the moment with optimization problems with nonlinear
> >> constraints. Regenoud is quite apt to solve that kind of problems, but
> >> the precision of the optimal values for the parameters is sometimes
> >> far from what I need. Optim seems to be more precise, but it can only
> >> accept box-constrained optimization problems. I read in the list
> >> archives that optim can also be used with nonlinear constrains through
> >> penalizations. However, I am not familiar with the technique of
> >> penalizations. Could someone please indicate to me a site or a book to
> >> learn about that penalization technique?
> >>
> >> Thanks in advance,

Thanks to all. I have meanwhile had a look at Fletcher's book (as
suggested by Ravi) and I think that now I understand the idea behind
using penalties with constrained optimization problems.

Paul



More information about the R-help mailing list