[R] Nonlinear constrains with optim

Patrick Burns pburns at pburns.seanet.com
Thu May 10 20:31:58 CEST 2007


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.  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,
>
>Paul
>
>______________________________________________
>R-help at stat.math.ethz.ch 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.
>
>
>  
>



More information about the R-help mailing list